From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12845 invoked by alias); 24 Nov 2004 17:47:28 -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 12752 invoked from network); 24 Nov 2004 17:47:09 -0000 Received: from unknown (HELO marvin.codito.net) (203.197.88.2) by sourceware.org with SMTP; 24 Nov 2004 17:47:09 -0000 Received: from webmail.codito.com (localhost [127.0.0.1]) by marvin.codito.net (8.13.1/8.13.1/Debian-17) with ESMTP id iAOI5DNv023349; Wed, 24 Nov 2004 23:35:15 +0530 Received: from 210.18.132.234 (SquirrelMail authenticated user ramana.radhakrishnan); by webmail.codito.com with HTTP; Wed, 24 Nov 2004 23:35:15 +0530 (IST) Message-ID: <32856.210.18.132.234.1101319515.squirrel@webmail.codito.com> In-Reply-To: <41A48947.5040507@kma.eu.org> References: <41A48947.5040507@kma.eu.org> Date: Wed, 24 Nov 2004 17:53:00 -0000 Subject: Re: Struct fields printed in a strange way From: "Ramana Radhakrishnan" To: devnull@kma.eu.org Cc: gdb@sources.redhat.com Reply-To: ramana.radhakrishnan@codito.com User-Agent: SquirrelMail/1.4.3a MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-SW-Source: 2004-11/txt/msg00243.txt.bz2 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