HP gnu source-level debugger 5992-4701 manual Evaluating Macros, Debug=none

Models: gnu source-level debugger 5992-4701

1 369
Download 369 pages 58.54 Kb
Page 154
Image 154

- show macro [macro-name] or info macro [macro-name]

Displays the macro definition, source file name, and the line number. For example:

(gdb) info macro VAR2 Defined at scope.c:21 #define VAR2 201

- macro expand [macro-name]

Expands the macro and the parameters in the macro. If there are any parameters in the macro, they are substituted in the macro definition when the definition is displayed.

For example:

#define YY 6

#define MAC (67 + YY)

...

$ gdb

...

(gdb) macro expand MAC expands to: (67 + 6)

Evaluating Macros

HP WDB enables you to evaluate a macro and display the output. You can evaluate the macro by using the commonly used gdb commands for evaluating and displaying expressions, such as print. HP WDB supports the evaluation of macros with variables, constants, complex algebraic expressions involving variables, nested macros, and function calls. HP WDB does not support the evaluation of macros with multiple statements in the macro definitions, or the evaluation of macros with stringifying and pasting tokens in the macro definitions.

14.9.1.1Compiler Options to Enable Macro Debugging

To enable macro debugging, the program must be compiled with the +macro_debug=[allnoneref] compiler option.

Additionally, the program must be compiled with one of the -goptions (-g, -g0, or -g1) to enable macro debugging. For example:

cc -g +macro_debug=all -o sample sample.c

The following options are available for the +macro_debug compiler option:

all To view and evaluate all the macro expressions in the program, you must compile the program with +macro_debug=all. This option can cause a significant increase in object file size.

ref To view and evaluate only the reference macros in the program, you must compile the program with +macro_debug=ref. This is the default for -g,-g0, or -g1.

none To disable macro debugging, you must compile the program with +macro_

debug=none

154 HP-UX Configuration-Specific Information

Page 154
Image 154
HP gnu source-level debugger 5992-4701 manual Evaluating Macros, Compiler Options to Enable Macro Debugging, Debug=none