From: "Ramana Radhakrishnan" <ramana.radhakrishnan@codito.com>
To: devnull@kma.eu.org
Cc: gdb@sources.redhat.com
Subject: Re: Struct fields printed in a strange way
Date: Wed, 24 Nov 2004 17:53:00 -0000 [thread overview]
Message-ID: <32856.210.18.132.234.1101319515.squirrel@webmail.codito.com> (raw)
In-Reply-To: <41A48947.5040507@kma.eu.org>
Hi,
> Hello all,
>
> [ Apologies: I forgot to set the Reply-To field the first time.
> Please re-send your reply if it was lost inside the bit bucket. ]
Its still lost ! :-)
>
> gdb seems slightly confused when the name of a struct field is
> suffixed with "__0".
>
> $ cat foo.c
> struct foo { double x__0, y__0, z__1; } bar;
>
> int main(void) { return 0; }
>
> $ gcc-3.3.2 -Wall -ansi -pedantic -g3 foo.c
I was able to repeat this with
[ramana@numenor gdb]$ gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.3.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--host=i386-redhat-linux
Thread model: posix
gcc version 3.3.2 20031022 (Red Hat Linux 3.3.2-1)
and
GNU gdb 6.3.50_2004-11-23-cvs
>
> $ gdb a.out
> GNU gdb 6.0-2mdk (Mandrake Linux)
> Copyright 2003 Free Software Foundation, Inc.
> [...]
> This GDB was configured as "i586-mandrake-linux-gnu"...Using host
> libthread_db library "/lib/tls/libthread_db.so.1".
>
> (gdb) print bar
> $1 = {::x(void) = 0, ::y(void) = 0, z__1 = 0}
>
> (gdb) show language
> The current source language is "auto; currently c".
>
> Why is x__0 changed to ::x(void)? Is the "__0" suffix reserved in gdb?
This appears to be due to the way in which the structs are handled in
c-valprint.c . The demangler gets called here because the function
c_val_print prints the structure fields using the printer from the c++
language implementation. Should there not be a C equivalent for this ?
This btw is from yesterday's CVS sources.
cheers
Ramana
>
> --
> Regards, Grumble
>
----
Ramana Radhakrishnan
GNU Tools.
Codito Technologies
next parent reply other threads:[~2004-11-24 17:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <41A48947.5040507@kma.eu.org>
2004-11-24 17:53 ` Ramana Radhakrishnan [this message]
2004-11-26 17:26 ` Dave Korn
2004-11-18 21:22 Grumble
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=32856.210.18.132.234.1101319515.squirrel@webmail.codito.com \
--to=ramana.radhakrishnan@codito.com \
--cc=devnull@kma.eu.org \
--cc=gdb@sources.redhat.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