Using SoftBench Debugger

Examining and Changing Data in Your Program

For example, if you declare a pointer as int *numptr, then selecting Print* ( ) with numptr in the "()" input box prints the integer pointed to by numptr. You can also Print ( ) the expression *numptr.

Printing Hex or String Values

SoftBench Debugger knows the type of the variables you print, and usually prints them in a usable form. However, it cannot tell if an integer should be printed in decimal or hexadecimal, nor can it tell if you want a "char *" value to be printed as a character or a string.

You can specify the print format by choosing one of the selections under "Show: Data Value Print Format". Refer to online help for information on printing strings and character arrays.

If you frequently need to print hex or string values, you can define a button to do it on the front panel. See “Customizing User Buttons” on page 228.

You can also use C-style "casting" to view variables in a different format. If you wanted to examine the bottom byte of mask as a character, you could enter "(char) mask" in the "()" input box and select Print ( ).

Changing Data in Your Program

1.Type an assignment statement in the "()" input box.

2.Select Print ( ).

For example, the assignment "n = 12" sets the value of n to 12. The assignment statement must be legal in the current scope. That is, n must be a declared numeric data type.

You can also call functions that modify their arguments.

For more information on the syntax of variables and expressions, see “Using Debugger Variables” on page 183 or “Specifying Variables” on page 178.

Using Debugger Variables

DDE supports user-created special variables for use as global temporaries during debugging. For example, to create a pointer to an integer, enter

declare int *tptr

Chapter 7

183

Page 183
Image 183
HP UX SoftBench Software manual Printing Hex or String Values, Changing Data in Your Program, Using Debugger Variables