Friday, September 21, 2012

NetBeans+gdb Breakpoints Fix/Workaround

NetBeans and gdb apparently don't always work well together.  If you find that the debugger won't stop on breakpoints, there is an easy fix. (I believe this applies to NB + MinGW, not NB + Cygwin).

In Windows XP, I added the additional command arguments, i.e. "-J-Dgdb.breakpoints.shortpaths=true", in the shortcut by appending to the "Target" string, after the program name. Yes it is true, we are still using XP at my work!

This fix seems to get breakpoints completely functional...   run to cursor (F4) still doesn't work but I guess that is just a slight nuisance.


Wait... there's more! I am surprised to find that I can't directly edit memory locations while debugging in NB. The workaround is to go directly to the console available in NB, but the console is not enabled by default in order to protect the innocent. There is an additional command line parameter which will enable the gdb console:

-J-Dgdb.console.window=true

Unfortunately, due to limitation of the gdb remote protocol, NB is not immediately notified of changes made to memory inside the gdb console... this requires closing and then reopening the memory window in order to force NB to synchronize with gdb.