Re: expanding c-macros in gdb

Eli Zaretskii
2001-12-05T11:43:20Z

On Wed, 5 Dec 2001, Howind Axel, Externer Dienstleister wrote:

> Is there a way to make gdb understand that the command
> print REFP_XYZ(a).abc is the same as print xyz_ptr->s_xyz.r_xyz[i].xyz.abc?
>
> I have read in the gcc manual that compiling with -g3 stores information
> about all defined macros, so that "Some debuggers support macro
> expansion when you use `-g3'."
> This does not seem to work with gdb (gcc 2.95.2, gdb 5.0, on HP-UX 10.20).

Try compiling with -gdwarf-2 or -gstabs+ instead of -g3. Perhaps that
would help (I have no idea whether DWARF2 is supported on HP-UX).

> define printmac(arg)
> print `echo $arg | sed -f transform`

You want to invoke cpp, not Sed, I think: macro expansion is not a simple
text substitution.