Make debugging information usable. This is barebones, but it makes -g
actually work (instead of crashing llc), and there's enough info emitted
to get line number information in gdb. This should hopefully be helpful
for debugging non-working programs.
I got rid of the begin/endregion calls because the implementation wasn't
working; someone who knows the debugging info a bit better might try to
add it. I really have no clue how a compiler is supposed to emit them.
This commit shouldn't have any effect without -g.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51404 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGDebugInfo.h b/lib/CodeGen/CGDebugInfo.h
index 2097a1d..ca93302 100644
--- a/lib/CodeGen/CGDebugInfo.h
+++ b/lib/CodeGen/CGDebugInfo.h
@@ -45,12 +45,23 @@
/// CompileUnitCache - Cache of previously constructed CompileUnits.
std::map<unsigned, llvm::CompileUnitDesc *> CompileUnitCache;
+ std::vector<llvm::DebugInfoDesc*> DebugAllocationList;
llvm::Function *StopPointFn;
llvm::AnchorDesc *CompileUnitAnchor;
+ llvm::AnchorDesc *SubProgramAnchor;
llvm::Function *RegionStartFn;
llvm::Function *RegionEndFn;
- std::vector<llvm::DebugInfoDesc *> RegionStack;
+ llvm::Function *FuncStartFn;
+ llvm::Value *CurFuncDesc;
+
+ /// getOrCreateCompileUnit - Get the compile unit from the cache or create a
+ /// new one if necessary.
+ llvm::CompileUnitDesc *getOrCreateCompileUnit(SourceLocation loc);
+
+ /// getCastValueFor - Return a llvm representation for a given debug
+ /// information descriptor cast to an empty struct pointer.
+ llvm::Value *getCastValueFor(llvm::DebugInfoDesc *DD);
public:
CGDebugInfo(CodeGenModule *m);
@@ -62,21 +73,13 @@
/// source line.
void EmitStopPoint(llvm::Function *Fn, llvm::IRBuilder &Builder);
- /// EmitRegionStart - Emit a call to llvm.dbg.region.start to indicate start
+ /// EmitFunctionStart - Emit a call to llvm.dbg.func.start to indicate start
/// of a new block.
- void EmitRegionStart(llvm::Function *Fn, llvm::IRBuilder &Builder);
+ void EmitFunctionStart(llvm::Function *Fn, llvm::IRBuilder &Builder);
- /// EmitRegionEnd - Emit call to llvm.dbg.region.end to indicate end of a
+ /// EmitFunctionEnd - Emit call to llvm.dbg.region.end to indicate end of a
/// block.
- void EmitRegionEnd(llvm::Function *Fn, llvm::IRBuilder &Builder);
-
- /// getOrCreateCompileUnit - Get the compile unit from the cache or create a
- /// new one if necessary.
- llvm::CompileUnitDesc *getOrCreateCompileUnit(SourceLocation loc);
-
- /// getCastValueFor - Return a llvm representation for a given debug
- /// information descriptor cast to an empty struct pointer.
- llvm::Value *getCastValueFor(llvm::DebugInfoDesc *DD);
+ void EmitFunctionEnd(llvm::Function *Fn, llvm::IRBuilder &Builder);
};
} // namespace CodeGen
} // namespace clang