HP B1476 68020 User Manual page 257

Debugger/emulator
Table of Contents

Advertisement

Example
The following example shows how return values can be used to conditionally
control a breakpoint. The example uses the Debugger Macro Add and
Breakpt Write commands to define a breakpoint that occurs only when the
target variable days becomes greater than 31.
Debugger Macro Add int daycheck()
{
}
.
Breakpt Write &days; daycheck()
When the break occurs, the macro is executed. If days is less than or equal to
31, program execution continues. If days is greater than 31, program execution
stops.
If you have the following macro definition:
Debugger Macro Add int break_when(stopfunction, min, max)
char
int
int
{
}
.
the command:
Breakpt Write &global_var; break_when("foo", 256,512)
will set a write breakpoint on the global variable global_var. Whenever the
program writes to global_var, the macro break_when() is executed with the
parameters "foo", 256, and 512. The macro returns the value 1 until the value
of global_var falls between 256 and 512 because of a write to global_var in the
function foo(). The macro then returns 0, causing the program to halt.
if (days > 31)
return 0;
else
return 1;
*stopfunction;
min;
max;
/* Debugger symbol @function is a char pointer to the name
/* of the current function.
/* with the function name passed, using the built-in macro
/* memcmp().
if (!strcmp(@function,stopfunction))
if ((global_var > min) && (global_var <max))
{
$Expression Printf "global_var: %d\n", global_var$;
return 0;
}
/* Not in specified function, return 1 so that program will */
/* continue executing.
return 1;
Chapter 8: Using Macros and Command Files
Compare the current function
Using Macros
*/
*/
*/
*/
*/
233

Advertisement

Table of Contents
loading

This manual is also suitable for:

B1476 68030

Table of Contents