TotalView User Guide
:
Part II: Debugging Tools and Tasks
:
Setting Action Points
:
Defining Eval Points and Conditional Breakpoints
:
Patching Programs
:
Correcting Code
Correcting Code
The following example contains a coding error: the function returns the maximum value instead of the minimum value:
1 int minimum (int a, int b)
2 {
3 int result; /* Return the minimum */
4 if (a < b)
5 result = b;
6 else
7 result = a;
8 return (result);
9 }
Correct this error by adding the following code to an eval point at line 4:
if (a < b) goto 7; else goto 5;
This effectively replaces the
if
statement on line 4 with the code in the eval point.