[LLVMbugs] [Bug 18462] New: DWARF for static local attached to wrong DIE

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jan 13 14:14:17 PST 2014


            Bug ID: 18462
           Summary: DWARF for static local attached to wrong DIE
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: paul_robinson at playstation.sony.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

A static local variable usually has its DWARF entry emitted as a child
of the defining DIE for its subprogram.
But if the subprogram is inside a namespace, the variable’s DIE gets
emitted as a child of a non-defining declaration DIE for the subprogram.
This makes it inaccessible to gdb.

Run the following program under gdb.  When you step into Test::NSFunc(),
“info locals” reports no locals and “p foo” says there’s no such variable.
Step into GlobalFunc() and you can see “bar” just fine.

namespace Test {
  void NSFunc() {
    static int foo = 1;

void GlobalFunc() {
  static int bar = 1;

int main(void) {
  return 0;

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140113/0d7b5c95/attachment.html>

More information about the llvm-bugs mailing list