Sunday, November 28, 2010

gdb

(gdb) kill ---> kill the session and keep your breakpoints...
(gdb) run ---> restart a new session
(gdb) info locals ---> local variables
(gdb) quit ---> exit gdb, lose your breakpoints...

(gdb) bt or backtrace ---> call stack
(gdb) bt full ---> call stack + all variables
(gdb) x/200s 0x89b8a8 ---> display mem as string

A blank line repeat the previous command

  • Debugging STL
    Add a file .gdbinit to debug STL, see this link:
    http://www.yolinux.com/TUTORIALS/GDB-Commands.html#STLDEREF

    Then you can use it like this:
    pmap params char* char*

    See "Run / Debug Configurations" and debugger tab to specify a particular .gdbinit. Note that I had to add the .gdbinit full path, otherwise it would not work

  • gdb with arguments
    gdb --args your_bin -c ~/2.2.25/etc -t 16

  • Debugging a core dump:
    - gdb MyBin core.14694
    and then bt for backtrace

    .
  • No comments: