This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
macros/2483: not even the macro debugging example from the documentation works
- From: christian at jaeger dot mine dot nu
- To: gdb-gnats at sources dot redhat dot com
- Date: 25 Jul 2008 00:17:19 -0000
- Subject: macros/2483: not even the macro debugging example from the documentation works
- Reply-to: christian at jaeger dot mine dot nu
>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: