Debugging with GDB Manual (5900-1473; WDB 6.2; January 2011)

Table Of Contents
When you use the edit command, HP WDB then monitors any edited source files for
additional changes. After you enter the initial fix command, HP WDB checks for
additional saved changes to a source file each time you enter a program execution
command. If a saved source file has been changed, HP WDB asks if you want to fix the
changed source, allowing you to apply repeated fixes without explicitly entering the fix
command.
The Fix and Continue facility enables you to make the following changes:
Change existing function definitions.
Disable, reenable, save, and delete redefinitions
Adding global and file static variables.
Add new structure fields to the end of a structure type object.
Set breakpoints in and single-step within redefined code.
NOTE: You must rebuild the program after you use the fix command because the
changes you make are temporarily patched into the executable image. The changes are
lost if you load a different executable and are not re ected in the original executable
when you exit the debugger.
14.7.4 Example Fix and Continue session
This example shows how you can make and test changes to a function without leaving
the debugger session.
Here is a short sample C program with an error:
int sum (num) int num;
{
int j, total = 0;
for (j = 0; j <= num; j++)
total += num;
}
main()
{
int num = 10;
printf("The sum from 1 to %d is = %d\n", num, sum(num));
}
1. Compile the program.
cc sum.c -g -o mysum
/usr/ccs/bin/ld: (Warning) At least one PA 2.0 object file
(sum.o) was detected.
The linked output may not run on a PA 1.x system.
2. Run the program.
./mysum
14.7 Fix and continue debugging 141