Debugging a Program With dbx

Basic Concepts

The fix and continue feature allows you to modify and recompile a source file and continue executing without rebuilding the entire program. By updating the .o files and splicing them into your program, you don't need to relink.

The advantages of using fix and continue are:

How fix and continue Operates

Before applying the fix command you need to edit the source in the editor window. After saving changes, type fix.

Once fix has been invoked, dbx calls the compiler with the appropriate compiler options. The modified files are compiled and shared object (.so) files are created. Semantic tests are done by comparing the old and new files.

The new object file is linked to your running process using the runtime linker. If the function on top of the stack is being fixed, the new stopped in function is the beginning of the same line in the new function. All the breakpoints in the old file are moved to the new file.

You can use fix and continue on files that have been compiled with or without debugging information, but there are some limitations in the functionality of fix and continue for files originally compiled without debugging information. See the -g option description in "Command Reference" for more information.

You can fix shared objects (.so) files, but they have to be opened in a special mode. You can use either RTLD_NOW|RTLD_GLOBAL or RTLD_LAZY|RTLD_GLOBAL in the call to dlopen.

Modifying Source Using fix and continue

You can modify source code in the following ways when using fix and continue:

Restrictions

Sun WorkShop might have problems when functions are mapped from the old file to the new file. To minimize such problems when editing a source file:

If you need to make any of the proceeding changes, rebuild your program.