Using SoftBench Debugger

Debugging C++ Programs

However, if your program contains static objects, the constructors for those objects must be invoked before main(). By the time the debugger pauses in main(), the constructors have already completed.

If you need to debug these constructors, you must tell DDE to pause before calling them. This can be accomplished by executing the DDE command "property system -on". When you set prop sys, DDE pauses at the very first assembly instruction of the program. You can then step into the constructors. You should either place the prop sys -oncommand in a .dderc file, or issue the command through the "Debugger Input" input box and rerun your program.

When you pause at the first instruction, DDE does not yet realize you are executing a C++ program. This can result in any C++ breakpoints being lost. If you want to retain your C++ breakpoints across executions, execute the DDE command "prop lang c++" before rerunning your program. This gives DDE the information it needs to retain your breakpoints.

When you finish debugging your static constructors, issue "prop sys -off" and "prop lang default" commands. This returns DDE to normal debugging mode and uses less CPU resources.

226

Chapter 7