https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78909
Bug ID: 78909 Summary: local variables unavailable in constructor under Oracle dbx Product: gcc Version: 6.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug Assignee: unassigned at gcc dot gnu.org Reporter: ivan.soleimanipour at oracle dot com Target Milestone: --- Consider this code: --------------------------------------------- #include <stdio.h> class Widget { public: Widget(int i) { int x = i; while (!x); } void method(int j) { int y = j; while (!y); } int id; }; class AnotherClass { }; class MyClass : public AnotherClass { public: static void callback(Widget *b, MyClass *ptr) { ptr->callback(b); } void callback(Widget *b) { printf("callback\n"); } }; int main() { Widget *b = new Widget(4); b->method(5); MyClass mc; MyClass::callback(b, &mc); } ---------------------------------------------- Using Oracle Solaris/Developer Studio dbx if you stop in Widget() you cannot see 'x' but if you stop in method() you can see 'y'. There are two contributing causes: 1) See bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55541 While it has been fixed in the 5.x series it seems that constructors still suffer from it. I.e. if you look at the dwarfdump for the above program Widget() still has a TAG_lexical_block enclosing 'x'. 2) ... and that TAG_lexical_block is missing the attributes AT_low_pc and AT_high_pc. Nor is there an AT_ranges. Because no extent can be established for the lexical block dbx won't create a Scope in it's symbol table and there's nowhere to hang 'x' off of so it gets ignored.