[llvm-branch-commits] [llvm-branch] r93495 - in /llvm/branches/Apple/Zoidberg: lib/CodeGen/AsmPrinter/DwarfDebug.cpp test/FrontendC/2010-01-14-StaticVariable.c

Devang Patel dpatel at apple.com
Thu Jan 14 17:15:18 PST 2010


Author: dpatel
Date: Thu Jan 14 19:15:18 2010
New Revision: 93495

URL: http://llvm.org/viewvc/llvm-project?rev=93495&view=rev
Log:
Merge r93494 from mainline.

Added:
    llvm/branches/Apple/Zoidberg/test/FrontendC/2010-01-14-StaticVariable.c
Modified:
    llvm/branches/Apple/Zoidberg/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Modified: llvm/branches/Apple/Zoidberg/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Zoidberg/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=93495&r1=93494&r2=93495&view=diff

==============================================================================
--- llvm/branches/Apple/Zoidberg/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/branches/Apple/Zoidberg/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Thu Jan 14 19:15:18 2010
@@ -1666,8 +1666,11 @@
   ModuleCU->insertDIE(N, VariableDie);
 
   // Add to context owner.
-  if (DI_GV.isDefinition() 
-      && !DI_GV.getContext().isCompileUnit()) {
+  DIDescriptor GVContext = DI_GV.getContext();
+  // Do not create specification DIE if context is either compile unit
+  // or a subprogram.
+  if (DI_GV.isDefinition() && !GVContext.isCompileUnit()
+      && !GVContext.isSubprogram()) {
     // Create specification DIE.
     DIE *VariableSpecDIE = new DIE(dwarf::DW_TAG_variable);
     addDIEEntry(VariableSpecDIE, dwarf::DW_AT_specification,
@@ -1685,7 +1688,7 @@
                    Asm->Mang->getMangledName(DI_GV.getGlobal()));
     addBlock(VariableDie, dwarf::DW_AT_location, 0, Block);
   }
-  addToContextOwner(VariableDie, DI_GV.getContext());
+  addToContextOwner(VariableDie, GVContext);
   
   // Expose as global. FIXME - need to check external flag.
   ModuleCU->addGlobal(DI_GV.getName(), VariableDie);

Added: llvm/branches/Apple/Zoidberg/test/FrontendC/2010-01-14-StaticVariable.c
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Zoidberg/test/FrontendC/2010-01-14-StaticVariable.c?rev=93495&view=auto

==============================================================================
--- llvm/branches/Apple/Zoidberg/test/FrontendC/2010-01-14-StaticVariable.c (added)
+++ llvm/branches/Apple/Zoidberg/test/FrontendC/2010-01-14-StaticVariable.c Thu Jan 14 19:15:18 2010
@@ -0,0 +1,12 @@
+// This is a regression test on debug info to make sure that llvm emitted
+// debug info does not crash gdb.
+// RUN: %llvmgcc -S -O0 -g %s -o - | \
+// RUN:    llc --disable-fp-elim -o %t.s -O0 -relocation-model=pic
+// RUN: %compile_c %t.s -o %t.o
+// RUN: echo {quit\n} > %t.in 
+// RUN: gdb -q -batch -n -x %t.in %t.o > /dev/null
+
+int foo() {
+	static int i = 42;
+        return i;
+}





More information about the llvm-branch-commits mailing list