Using Fix and Continue |
7 |
![]() |
This chapter is organized into the following sections:
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.
Note - Do not use fix if a build is in process; the output from the two processes will intermingle in the Building window.
Although you can do an unlimited number of fixes, if you have done several fixes in a row, consider rebuilding your program. Fixing changes the program image in memory, but not on the disk. As you do more fixes, the memory image gets out of sync with what is on the disk.
fix does not make the changes within your executable file, but only changes the .o files and the memory image. Once you have finished debugging a program, you need to rebuild your program to merge the changes into the executable.
For more information on customizing the Fix command, see Using Fix and Continue in the manual, Command-Line Utilities.
Before resuming program execution, you should be aware of the following conditions:
There are two ways to solve this problem:
The following example shows how a simple bug can be fixed. The application gets a segmentation violation in line 6 when trying to dereference a NULL pointer:
Fix Changes.
modified line
14 copy(buf);
fixing "testfix.cc".....
pc moved to "testfix.cc":6
stopped in copy at line 6 in file "testfix.cc"
6 while ((*to++ = *from++) != '\0');
Pop.
stopped in main at line 14 in file "testfix.cc"
14 copy(buf);
Now the program prints the correct string:
ships |