wiki:GdbHints

Debugging (with GDB)

ARB functions useful for debugging

  • GB_dump(GBDATA*)
    prints a dump of the database element. Crashes easily - see below on how to continue.
  • GB_dump_db_path(GBDATA*)
    prints the hierarchical path from DB root to given element

gdb usage e.g.:

p GB_dump(variable)

Continuing after assertions

When an assertion (arb_assert) fails, arb will stop when running inside gdb, just as if you have set a breakpoint.

  • you may use continue to continue execution
  • if impractical (e.g. because inside a loop), use
    handle SIGTRAP nostop
    finish # repeat until you are outside the loop(s)
    handle SIGTRAP stop
    

See history for continuing SIGSEGV assertions.

Handle Xwindow-grabs

Problem: If debugger stops inside a xwindow-callback (eg. in a callback called from XtDispatchEvent), it is impossible to enter keyboard commands into the debugger :/

Solution: run debugger and arb on different displays (eg. two PCs or inside and outside a virtual machine):

  1. start VM and remote login to VM from HOST via ssh -Y ...
  2. start debugger (inside VM, but with display on HOST)
  3. in gdb call set environment DISPLAY :0 before you start arb
    ⇒ arb will popup inside VM display

Workaround (with side-effects):

  • iconify arb (when breakpoint has been hit)
Last modified 21 months ago Last modified on Oct 3, 2016, 12:28:45 PM