From: Daniel Jacobowitz <drow@mvista.com> To: peter.thompson@etnus.com Cc: gcc-gnats@gcc.gnu.org Subject: Re: debug/10156: g++ 3.2 fails to emit debug location info for a local variable inside a class constructor Date: Wed, 19 Mar 2003 17:30:38 -0500 On Wed, Mar 19, 2003 at 10:22:11PM -0000, peter.thompson@etnus.com wrote: > > >Number: 10156 > >Category: debug > >Synopsis: g++ 3.2 fails to emit debug location info for a local variable inside a class constructor > >Confidential: no > >Severity: critical > >Priority: medium > >Responsible: unassigned > >State: open > >Class: sw-bug > >Submitter-Id: net > >Arrival-Date: Wed Mar 19 22:26:00 UTC 2003 > >Closed-Date: > >Last-Modified: > >Originator: Peter Thompson - Etnus > >Release: gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7) > >Organization: > >Environment: > i686 platform > gcc 3.2 compilers (also tried 3.2.1, and 3.2.2 versions with same results) > >Description: > We ran into this problem with our debugger, TotalView, but were able to replicate the problem, with a little bit of effort, with gdb. Just FYI, the same problem was reported as a GDB bug c++/1141; I forwarded it to gcc-bugs and got no response, and haven't had time to look at it myself. There's a smaller testcase there. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer
From: Peter Thompson <peter.thompson@etnus.com> To: Daniel Jacobowitz <drow@mvista.com> Cc: gcc-gnats@gcc.gnu.org Subject: Re: debug/10156: g++ 3.2 fails to emit debug location info for a local variable inside a class constructor Date: Wed, 19 Mar 2003 17:42:46 -0500 Thanks Daniel, I looked at 1141, and concur with your analysis, since it agrees with ours ;-) It was submitted only a week ago, so I'm not too surprised it hasn't been hit yet. Regards, PeterT Daniel Jacobowitz wrote: > On Wed, Mar 19, 2003 at 10:22:11PM -0000, peter.thompson@etnus.com wrote: > >>>Number: 10156 >>>Category: debug >>>Synopsis: g++ 3.2 fails to emit debug location info for a local variable inside a class constructor >>>Confidential: no >>>Severity: critical >>>Priority: medium >>>Responsible: unassigned >>>State: open >>>Class: sw-bug >>>Submitter-Id: net >>>Arrival-Date: Wed Mar 19 22:26:00 UTC 2003 >>>Closed-Date: >>>Last-Modified: >>>Originator: Peter Thompson - Etnus >>>Release: gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7) >>>Organization: >>>Environment: >> >>i686 platform >>gcc 3.2 compilers (also tried 3.2.1, and 3.2.2 versions with same results) >> >>>Description: >> >>We ran into this problem with our debugger, TotalView, but were able to replicate the problem, with a little bit of effort, with gdb. > > > Just FYI, the same problem was reported as a GDB bug c++/1141; I > forwarded it to gcc-bugs and got no response, and haven't had time to > look at it myself. There's a smaller testcase there. >
We ran into this problem with our debugger, TotalView, but were able to replicate the problem, with a little bit of effort, with gdb. Inside a class constructor, a local variable that is not a member of the class is used to hold a temporary value. Setting a breakpoint, or stepping into the constructor, and looking for the value of the variable after it as assigned shows "No symbol "i" in current context." Looking at the dwarf output with readelf -wi, it is possible to see that though 'i' is apparently defined <2><186e>: Abbrev Number: 38 (DW_TAG_variable) DW_AT_name : i DW_AT_decl_file : 1 DW_AT_decl_line : 12 DW_AT_type : <cb5> AND refined correctly in one of the copies of the constructors: <2><18a8>: Abbrev Number: 41 (DW_TAG_variable) DW_AT_abstract_origin: <186e> DW_AT_location : 2 byte block: 91 7c (DW_OP_fbreg: -4; ) it is not referenced correctly in the copy of the subroutine which we are able to step into: <2><18dc>: Abbrev Number: 42 (DW_TAG_variable) DW_AT_abstract_origin: <186e> Here the DW_AT_location attribute is missing, resulting in the debuggers being unable to locate it. Release: gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7) Environment: i686 platform gcc 3.2 compilers (also tried 3.2.1, and 3.2.2 versions with same results) How-To-Repeat: Compile with -g Debug the output file with gdb Set a breakpoint at line 30, A x (a, b); Run Step (to get into the constructor, gdb misses any breakpoints set directly in the constructor. Not your problem!) Next a few times to get past i = 42; print i Should get No Symbol "i" in current context. Also look at the dwarf info from the executable with readelf -wi This will show a DW_AT_location for i in one copy of the constructor, but will only show a DW_AT_abstract_origin for the copy of the constructor that gdb steps into.
Hello, do you know whether this problem is still present in gcc 3.3? Thanks, Dara
Subject: Re: g++ 3.2 fails to emit debug location info for a local variable inside a class constructor Just tested with 3.3 and it still looks broken to me. PeterT dhazeghi@yahoo.com wrote: > PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org. > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10156 > > > dhazeghi@yahoo.com changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > Status|UNCONFIRMED |WAITING > > > ------- Additional Comments From dhazeghi@yahoo.com 2003-05-31 08:30 ------- > Hello, > > do you know whether this problem is still present in gcc 3.3? Thanks, > > Dara > > > > ------- You are receiving this mail because: ------- > You reported the bug, or are watching the reporter. > You are on the CC list for the bug, or are watching someone who is.
According to the submitter it still is busted with 3.3
I've confirmed this with both 3.3 and a 3.4 20030528 snapshot.
Most likely the same bug as bug 11098 which is for destructors. Also in 2.95.3, I can print out the variable i (compiled with -gdwarf-2) so this is a regression.
*** This bug has been marked as a duplicate of 11098 ***