Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Paul Koning <pkoning@equallogic.com>
Cc: gdb@sources.redhat.com
Subject: Re: preprocessor support?
Date: Tue, 01 Jun 2004 01:43:00 -0000	[thread overview]
Message-ID: <20040601014344.GA4341@nevyn.them.org> (raw)
In-Reply-To: <16567.38040.594168.509373@gargle.gargle.HOWL>

On Fri, May 28, 2004 at 03:35:52PM -0400, Paul Koning wrote:
> >>>>> "Daniel" == Daniel Jacobowitz <drow@false.org> 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 <stdio.h>
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


  reply	other threads:[~2004-06-01  1:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-28 19:24 Paul Koning
2004-05-28 19:29 ` Daniel Jacobowitz
2004-05-28 19:35   ` Paul Koning
2004-06-01  1:43     ` Daniel Jacobowitz [this message]
2004-06-01 14:49       ` Paul Koning

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=20040601014344.GA4341@nevyn.them.org \
    --to=drow@false.org \
    --cc=gdb@sources.redhat.com \
    --cc=pkoning@equallogic.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