diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2008-05-22 01:40:10 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2008-05-22 01:40:10 +0000 |
commit | 3f2af1002249c8acc9ce17f1fc50324864feb8e1 (patch) | |
tree | 78a34b5f3203319ca8fd0bbf3f2af64c085ee47e /lib/CodeGen/CGDebugInfo.h | |
parent | 144ac61f9005a0da4327d4e62a4c453923b7bc0c (diff) |
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
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.h')
-rw-r--r-- | lib/CodeGen/CGDebugInfo.h | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/lib/CodeGen/CGDebugInfo.h b/lib/CodeGen/CGDebugInfo.h index 2097a1d2f0..ca933021a6 100644 --- a/lib/CodeGen/CGDebugInfo.h +++ b/lib/CodeGen/CGDebugInfo.h @@ -45,12 +45,23 @@ private: /// 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 @@ public: /// 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 |