TotalView User Guide : Part V: Debugging : Setting Action Points : Defining Eval Points and Conditional Breakpoints : Patching Programs : Branching Around Code

Branching Around Code
The following example contains a logic error where the program dereferences a null pointer:
1 int check_for_error (int *error_ptr)
2 {
3 *error_ptr = global_error;
4 global_error = 0;
5 return (global_error != 0);
6 }
The error occurs because the routine that calls this function assumes that the value of error_ptr can be 0. The check_for_error() function, however, assumes that error_ptr isn’t null, which means that line 3 can dereference a null pointer.
You can correct this error by setting an eval point on line 3 and entering:
if (error_ptr == 0) goto 4;
If the value of error_ptr is null, line 3 isn’t executed. Note that you are not naming a label used in your program. Instead, you are naming one of the line numbers generated by TotalView.

Rogue Wave Software, Inc.
Voice: (303) 473-9118
rwonlinedocs@roguewave.com