aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2009-05-13 23:55:49 +0000
committerBill Wendling <isanbard@gmail.com>2009-05-13 23:55:49 +0000
commitf59d10f1bc7167db39b65ecf6eee95a1ca7562e4 (patch)
tree3fc254e24cb8d5f850ffe9954087940817cc855e
parentdf1ed678904e65192ecdee9bd695f803c550ed68 (diff)
downloadexternal_llvm-f59d10f1bc7167db39b65ecf6eee95a1ca7562e4.zip
external_llvm-f59d10f1bc7167db39b65ecf6eee95a1ca7562e4.tar.gz
external_llvm-f59d10f1bc7167db39b65ecf6eee95a1ca7562e4.tar.bz2
There's yet more ugliness (surprise!) in DebugInfo. This needs major reworking.
Basically, there was a situation where it was getting an empty vector and doing a .back() on that. Which isn't cool. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71746 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfWriter.cpp51
1 files changed, 30 insertions, 21 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfWriter.cpp b/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
index 3553901..bc83b8f 100644
--- a/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
@@ -1286,9 +1286,14 @@ class DwarfDebug : public Dwarf {
/// DbgScopeMap - Tracks the scopes in the current function.
DenseMap<GlobalVariable *, DbgScope *> DbgScopeMap;
- /// DbgInlinedScopeMap - Tracks inlined scopes in the current function.
+ /// DbgAbstractScopeMap - Tracks abstract instance scopes in the current
+ /// function.
+ DenseMap<GlobalVariable *, DbgScope *> DbgAbstractScopeMap;
+
+ /// DbgConcreteScopeMap - Tracks concrete instance scopes in the current
+ /// function.
DenseMap<GlobalVariable *,
- SmallVector<DbgScope *, 8> > DbgInlinedScopeMap;
+ SmallVector<DbgScope *, 8> > DbgConcreteScopeMap;
/// InlineInfo - Keep track of inlined functions and their location. This
/// information is used to populate debug_inlined section.
@@ -3434,7 +3439,8 @@ public:
if (FunctionDbgScope) {
delete FunctionDbgScope;
DbgScopeMap.clear();
- DbgInlinedScopeMap.clear();
+ DbgAbstractScopeMap.clear();
+ DbgConcreteScopeMap.clear();
InlinedVariableScopes.clear();
FunctionDbgScope = NULL;
LexicalScopeStack.clear();
@@ -3578,7 +3584,7 @@ public:
}
}
- assert(Scope && "Unable to find variable' scope");
+ assert(Scope && "Unable to find the variable's scope");
DbgVariable *DV = new DbgVariable(DIVariable(GV), FrameIndex);
Scope->AddVariable(DV);
@@ -3619,14 +3625,8 @@ public:
// could be more elegant.
AddUInt(SPDie, DW_AT_inline, 0, DW_INL_declared_not_inlined);
- // Keep track of the scope that's inlined into this function.
- DenseMap<GlobalVariable *, SmallVector<DbgScope *, 8> >::iterator
- SI = DbgInlinedScopeMap.find(GV);
-
- if (SI == DbgInlinedScopeMap.end())
- DbgInlinedScopeMap[GV].push_back(Scope);
- else
- SI->second.push_back(Scope);
+ // Keep track of the abstract scope for this function.
+ DbgAbstractScopeMap[GV] = Scope;
AbstractInstanceRootMap[GV] = Scope;
AbstractInstanceRootList.push_back(Scope);
@@ -3650,6 +3650,15 @@ public:
LexicalScopeStack.back()->AddConcreteInst(ConcreteScope);
+ // Keep track of the concrete scope that's inlined into this function.
+ DenseMap<GlobalVariable *, SmallVector<DbgScope *, 8> >::iterator
+ SI = DbgConcreteScopeMap.find(GV);
+
+ if (SI == DbgConcreteScopeMap.end())
+ DbgConcreteScopeMap[GV].push_back(ConcreteScope);
+ else
+ SI->second.push_back(ConcreteScope);
+
// Track the start label for this inlined function.
DenseMap<GlobalVariable *, SmallVector<unsigned, 4> >::iterator
I = InlineInfo.find(GV);
@@ -3675,9 +3684,9 @@ public:
GlobalVariable *GV = SP.getGV();
DenseMap<GlobalVariable *, SmallVector<DbgScope *, 8> >::iterator
- I = DbgInlinedScopeMap.find(GV);
+ I = DbgConcreteScopeMap.find(GV);
- if (I == DbgInlinedScopeMap.end()) {
+ if (I == DbgConcreteScopeMap.end()) {
if (TimePassesIsEnabled)
DebugTimer->stopTimer();
@@ -3698,9 +3707,9 @@ public:
}
/// RecordVariableScope - Record scope for the variable declared by
- /// DeclareMI. DeclareMI must describe TargetInstrInfo::DECLARE.
- /// Record scopes for only inlined subroutine variables. Other
- /// variables' scopes are determined during RecordVariable().
+ /// DeclareMI. DeclareMI must describe TargetInstrInfo::DECLARE. Record scopes
+ /// for only inlined subroutine variables. Other variables's scopes are
+ /// determined during RecordVariable().
void RecordVariableScope(DIVariable &DV, const MachineInstr *DeclareMI) {
if (TimePassesIsEnabled)
DebugTimer->startTimer();
@@ -3714,10 +3723,10 @@ public:
return;
}
- DenseMap<GlobalVariable *, SmallVector<DbgScope *, 8> >::iterator
- I = DbgInlinedScopeMap.find(SP.getGV());
- if (I != DbgInlinedScopeMap.end())
- InlinedVariableScopes[DeclareMI] = I->second.back();
+ DenseMap<GlobalVariable *, DbgScope *>::iterator
+ I = DbgAbstractScopeMap.find(SP.getGV());
+ if (I != DbgAbstractScopeMap.end())
+ InlinedVariableScopes[DeclareMI] = I->second;
if (TimePassesIsEnabled)
DebugTimer->stopTimer();