From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30012 invoked by alias); 1 Jun 2004 01:43:48 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 30003 invoked from network); 1 Jun 2004 01:43:47 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sourceware.org with SMTP; 1 Jun 2004 01:43:47 -0000 Received: from drow by nevyn.them.org with local (Exim 4.34 #1 (Debian)) id 1BUyJc-00019B-DR; Mon, 31 May 2004 21:43:44 -0400 Date: Tue, 01 Jun 2004 01:43:00 -0000 From: Daniel Jacobowitz To: Paul Koning Cc: gdb@sources.redhat.com Subject: Re: preprocessor support? Message-ID: <20040601014344.GA4341@nevyn.them.org> Mail-Followup-To: Paul Koning , gdb@sources.redhat.com References: <16567.37347.995508.204649@gargle.gargle.HOWL> <20040528192945.GA4018@nevyn.them.org> <16567.38040.594168.509373@gargle.gargle.HOWL> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <16567.38040.594168.509373@gargle.gargle.HOWL> User-Agent: Mutt/1.5.5.1+cvs20040105i X-SW-Source: 2004-06/txt/msg00001.txt.bz2 On Fri, May 28, 2004 at 03:35:52PM -0400, Paul Koning wrote: > >>>>> "Daniel" == Daniel Jacobowitz writes: > > Daniel> On Fri, May 28, 2004 at 03:24:19PM -0400, Paul Koning wrote: > >> These days GCC will output dwarf2 debug sections listing > >> preprocessor symbol definitions, but gdb 6.1 doesn't seem to look > >> at that (at least not for mips-netbsd). > >> > >> Is that not implemented yet? Is it in some targets but not this > >> one (and if so, any pointers to places I might look to teach this > >> target a new trick)? > > Daniel> It should work everywhere, so you'll have to dig at it > Daniel> harder. I'm not sure that it's tested; there's at least one > Daniel> test in the testsuite but I don't see it going out of its way > Daniel> to pass -g3, so the binary won't have macro information. > > To be more specific: > > I looked at the .S file coming out of gcc, and saw the macro debug > data. > > I then linked the executable file, did an objdump on that, and again > saw the macros in the debug data (.debug_macinfo section). > > I then fed the executable to gdb, and asked it to print me the value > of a couple of preprocessor symbols, like TEST which I defined and > __GNUC__ which gcc put in. Gdb said: > No symbol "__GNUC__" in current context. > > Do I need to speak a magic word to have gdb look for the macro > symbols? No, you really shouldn't have to. However, at a guess: drow@nevyn:~% gcc -g3 -o m main-inc.c drow@nevyn:~% gdb ./m GNU gdb 6.1-debian 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-linux"...Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1". (gdb) p __GNUC__ No symbol "__GNUC__" in current context. (gdb) i macro __GNUC__ GDB has no preprocessor macro information for that code. (gdb) list 1 #include 2 3 int 4 main() 5 { 6 printf ("Test\n"); 7 return 0; 8 } (gdb) i macro __GNUC__ Defined at /opt/mvista/tests/main-inc.c:1 #define __GNUC__ 3 (gdb) p __GNUC__ $1 = 3 So the macro code is not handling creation of a default source location right; this is a recurring problem, I think... -- Daniel Jacobowitz