JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris Studio 12.3: Debugging a Program With dbx     Oracle Solaris Studio 12.3 Information Library
search filter icon
search icon

Document Information


1.  Getting Started With dbx

2.  Starting dbx

3.  Customizing dbx

4.  Viewing and Navigating To Code

5.  Controlling Program Execution

6.  Setting Breakpoints and Traces

7.  Using the Call Stack

8.  Evaluating and Displaying Data

9.  Using Runtime Checking

10.  Fixing and Continuing

11.  Debugging Multithreaded Applications

12.  Debugging Child Processes

13.  Debugging OpenMP Programs

14.  Working With Signals

15.  Debugging C++ With dbx

16.  Debugging Fortran Using dbx

17.  Debugging a Java Application With dbx

18.  Debugging at the Machine-Instruction Level

19.  Using dbx With the Korn Shell

20.  Debugging Shared Libraries

A.  Modifying a Program State

B.  Event Management

C.  Macros

Macro Expansion

Macro Definitions

Compiler and Compiler Options

Tradeoffs in Functionality


Skimming Errors

Using the pathmap Command To Improve Skimming

D.  Command Reference


Macro Expansion

Macro expansion is applied to both the variable and the expression in an assign command (see assign Command).

In the call command (see call Command), macro expansion is applied to the name of the function being called as well as to the parameters being passed.

The macro command (see macro Command) takes any expression and macro and expands the macro. For example:

(dbx) macro D(1, 2)
    Expansion of: D(1, 2)
              is: d(1,2)

If you give the whatis command (see whatis Command) a macro, it shows the macro's definition. For example:

(dbx) whatis B
    #define B(x) b(x)

If you give the which command (see which Command) a macro, it shows where the macro that is currently active in the scope is defined. For example:

(dbx) which B2
    `a.out`macro_wh.c`B2    # defined at defs2.h:3
            # included from defs1.h:3
            # included from macro_wh.c:23

If you give the whereis command (see whereis Command) a macro, it shows all of the places where the macro has been defined. The list is limited to modules for which dbx has already read debugging information. For example:

(dbx) whereis U
    macro:          U       # defined at macro_wh.c:21
    macro:          U       # undefined at defs1.h:5

The dbx environment variable macro_expand controls whether these commands expand macros. It is set to on by default.

In general, the +m option in dbx commands causes the commands to bypass macro expansion. The -m option forces macro expansion even if the dbx environment variable macro_expand is set to off. An exception is the -m option within the $[] construct, where -m only causes macros to be expanded, with no evaluation taking place. This exception facilitates macro expansion in shell scripts.