This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: -ggdb3 -gdwarf-4 but "info macro BLAH" still doesn't work?
- From: Luke <hazelnusse at gmail dot com>
- To: gdb at sourceware dot org
- Date: Tue, 8 May 2012 03:03:50 -0700
- Subject: Re: -ggdb3 -gdwarf-4 but "info macro BLAH" still doesn't work?
I'm having the same problem.
Here is a very simple test C program:
#include <stdio.h>
#define M 42
#define ADD(x) (M + x)
int main ()
{
printf("%d\n", M);
printf("%d\n", ADD(2));
return 0;
}
I compile with:
$ gcc -gdwarf-4 -gdb3 -Wall -O0 sample.c -o sample
then debug:
$ gdb -q ./sample
Reading symbols from /tmp/sample...done.
(gdb) b main
Breakpoint 1 at 0x400560: file sample.c, line 6.
(gdb) run
Starting program: /tmp/sample
Breakpoint 1, main () at sample.c:6
6 printf("%d\n", M);
(gdb) macro list
(gdb) info source
Current source file is sample.c
Compilation directory is /tmp
Located in /tmp/sample.c
Contains 27 lines.
Source language is c.
Compiled with DWARF 2 debugging format.
Does not include preprocessor macro info.
(gdb) macro expand ADD(1)
expands to: ADD(1)
(gdb) print M
No symbol "M" in current context.
I have tried -g3, -gstabs, -gstabs+ and all have the same problem.
This happens with Linaro gcc 4.7-2012.04, as well as a very recent
pull from gcc master (4.8.0 20120502).
It doesn't happen with gcc 4.6.2.
Hopefully somebody is aware of this and knows what to do.
Any suggestions? I'm guessing this is a gcc bug. I'll search there
and if it isn't already reported, I will reported it.
~Luke