public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: christian@jaeger.mine.nu
To: gdb-gnats@sources.redhat.com
Subject: macros/2483: not even the macro debugging example from the documentation works
Date: Fri, 25 Jul 2008 00:18:00 -0000	[thread overview]
Message-ID: <20080725001719.30360.qmail@sourceware.org> (raw)


>Number:         2483
>Category:       macros
>Synopsis:       not even the macro debugging example from the documentation works
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 25 00:18:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     christian@jaeger.mine.nu
>Release:        6.8-debian
>Organization:
>Environment:
Debian testing, gcc (Debian 4.3.1-2) 4.3.1
>Description:
I tried compiling a big program with -gdwarf-2 -g3 in the hope that I could expand / use shown macros, which didn't work. I then tried the examples in the info Macros page ("9 C Preprocessor Macros"), and did exactly (I think) as shown, and could in fact expand the ADD macro, but not the Q macro. It looks like macros from header files are somehow ignored?
>How-To-Repeat:
$ gcc -gdwarf-2 -g3 sample.c -o sample
$ gdb sample
..
(gdb) list main
3	
4	     #define M 42
5	     #define ADD(x) (M + x)
6	
7	     main ()
8	     {
9	     #define N 28
10	       printf ("Hello, world!\n");
11	     #undef N
12	       printf ("We're so creative.\n");
(gdb) info macro ADD
Defined at /tmp/chris/sample.c:5
#define ADD(x) (M + x)
(gdb) info macro Q
The symbol `Q' has no definition as a C/C++ preprocessor macro
at /tmp/chris/sample.c:13
(gdb) break main
Breakpoint 1 at 0x4004d4: file sample.c, line 10.
(gdb) run
Starting program: /tmp/chris/sample 

Breakpoint 1, main () at sample.c:10
10	       printf ("Hello, world!\n");
(gdb) info macro N
Defined at /tmp/chris/sample.c:9
#define N 28
(gdb) macro expand N Q M
expands to: 28 Q 42
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2008-07-25  0:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-25  0:18 christian [this message]
2008-07-25 15:18 Tom Tromey
2008-07-25 17:18 Christian Jaeger
2008-07-25 17:18 Christian Jaeger
2008-07-25 17:48 Tom Tromey
2008-07-25 17:58 Daniel Jacobowitz
2008-07-25 18:48 tromey

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=20080725001719.30360.qmail@sourceware.org \
    --to=christian@jaeger.mine.nu \
    --cc=gdb-gnats@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).