1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

Do not use AT_specification die for static variables. It confuses gdb.

llvm-svn: 93494
This commit is contained in:
Devang Patel 2010-01-15 01:12:22 +00:00
parent 0a22bdac8d
commit 9c7b75ebb8
2 changed files with 18 additions and 3 deletions

View File

@ -1653,8 +1653,11 @@ void DwarfDebug::constructGlobalVariableDIE(MDNode *N) {
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,
@ -1672,7 +1675,7 @@ void DwarfDebug::constructGlobalVariableDIE(MDNode *N) {
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);

View File

@ -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;
}