From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21239 invoked by alias); 10 Jul 2010 04:09:40 -0000 Received: (qmail 21221 invoked by uid 22791); 10 Jul 2010 04:09:38 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,TW_SM X-Spam-Check-By: sourceware.org Received: from mail-gw0-f41.google.com (HELO mail-gw0-f41.google.com) (74.125.83.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 10 Jul 2010 04:09:33 +0000 Received: by gwb1 with SMTP id 1so2146006gwb.0 for ; Fri, 09 Jul 2010 21:09:31 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.219.135 with SMTP id hu7mr6552294qcb.144.1278734971155; Fri, 09 Jul 2010 21:09:31 -0700 (PDT) Received: by 10.229.42.147 with HTTP; Fri, 9 Jul 2010 21:09:31 -0700 (PDT) In-Reply-To: <4C36BA7D.20007@intrepid.com> References: <4C368A68.9010308@gmail.com> <4C36BA7D.20007@intrepid.com> Date: Sat, 10 Jul 2010 04:09:00 -0000 Message-ID: Subject: Re: Two debug entries for one local variables, is it a bug in GCC or GDB From: Daniel Berlin To: Nenad Vukicevic Cc: asmwarrior , gdb@sourceware.org, gcc@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2010-07/txt/msg00040.txt.bz2 Your bug was not a real bug, AFAICT. At least the debug info you have shown in http://gcc.gnu.org/ml/gcc/2010-01/msg00054.html is not wrong. Certainly, two DIES were unnecessary, but the way it did it was not broken. Note that one of them is marked as DW_AT_declaration, specifying that is where the declaration of that variable occurred. The other is a definition. They happen to be at the same line, so it's pointless to create two DIE's, but it's not broken. In this case, the debug information asmwarrior is showing is clearly broken. I suspect GCC is splitting the variable somehow, because if you notice, templateArgument is given different memory locations in both blocks. On Fri, Jul 9, 2010 at 1:58 AM, Nenad Vukicevic wrote: > =A0I reported something similar back in January: > > http://gcc.gnu.org/ml/gcc/2010-01/msg00054.html > > As I recall, GCC creates duplicates. > > Nenad > > On 7/8/10 7:33 PM, asmwarrior wrote: >> >> =A0I have post this message to both GCC and GDB, because I'm not sure it= is >> a bug in GDB or GCC. >> Hi, I have just find two dwarf debug entries for one local variables. >> >> For example, the sample code is just like: >> >> ----------------------------------------- >> >> wxString ParserThread::ReadAncestorList() >> { >> >> =A0 =A0wxString ccc; >> =A0 =A0wxString templateArgument; >> =A0 =A0wxString aaa; >> =A0 =A0aaa =3D m_Tokenizer.GetToken(); // eat ":" >> =A0 =A0templateArgument =3D aaa; >> =A0 =A0while (!TestDestroy()) >> =A0 =A0{ >> >> =A0 =A0 =A0 =A0//Peek the next token >> =A0 =A0 =A0 =A0wxString next =3D m_Tokenizer.PeekToken(); >> >> =A0 =A0 =A0 =A0if (next.IsEmpty() >> =A0 =A0 =A0 =A0 =A0 =A0|| next=3D=3DParserConsts::opbrace >> =A0 =A0 =A0 =A0 =A0 =A0|| next=3D=3DParserConsts::semicolon ) // here, w= e are at the end >> of ancestor list >> =A0 =A0 =A0 =A0{ >> =A0 =A0 =A0 =A0 =A0 =A0break; >> =A0 =A0 =A0 =A0} >> =A0 =A0 =A0 =A0else if (next=3D=3DParserConsts::lt) =A0 =A0 =A0 // class= AAA : BBB< =A0int, >> float> >> =A0 =A0 =A0 =A0{ >> =A0 =A0 =A0 =A0 =A0 =A0wxString arg =3D SkipAngleBraces(); >> =A0 =A0 =A0 =A0 =A0 =A0if(!arg.IsEmpty()) =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 // find a matching<> >> =A0 =A0 =A0 =A0 =A0 =A0{ >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0templateArgument<> =A0 =A0 =A0 =A0 =A0 =A0} >> =A0 =A0 =A0 =A0 =A0 =A0else >> =A0 =A0 =A0 =A0 =A0 =A0{ >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0TRACE(_T("Not Matching<> =A0find. Error!!= !") ); >> =A0 =A0 =A0 =A0 =A0 =A0} >> =A0 =A0 =A0 =A0} >> ... >> ------------------------------------------- >> >> But I found that GDG can show the wxString aaa correctly, but wxString >> templateArgument incorrectly. >> >> I have just check the debug information in the object file. >> and found that there are two entries for local variable >> "argumentTemplate", but only one entry for "aaa". >> >> -------------------------------------------- >> <2><40a9f>: Abbrev Number: 182 (DW_TAG_variable) >> <40aa1> =A0 =A0DW_AT_name =A0 =A0 =A0 =A0: (indirect string, offset: 0x1= 095): >> templateArgument >> <40aa5> =A0 =A0DW_AT_decl_file =A0 : 19 >> <40aa6> =A0 =A0DW_AT_decl_line =A0 : 2593 >> <40aa8> =A0 =A0DW_AT_type =A0 =A0 =A0 =A0:<0xd168> >> <40aac> =A0 =A0DW_AT_accessibility: 3 =A0 =A0(private) >> <40aad> =A0 =A0DW_AT_location =A0 =A0: 2 byte block: 53 6 =A0 =A0 (DW_OP= _reg3; >> DW_OP_deref) >> <2><40ab0>: Abbrev Number: 164 (DW_TAG_lexical_block) >> <40ab2> =A0 =A0DW_AT_ranges =A0 =A0 =A0: 0x168 >> <3><40ab6>: Abbrev Number: 165 (DW_TAG_variable) >> <40ab8> =A0 =A0DW_AT_name =A0 =A0 =A0 =A0: ccc >> <40abc> =A0 =A0DW_AT_decl_file =A0 : 19 >> <40abd> =A0 =A0DW_AT_decl_line =A0 : 2592 >> <40abf> =A0 =A0DW_AT_type =A0 =A0 =A0 =A0:<0xd168> >> <40ac3> =A0 =A0DW_AT_location =A0 =A0: 2 byte block: 91 50 =A0 =A0 (DW_O= P_fbreg: -48) >> <3><40ac6>: Abbrev Number: 179 (DW_TAG_variable) >> <40ac8> =A0 =A0DW_AT_name =A0 =A0 =A0 =A0: (indirect string, offset: 0x1= 095): >> templateArgument >> <40acc> =A0 =A0DW_AT_decl_file =A0 : 19 >> <40acd> =A0 =A0DW_AT_decl_line =A0 : 2593 >> <40acf> =A0 =A0DW_AT_type =A0 =A0 =A0 =A0:<0xd168> >> <40ad3> =A0 =A0DW_AT_location =A0 =A0: 2 byte block: 91 4c =A0 =A0 (DW_O= P_fbreg: -52) >> <3><40ad6>: Abbrev Number: 165 (DW_TAG_variable) >> <40ad8> =A0 =A0DW_AT_name =A0 =A0 =A0 =A0: aaa >> <40adc> =A0 =A0DW_AT_decl_file =A0 : 19 >> <40add> =A0 =A0DW_AT_decl_line =A0 : 2594 >> <40adf> =A0 =A0DW_AT_type =A0 =A0 =A0 =A0:<0xd168> >> <40ae3> =A0 =A0DW_AT_location =A0 =A0: 2 byte block: 91 48 =A0 =A0 (DW_O= P_fbreg: -56) >> <3><40ae6>: Abbrev Number: 170 (DW_TAG_lexical_block) >> >> >> ------------------------------------------------------------------------= ------ >> Also, you can see the screen shot in my Codeblocks forums' post: >> >> http://forums.codeblocks.org/index.php/topic,12873.msg86906.html#msg86906 >> >> >> So, my question is: >> >> Is this a bug in GCC or GDB? ( I have just test the MinGW GCC 4.5 and >> MinGW 4.4.4, they get the same result) >> >> >> Thanks >> >> Asmwarrior (ollydbg from codeblocks' forum) >> >