Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* preprocessor support?
@ 2004-05-28 19:24 Paul Koning
  2004-05-28 19:29 ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Koning @ 2004-05-28 19:24 UTC (permalink / raw)
  To: gdb

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)?

Thanks,
	paul


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: preprocessor support?
  2004-05-28 19:24 preprocessor support? Paul Koning
@ 2004-05-28 19:29 ` Daniel Jacobowitz
  2004-05-28 19:35   ` Paul Koning
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2004-05-28 19:29 UTC (permalink / raw)
  To: Paul Koning; +Cc: gdb

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)?

It should work everywhere, so you'll have to dig at it harder.  I'm not
sure that it's tested; there's at least one test in the testsuite but I
don't see it going out of its way to pass -g3, so the binary won't have
macro information.

-- 
Daniel Jacobowitz


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: preprocessor support?
  2004-05-28 19:29 ` Daniel Jacobowitz
@ 2004-05-28 19:35   ` Paul Koning
  2004-06-01  1:43     ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Koning @ 2004-05-28 19:35 UTC (permalink / raw)
  To: drow; +Cc: gdb

>>>>> "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?

	paul



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: preprocessor support?
  2004-05-28 19:35   ` Paul Koning
@ 2004-06-01  1:43     ` Daniel Jacobowitz
  2004-06-01 14:49       ` Paul Koning
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2004-06-01  1:43 UTC (permalink / raw)
  To: Paul Koning; +Cc: gdb

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: preprocessor support?
  2004-06-01  1:43     ` Daniel Jacobowitz
@ 2004-06-01 14:49       ` Paul Koning
  0 siblings, 0 replies; 5+ messages in thread
From: Paul Koning @ 2004-06-01 14:49 UTC (permalink / raw)
  To: drow; +Cc: gdb

>>>>> "Daniel" == Daniel Jacobowitz <drow@false.org> writes:

 Daniel> ...So the macro code is not handling creation of a default
 Daniel> source location right; this is a recurring problem, I
 Daniel> think...

Great, thanks!

That sounds exactly like the problem where you can't examine variables
whose names match that of a type, until you've touched some other
(unambiguous) variable in the same source file.

      paul


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-06-01 14:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-28 19:24 preprocessor support? Paul Koning
2004-05-28 19:29 ` Daniel Jacobowitz
2004-05-28 19:35   ` Paul Koning
2004-06-01  1:43     ` Daniel Jacobowitz
2004-06-01 14:49       ` Paul Koning

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox