diff options
| author | Devang Patel <dpatel@apple.com> | 2009-10-08 18:48:03 +0000 |
|---|---|---|
| committer | Devang Patel <dpatel@apple.com> | 2009-10-08 18:48:03 +0000 |
| commit | 20b2a777650117701d6ad9dac3705066349cbc33 (patch) | |
| tree | 20155b2e5d49ce9af3ddca350e24c6546e78fe41 /llvm/lib/CodeGen | |
| parent | 03b4f666edfcd48e009ec5cfde7837e45652b185 (diff) | |
| download | bcm5719-llvm-20b2a777650117701d6ad9dac3705066349cbc33.tar.gz bcm5719-llvm-20b2a777650117701d6ad9dac3705066349cbc33.zip | |
Do not record line number to implicitly mark start of function if function has arguments. Extra line number entries trip gdb in some cases.
llvm-svn: 83563
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 33 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h | 2 |
2 files changed, 23 insertions, 12 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 5b3f3cee39f..1ea148e5494 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1782,17 +1782,23 @@ void DwarfDebug::EndModule() { } /// CollectVariableInfo - Populate DbgScope entries with variables' info. -void DwarfDebug::CollectVariableInfo() { - if (!MMI) return; +bool DwarfDebug::CollectVariableInfo() { + if (!MMI) return false; + bool ArgsCollected = false; MachineModuleInfo::VariableDbgInfoMapTy &VMap = MMI->getVariableDbgInfo(); for (MachineModuleInfo::VariableDbgInfoMapTy::iterator VI = VMap.begin(), VE = VMap.end(); VI != VE; ++VI) { MDNode *Var = VI->first; + DIVariable DV (Var); + if (DV.isNull()) continue; + if (DV.getTag() == dwarf::DW_TAG_arg_variable) + ArgsCollected = true; DILocation VLoc(VI->second.first); unsigned VSlot = VI->second.second; DbgScope *Scope = getDbgScope(VLoc.getScope().getNode(), NULL); - Scope->AddVariable(new DbgVariable(DIVariable(Var), VSlot, false)); + Scope->AddVariable(new DbgVariable(DV, VSlot, false)); } + return ArgsCollected; } /// SetDbgScopeBeginLabels - Update DbgScope begin labels for the scopes that @@ -1903,7 +1909,7 @@ void DwarfDebug::BeginFunction(MachineFunction *MF) { #ifdef ATTACH_DEBUG_INFO_TO_AN_INSN if (!ExtractScopeInformation(MF)) return; - CollectVariableInfo(); + bool ArgsCollected = CollectVariableInfo(); #endif // Begin accumulating function debug information. @@ -1914,14 +1920,19 @@ void DwarfDebug::BeginFunction(MachineFunction *MF) { // Emit label for the implicitly defined dbg.stoppoint at the start of the // function. - DebugLoc FDL = MF->getDefaultDebugLoc(); - if (!FDL.isUnknown()) { - DebugLocTuple DLT = MF->getDebugLocTuple(FDL); - unsigned LabelID = RecordSourceLine(DLT.Line, DLT.Col, DLT.CompileUnit); - Asm->printLabel(LabelID); - O << '\n'; +#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN + if (!ArgsCollected) { +#else + if (1) { +#endif + DebugLoc FDL = MF->getDefaultDebugLoc(); + if (!FDL.isUnknown()) { + DebugLocTuple DLT = MF->getDebugLocTuple(FDL); + unsigned LabelID = RecordSourceLine(DLT.Line, DLT.Col, DLT.CompileUnit); + Asm->printLabel(LabelID); + O << '\n'; + } } - if (TimePassesIsEnabled) DebugTimer->stopTimer(); } diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h index bd377c5593c..7e2f6be837d 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -556,7 +556,7 @@ public: bool ExtractScopeInformation(MachineFunction *MF); /// CollectVariableInfo - Populate DbgScope entries with variables' info. - void CollectVariableInfo(); + bool CollectVariableInfo(); /// SetDbgScopeBeginLabels - Update DbgScope begin labels for the scopes that /// start with this machine instruction. |

