public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/33044] New: Local variables in C++ constructor not visible for debugging
@ 2007-08-10 15:11 seppo at totalviewtech dot com
2007-08-10 21:08 ` [Bug debug/33044] " pinskia at gcc dot gnu dot org
` (14 more replies)
0 siblings, 15 replies; 17+ messages in thread
From: seppo at totalviewtech dot com @ 2007-08-10 15:11 UTC (permalink / raw)
To: gcc-bugs
SUMMARY:
In gcc 3.2.3 (and other versions) the DWARF information created by gcc does not
create DW_AT_location attribute for local (static) variables inside a C++
constructor.
WHAT::
The reproducer below shows TWO problems related to debug information available
regarding variables inside a C++ a constructor. One type is (1) a local
variable inside a constructor and second type is (2) a local _static_ variable
inside a constructor. Sometimes TV is able to see the case (1) but only in the
Program Browser (PB); but case (2) is never correctly shown in TV, neither when
Diving, Stack Frame or in PB.
For some versions of gcc TV can show type (1) in the PB, but for all gcc
versions TV fails to show type (2) at all.
This problem is not related to TV alone, GDB fails to see these variables as
well.
On gcc 3.2.3, TV can see type (1) only in PB, but type (2) is
not visible to TV at all (only in symtable).
With PGI-7.0.5 (and some other non-gcc compilers) TV can see everything
alright.
REPRODUCE/TEST::
See attached c++ file.
dbreak 25
drun
dprint iii
dprint foofoo
WHY::
In some gcc versions there is no DWARF information whatsoever related to types
(1) and (2).
In gcc 3.2.3 (and others, e.g. 4.0.3) the DWARF information created by gcc does
not create DW_AT_location attribute for neither type (1) and (2), e.g.
less tx_local.gcc3.2.3.txt
<2><1760>: Abbrev Number: 41 (DW_TAG_variable)
DW_AT_name : foofoo
DW_AT_decl_file : 1
DW_AT_decl_line : 28
DW_AT_type : <178a>
less tx_local.pgi7.0.5.txt
<1><1048>: Abbrev Number: 14 (DW_TAG_variable)
DW_AT_name : foofoo
DW_AT_type : <1864>
DW_AT_location : 5 byte block: 3 30 e0 4 8 (DW_OP_addr: 804e030; )
Therefore TV (or gdb) does not have enough information to resolve these
variables.
These variables do exist in the symtable, e.g.:
d1.<> sgrep foofoo
{kind loader_symbol} {id 1|795} {full_pathname
##/nfs/netapp0/user/home/seppo/tx_local.out_gcc3.2.3#tx_local_var_cpp_constructor.cxx/_ZZN1AC1Eii\
E6foofoo} {artificial 0} {scope_owner 1|220} {loader_name _ZZN1AC1EiiE6foofoo}
\
{loader_file_path tx_local_var_cpp_constructor.cxx} {location {{ldam
0x900007a0\
}}} {address_class module_static_var} {length 96} {weak 0}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <stdio.h>
class A {
public:
A (int a, int b);
int a_;
int b_;
int c_;
};
A::A (int a, int b) : a_ (a), b_ (b), c_ (0)
{
int iii;
iii = 42;
c_ = a_ * b_;
c_ += iii;
static const int foofoo[6][4] = { {0,1,2,3},
{1,2,3,4},
{2,3,4,5},
{3,4,5,6},
{4,5,6,7},
{5,6,7,8} };
printf("c_ = %d\n", c_);
printf("foofoo = %d\n", foofoo);
}
int main (int, char* *)
{
int a = 34, b = 56;
A x (a, b);
return x.a_ + x.b_;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
--
Summary: Local variables in C++ constructor not visible for
debugging
Product: gcc
Version: 3.2.3
Status: UNCONFIRMED
Severity: critical
Priority: P3
Component: debug
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: seppo at totalviewtech dot com
GCC build triplet: linux-x86 (2.6.16.13-4-smp)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33044
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug debug/33044] Local variables in C++ constructor not visible for debugging
2007-08-10 15:11 [Bug debug/33044] New: Local variables in C++ constructor not visible for debugging seppo at totalviewtech dot com
@ 2007-08-10 21:08 ` pinskia at gcc dot gnu dot org
2007-08-10 21:13 ` pinskia at gcc dot gnu dot org
` (13 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-08-10 21:08 UTC (permalink / raw)
To: gcc-bugs
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|critical |normal
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33044
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug debug/33044] Local variables in C++ constructor not visible for debugging
2007-08-10 15:11 [Bug debug/33044] New: Local variables in C++ constructor not visible for debugging seppo at totalviewtech dot com
2007-08-10 21:08 ` [Bug debug/33044] " pinskia at gcc dot gnu dot org
@ 2007-08-10 21:13 ` pinskia at gcc dot gnu dot org
2007-08-10 21:15 ` pinskia at gcc dot gnu dot org
` (12 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-08-10 21:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2007-08-10 21:13 -------
The mainline produces:
.ascii "foofoo\0" # DW_AT_name
.byte 0x1 # DW_AT_decl_file (t.cc)
.byte 0x10 # DW_AT_decl_line
.long 0x282 # DW_AT_type
.byte 0x5 # DW_AT_location
.byte 0x3 # DW_OP_addr
.long __ZZN1AC1EiiE6foofoo
Which is correct.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33044
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug debug/33044] Local variables in C++ constructor not visible for debugging
2007-08-10 15:11 [Bug debug/33044] New: Local variables in C++ constructor not visible for debugging seppo at totalviewtech dot com
2007-08-10 21:08 ` [Bug debug/33044] " pinskia at gcc dot gnu dot org
2007-08-10 21:13 ` pinskia at gcc dot gnu dot org
@ 2007-08-10 21:15 ` pinskia at gcc dot gnu dot org
2007-08-14 20:33 ` seppo at totalviewtech dot com
` (11 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-08-10 21:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2007-08-10 21:15 -------
4.1.0 produces:
.uleb128 0xd # (DIE (0x185) DW_TAG_variable)
.ascii "foofoo\0" # DW_AT_name
.byte 0x1 # DW_AT_decl_file
.byte 0x10 # DW_AT_decl_line
.long 0x285 # DW_AT_type
.byte 0x5 # DW_AT_location
.byte 0x3 # DW_OP_addr
.long _ZZN1AC1EiiE6foofoo
So this was fixed in 4.1.0 and above as 4.0.0 does not produce the location.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33044
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug debug/33044] Local variables in C++ constructor not visible for debugging
2007-08-10 15:11 [Bug debug/33044] New: Local variables in C++ constructor not visible for debugging seppo at totalviewtech dot com
` (2 preceding siblings ...)
2007-08-10 21:15 ` pinskia at gcc dot gnu dot org
@ 2007-08-14 20:33 ` seppo at totalviewtech dot com
2007-08-14 22:40 ` pinskia at gcc dot gnu dot org
` (10 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: seppo at totalviewtech dot com @ 2007-08-14 20:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from seppo at totalviewtech dot com 2007-08-14 20:32 -------
Hi Andrew,
Thanks for the quick response. The static variable foofoo seems to be OK in
DWARF and the DW_AT_location is there. But for some reason I still do not see
the _non-static_ iii variable and its DW_AT_location attribute in DWARF. The
DWARF information is completely missing (at least with the 4.1.2 version).
Interestingly enough with 4.0.3 both iii and foofoo are listed, but both miss
the DW_AT_location attribute. With 4.1.2 the latter is fixed and the former has
been dropped altogether?
Thanks,
Seppo
--
seppo at totalviewtech dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|FIXED |
Version|3.2.3 |4.1.2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33044
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug debug/33044] Local variables in C++ constructor not visible for debugging
2007-08-10 15:11 [Bug debug/33044] New: Local variables in C++ constructor not visible for debugging seppo at totalviewtech dot com
` (3 preceding siblings ...)
2007-08-14 20:33 ` seppo at totalviewtech dot com
@ 2007-08-14 22:40 ` pinskia at gcc dot gnu dot org
2007-08-24 13:15 ` nikolay at totalviewtech dot com
` (9 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-08-14 22:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2007-08-14 22:40 -------
The iii bug is PR 27574.
So one problem was fixed for 4.1.0 and the other problem is already recorded as
a different PR number so I am going to close this as fixed.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33044
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug debug/33044] Local variables in C++ constructor not visible for debugging
2007-08-10 15:11 [Bug debug/33044] New: Local variables in C++ constructor not visible for debugging seppo at totalviewtech dot com
` (4 preceding siblings ...)
2007-08-14 22:40 ` pinskia at gcc dot gnu dot org
@ 2007-08-24 13:15 ` nikolay at totalviewtech dot com
2007-08-24 13:52 ` [Bug debug/33044] Local static variable " seppo at totalviewtech dot com
` (8 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: nikolay at totalviewtech dot com @ 2007-08-24 13:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from nikolay at totalviewtech dot com 2007-08-24 13:15 -------
This is not fixed neither in 4.1.0 nor in any later version. The problem is
that DIE for static foofoo was indeed produced, but produced in wrong place.
<2><260>: Abbrev Number: 7 (DW_TAG_subprogram) --- Constructor declaration
DW_AT_external : 1
DW_AT_name : A
DW_AT_decl_file : 1
DW_AT_decl_line : 16
DW_AT_declaration : 1
<1><27f>: Abbrev Number: 10 (DW_TAG_subprogram) --- Broken declaration
DW_AT_sibling : <2bc>
DW_AT_specification: <260>
DW_AT_decl_line : 22
DW_AT_inline : 0 (not inlined)
.....
<2><2a7>: Abbrev Number: 13 (DW_TAG_variable)- this is where foofoo was emited
DW_AT_name : foofoo
DW_AT_decl_file : 1
DW_AT_decl_line : 28
DW_AT_type : <3a1>
DW_AT_location : 5 byte block: 3 c0 86 4 8 (DW_OP_addr: 80486c0)
<1><2c1>: Abbrev Number: 15 (DW_TAG_subprogram) -- real constructor declaration
DW_AT_sibling : <2fd>
DW_AT_abstract_origin: <27f>
DW_AT_low_pc : 0x8048474
DW_AT_high_pc : 0x80484ed
DW_AT_frame_base : 0 (location list)
<2><2ee>: Abbrev Number: 17 (DW_TAG_lexical_block) -- this is the scope, where
foo and all other variables should be defined.
DW_AT_low_pc : 0x8048495
DW_AT_high_pc : 0x80484eb
<3><2f7>: Abbrev Number: 18 (DW_TAG_variable) --- this is supposed to be
"iii"
DW_AT_location : 2 byte block: 91 74 (DW_OP_fbreg: -12)
---------------------------------------------------------------------
So dwarf producer is clearly confused and emits static foofoo in wrong broken
subprogram declaration. Instead it should emit it inside lexical block <2ee>
--
nikolay at totalviewtech dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |nikolay at totalviewtech dot
| |com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33044
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug debug/33044] Local static variable in C++ constructor not visible for debugging
2007-08-10 15:11 [Bug debug/33044] New: Local variables in C++ constructor not visible for debugging seppo at totalviewtech dot com
` (5 preceding siblings ...)
2007-08-24 13:15 ` nikolay at totalviewtech dot com
@ 2007-08-24 13:52 ` seppo at totalviewtech dot com
2007-08-24 16:14 ` pinskia at gcc dot gnu dot org
` (7 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: seppo at totalviewtech dot com @ 2007-08-24 13:52 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from seppo at totalviewtech dot com 2007-08-24 13:52 -------
Hi Andrew,
Reopened the bug (see comment above). Do also notice that the (due to the
above) static foofoo inside constructor is still not visible to either TV or
gdb.
I have changed the title of the bug to reflect that we are only concerned of
static variable in this bug report (the gzz-bug #27574 covers the non-static
case).
Thanks,
Seppo
--
seppo at totalviewtech dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|FIXED |
Summary|Local variables in C++ |Local static variable in C++
|constructor not visible for |constructor not visible for
|debugging |debugging
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33044
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug debug/33044] Local static variable in C++ constructor not visible for debugging
2007-08-10 15:11 [Bug debug/33044] New: Local variables in C++ constructor not visible for debugging seppo at totalviewtech dot com
` (6 preceding siblings ...)
2007-08-24 13:52 ` [Bug debug/33044] Local static variable " seppo at totalviewtech dot com
@ 2007-08-24 16:14 ` pinskia at gcc dot gnu dot org
2007-08-24 16:45 ` nikolay at totalviewtech dot com
` (6 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-08-24 16:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from pinskia at gcc dot gnu dot org 2007-08-24 16:14 -------
This all comes down to cloning.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33044
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug debug/33044] Local static variable in C++ constructor not visible for debugging
2007-08-10 15:11 [Bug debug/33044] New: Local variables in C++ constructor not visible for debugging seppo at totalviewtech dot com
` (7 preceding siblings ...)
2007-08-24 16:14 ` pinskia at gcc dot gnu dot org
@ 2007-08-24 16:45 ` nikolay at totalviewtech dot com
2007-08-24 16:51 ` Andrew Pinski
2007-08-24 16:51 ` pinskia at gmail dot com
` (5 subsequent siblings)
14 siblings, 1 reply; 17+ messages in thread
From: nikolay at totalviewtech dot com @ 2007-08-24 16:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from nikolay at totalviewtech dot com 2007-08-24 16:45 -------
(In reply to comment #7)
> This all comes down to cloning.
>
What do you mean?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33044
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Bug debug/33044] Local static variable in C++ constructor not visible for debugging
2007-08-24 16:45 ` nikolay at totalviewtech dot com
@ 2007-08-24 16:51 ` Andrew Pinski
0 siblings, 0 replies; 17+ messages in thread
From: Andrew Pinski @ 2007-08-24 16:51 UTC (permalink / raw)
To: gcc-bugzilla; +Cc: gcc-bugs
On 24 Aug 2007 16:45:41 -0000, nikolay at totalviewtech dot com
<gcc-bugzilla@gcc.gnu.org> wrote:
> What do you mean?
The IA64 C++ ABI requires two (or three) versions of constructor. So
GCC "clones" functions to deal with that. And we emit the context of
the local static variable part of the original function, not part of
any of its clones.
-- Pinski
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug debug/33044] Local static variable in C++ constructor not visible for debugging
2007-08-10 15:11 [Bug debug/33044] New: Local variables in C++ constructor not visible for debugging seppo at totalviewtech dot com
` (8 preceding siblings ...)
2007-08-24 16:45 ` nikolay at totalviewtech dot com
@ 2007-08-24 16:51 ` pinskia at gmail dot com
2008-01-13 16:03 ` rguenth at gcc dot gnu dot org
` (4 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: pinskia at gmail dot com @ 2007-08-24 16:51 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from pinskia at gmail dot com 2007-08-24 16:51 -------
Subject: Re: Local static variable in C++ constructor not visible for
debugging
On 24 Aug 2007 16:45:41 -0000, nikolay at totalviewtech dot com
<gcc-bugzilla@gcc.gnu.org> wrote:
> What do you mean?
The IA64 C++ ABI requires two (or three) versions of constructor. So
GCC "clones" functions to deal with that. And we emit the context of
the local static variable part of the original function, not part of
any of its clones.
-- Pinski
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33044
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug debug/33044] Local static variable in C++ constructor not visible for debugging
2007-08-10 15:11 [Bug debug/33044] New: Local variables in C++ constructor not visible for debugging seppo at totalviewtech dot com
` (9 preceding siblings ...)
2007-08-24 16:51 ` pinskia at gmail dot com
@ 2008-01-13 16:03 ` rguenth at gcc dot gnu dot org
2008-08-27 23:27 ` le dot ben dot smith at gmail dot com
` (3 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-01-13 16:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from rguenth at gcc dot gnu dot org 2008-01-13 15:43 -------
Unclear status of this bug. Removing target milestone.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.1.0 |---
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33044
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug debug/33044] Local static variable in C++ constructor not visible for debugging
2007-08-10 15:11 [Bug debug/33044] New: Local variables in C++ constructor not visible for debugging seppo at totalviewtech dot com
` (10 preceding siblings ...)
2008-01-13 16:03 ` rguenth at gcc dot gnu dot org
@ 2008-08-27 23:27 ` le dot ben dot smith at gmail dot com
2008-08-29 9:59 ` dodji at gcc dot gnu dot org
` (2 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: le dot ben dot smith at gmail dot com @ 2008-08-27 23:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from le dot ben dot smith at gmail dot com 2008-08-27 23:26 -------
I just noticed this problem with gcc 4.3.0. I'm not familiar with compiler
internals, so I don't understand all the details of the previous comments. It
sounds like this is a gdb bug then... Is that correct?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33044
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug debug/33044] Local static variable in C++ constructor not visible for debugging
2007-08-10 15:11 [Bug debug/33044] New: Local variables in C++ constructor not visible for debugging seppo at totalviewtech dot com
` (11 preceding siblings ...)
2008-08-27 23:27 ` le dot ben dot smith at gmail dot com
@ 2008-08-29 9:59 ` dodji at gcc dot gnu dot org
2008-08-29 14:42 ` dodji at gcc dot gnu dot org
2008-08-29 16:10 ` jason at gcc dot gnu dot org
14 siblings, 0 replies; 17+ messages in thread
From: dodji at gcc dot gnu dot org @ 2008-08-29 9:59 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from dodji at gcc dot gnu dot org 2008-08-29 09:58 -------
This is an update of what we get with gcc-4_3-branch.
For the program (line numbers added for better legibility):
1 #include <stdio.h>
2 class A {
3 public:
4 A (int a, int b);
5 int a_;
6 int b_;
7 int c_;
8 };
9
10 A::A (int a, int b) : a_ (a), b_ (b), c_ (0)
11 {
12 int iii;
13 iii = 42;
14 c_ = a_ * b_;
15 c_ += iii;
16 static const int foofoo[6][4] = { {0,1,2,3},
17 {1,2,3,4},
18 {2,3,4,5},
19 {3,4,5,6},
20 {4,5,6,7},
21 {5,6,7,8} };
22
23 printf("c_ = %d\n", c_);
24 printf("foofoo = %d\n", foofoo);
25 }
26
27 int main (int, char* *)
28 {
29 int a = 34, b = 56;
30 A x (a, b);
31 return x.a_ + x.b_;
32 }
33
I get the dwarf info below:
[...]
<1><c5>: Abbrev Number: 11 (DW_TAG_subprogram) <-- //This is the A::A
constructor at line 10.
<c6> DW_AT_specification: <0xa6>
<ca> DW_AT_decl_line : 10
<cb> DW_AT_inline : 0 (not inlined)
<cc> DW_AT_sibling : <0x102>
<2><d0>: Abbrev Number: 12 (DW_TAG_formal_parameter)
<d1> DW_AT_name : (indirect string, offset: 0x47): this
<d5> DW_AT_type : <0x102>
<d9> DW_AT_artificial : 1
<2><da>: Abbrev Number: 13 (DW_TAG_formal_parameter)
<db> DW_AT_name : a
<dd> DW_AT_decl_file : 1
<de> DW_AT_decl_line : 10
<df> DW_AT_type : <0x57>
<2><e3>: Abbrev Number: 13 (DW_TAG_formal_parameter)
<e4> DW_AT_name : b
<e6> DW_AT_decl_file : 1
<e7> DW_AT_decl_line : 10
<e8> DW_AT_type : <0x57>
<2><ec>: Abbrev Number: 14 (DW_TAG_variable) <--- this if the foofoo variable
<ed> DW_AT_name : (indirect string, offset: 0x0): foofoo
<f1> DW_AT_decl_file : 1
<f2> DW_AT_decl_line : 16
<f3> DW_AT_type : <0x214>
<f7> DW_AT_location : 9 byte block: 3 20 8 40 0 0 0 0 0
(DW_OP_addr: 400820)
[...]
So we see here that the foofoo variable is generated with an DW_AT_location,
inside the A::A constructor we are interested in.
However, in GDB, at line 23:
(gdb) bt
#0 A (this=0x7fff6616bd80, a=34, b=56) at test-PR33044.cc:23
#1 0x0000000000400645 in main () at test-PR33044.cc:30
I get:
(gdb) p foofoo
No symbol "foofoo" in current context.
As Andrew pointed, gcc can generate several copies (two, or three) of a given
constructor. Those copies don't necessarily have the same signatures, of
course. So A::A(int, int) might yield to an additional copy of the constructor
being generated.
The debugging for A::A(int, int) info is only generated for the "initial"
constructor. Not for the additional copy.
So my question now is what happens when GDB actually breaks in the additional
copy ? Can it detect that it broke in a constructor that is "only" a copy of
the "real" one ? Or does it expect that all the copies be associated with
debugging info ?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33044
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug debug/33044] Local static variable in C++ constructor not visible for debugging
2007-08-10 15:11 [Bug debug/33044] New: Local variables in C++ constructor not visible for debugging seppo at totalviewtech dot com
` (12 preceding siblings ...)
2008-08-29 9:59 ` dodji at gcc dot gnu dot org
@ 2008-08-29 14:42 ` dodji at gcc dot gnu dot org
2008-08-29 16:10 ` jason at gcc dot gnu dot org
14 siblings, 0 replies; 17+ messages in thread
From: dodji at gcc dot gnu dot org @ 2008-08-29 14:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #13 from dodji at gcc dot gnu dot org 2008-08-29 14:41 -------
Created an attachment (id=16162)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16162&action=view)
The debug info of the program
Okay, here is a more accurate analysis. I will refer to the debug info
attached.
As I said in my previous comment, the foofoo variable is decribed by DIE <ec>,
which is a child DIE of the DW_TAG_subprogram DIE at <c5>. <c5> is the DIE of
the constructor A::A(int, int).
In GDB, When I set a beakpoint in A::A(int, int) the debugger actually stops on
a subprogram which DIE is <107>. This <107> DIE describes an "Out-of-Line
Instance" of of A::A(int, int). So <107> rightfully has an
DW_AT_abstract_origin attribute that links back to the abstract tree of
A::A(int, int) at <c5>.
However, foofoo does not have any DIE that is a child node of <107>. The DIE
<14d> seems to be the DIE describing iii, not foofoo.
That might be the reason why GDB is not finding foofoo.
On the other hand, the DWARF3 specs says (in section 3.3.8.2, point 1).
"An entry in the concrete instance tree may be omitted if it contains only a
DW_AT_abstract_origin attribute and either has no children, or its children are
omitted. Such
entries would provide no useful information.".
This text is at PDF page 65 (or document page 53).
So by the DWARF3 spec, I would believe that the debugger should be able to walk
through the DIE of the abstract tree A::A(int, int) to find the entry <ec> that
describes foofoo.
On the other hand, GCC could maybe play nice and generate a DIE for foofoo as a
child node of the lexical block of <107>. But then maybe that would incur some
dwarf bloat.
Any comment ?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33044
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug debug/33044] Local static variable in C++ constructor not visible for debugging
2007-08-10 15:11 [Bug debug/33044] New: Local variables in C++ constructor not visible for debugging seppo at totalviewtech dot com
` (13 preceding siblings ...)
2008-08-29 14:42 ` dodji at gcc dot gnu dot org
@ 2008-08-29 16:10 ` jason at gcc dot gnu dot org
14 siblings, 0 replies; 17+ messages in thread
From: jason at gcc dot gnu dot org @ 2008-08-29 16:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #14 from jason at gcc dot gnu dot org 2008-08-29 16:09 -------
Dodji is right: since the variable is shared between all concrete instances,
there is no need to repeat anything about it in the concrete instance. The
debugger should find the information it wants in the abstract instance.
This is a bug in GDB.
--
jason at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33044
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2008-08-29 16:10 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-10 15:11 [Bug debug/33044] New: Local variables in C++ constructor not visible for debugging seppo at totalviewtech dot com
2007-08-10 21:08 ` [Bug debug/33044] " pinskia at gcc dot gnu dot org
2007-08-10 21:13 ` pinskia at gcc dot gnu dot org
2007-08-10 21:15 ` pinskia at gcc dot gnu dot org
2007-08-14 20:33 ` seppo at totalviewtech dot com
2007-08-14 22:40 ` pinskia at gcc dot gnu dot org
2007-08-24 13:15 ` nikolay at totalviewtech dot com
2007-08-24 13:52 ` [Bug debug/33044] Local static variable " seppo at totalviewtech dot com
2007-08-24 16:14 ` pinskia at gcc dot gnu dot org
2007-08-24 16:45 ` nikolay at totalviewtech dot com
2007-08-24 16:51 ` Andrew Pinski
2007-08-24 16:51 ` pinskia at gmail dot com
2008-01-13 16:03 ` rguenth at gcc dot gnu dot org
2008-08-27 23:27 ` le dot ben dot smith at gmail dot com
2008-08-29 9:59 ` dodji at gcc dot gnu dot org
2008-08-29 14:42 ` dodji at gcc dot gnu dot org
2008-08-29 16:10 ` jason at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).