This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Debugging Macros with gdb
- From: "Vidyasagara Guntaka" <vguntaka at Brocade dot COM>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Mon, 14 Feb 2005 14:50:58 -0800
- Subject: Debugging Macros with gdb
Hi,
I am new to this list.
I am trying to debug macros using gdb. I have read the gdb document
which said that -gdwarf-2 and -g3 options must be present while
compiling using gcc. I did that. Still, when I used gdb, it complained
that there was no information for the macro name. Do I need to specify
any other options apart from the above?
Helow I am giving a transcript of what happened on Fedora Core 3 system:
[sagar@rainbow c]# cat x.c
#include <stdio.h>
#define ABC 257
main ()
{
int a = 190;
printf ("Testing (%d) .....\n", ABC);
return (0);
}
[sagar @rainbow c]# gcc --version
gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
[sagar @rainbow c]# gcc -gdwarf-2 -g3 -o x x.c
[sagar @rainbow c]# gdb -nw ./x
GNU gdb Red Hat Linux (6.1post-1.20040607.43rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host
libthread_db library "/lib/tls/libthread_db.so.1".
(gdb) info macro ABC
GDB has no preprocessor macro information for that code.
(gdb) break 8
Breakpoint 1 at 0x804838b: file x.c, line 8.
(gdb) run
Starting program: /home/sagar/programming/c/x
Breakpoint 1, main () at x.c:8
8 printf ("Testing (%d) .....\n", ABC);
(gdb) info macro ABC
The symbol `ABC' has no definition as a C/C++ preprocessor macro
at /usr/include/stdio.h:-1
(gdb)