From: "Choi, Jang-Wook" <choijo@adc.co.kr>
To: "Howind Axel, Externer Dienstleister" <Axel.Howind@fja.com>
Cc: "'gdb@sources.redhat.com'" <gdb@sources.redhat.com>
Subject: Re: expanding c-macros in gdb
Date: Wed, 05 Dec 2001 03:40:00 -0000 [thread overview]
Message-ID: <Pine.LNX.4.33.0112052021220.1480-100000@localhost.localdomain> (raw)
In-Reply-To: <6380966D8BCFD5119C9300306E1C8487057727@clg-server7.clg.fja.de>
Hi, let me tell you my method.
I use gdb through emacs and use emacs shortcut key C-c C-e after set
region for the macro, then emacs expand & show the macro to me.
After that I print the value in gdb.
cjw
On Wed, 5 Dec 2001, Howind Axel, Externer Dienstleister wrote:
> Hello,
>
> we are using gcc/gdb for development in C. The C code uses some
> macros for accessing data, for example:
>
> #define REFP_XYZ(i) xyz_ptr->s_xyz.r_xyz[i].xyz
> ...
> if (REFP_XYZ(a).abc != 0) ...
> ...
>
> 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).
>
> Then I thought about defining a macro printmac in gdb, but I have not found
> a way to
> do the expansion. What I'm thinking about is to call a shell- or sed-skript
> that does
> the expansion and pass the result on to the print command, something like
> this
> (transform is the name of a sed-script, that does the actual expansion):
>
> define printmac(arg)
> print `echo $arg | sed -f transform`
>
> Is something like this possible in gdb? Can I use a hook?
>
> Thanks in advance,
>
> Axel Howind
>
>
next prev parent reply other threads:[~2001-12-05 11:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-12-05 2:11 Howind Axel, Externer Dienstleister
2001-12-05 3:40 ` Choi, Jang-Wook [this message]
2001-12-05 3:43 ` Eli Zaretskii
2001-12-05 7:45 ` Daniel Jacobowitz
2001-12-05 9:27 ` Daniel Berlin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.33.0112052021220.1480-100000@localhost.localdomain \
--to=choijo@adc.co.kr \
--cc=Axel.Howind@fja.com \
--cc=gdb@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox