Categories
Uncategorized

Context sensitive debugging in GDB (XCode)

Occassionally you’re trying to debug something where a regular breakpoint won’t work. For example, for some reason bringing the debugger to the front might interfere with tracking down the bug.

For example, if you are examining focus.

Here is a way to alter a breakpoint in XCode so that it prints something, then pauses, then resumes.

Open the breakpoints window. Click the auto-play checkbox for your breakpoint. Then add a “Debugger Command” action and put some code like this:

up
dbt
call (void) sleep( 3 )

(dbt is my presonal macro for a traceback function.) Using call to invoke sleep makes it pause for three seconds before continuing.