Outils pour utilisateurs

Outils du site


tech:notes_gdb_debug

Notes gdb debug

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 <process id>

Génération d'un coredump

# gdb -p <pid>
...
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)
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))
tech/notes_gdb_debug.txt · Dernière modification : de Jean-Baptiste

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki