{{tag>Brouillon Debug Segfault Coredump}} # Notes gdb debug Voir : * [[linux_-_file_descriptor_-_lsof_-_deleted_files|Linux - File Descriptor - deleted files]] * https://developers.redhat.com/articles/2023/06/19/debugging-gdb-create-custom-stack-winders Voir aussi * [[Process audit quand strace n'est pas là]] * [How to cache data using GDB's Python API](https://developers.redhat.com/articles/2024/02/05/how-cache-data-using-gdbs-python-api) ## Exemple d'analyse d'un Segmentation fault Voir aussi : * SIGSEGV ~~~ $ python3 -c "import pymssql ; conn = pymssql.connect(server='127.0.0.1', port='1433', user=r'ACME\user1', password=r'P@ssw0rd!', database='dbname')" Segmentation fault (core dumped) ~~~ ~~~ $ gdb --args python3 -c "import pymssql ; conn = pymssql.connect(server='127.0.0.1', port='1433', user=r'ACME\user1', password=r'P@ssw0rd!', database='dbname')" (gdb) r (gdb) bt ~~~ ~~~ gdb --args scsynth at gdb prompt: run gdb -p ~~~ ## Génération d'un coredump ~~~ # gdb -p ... generate-core-dump /dev/null ... quit ~~~ ---- Source : https://stackoverflow.com/questions/8305866/how-do-i-analyze-a-programs-core-dump-file-with-gdb-when-it-has-command-line-pa ~~~ $ ./crash -p param1 -o param2 Segmentation fault (core dumped) ~~~ ~~~bash gdb --args ./crash -p param1 -o param2 ~~~ Man pages will be helpful to see other GDB options. Most useful commands are: * **bt (backtrace)** * **info locals** (show values of local variables) * **info registers** (show values of CPU registers) * **frame X** (change to stack frame X) * **up** and **down** (navigate in the stack frame (call chain))