Marco Alesiani
2014-Apr-28 21:42 UTC
[LLVMdev] Feeding DWARF debug information for an LLVM module
I'm trying to insert some DWARF debugging information into a LLVM IR module by manually parsing the DWARF debug DIEs. I'm doing it that way since I wrote my custom front-end for my language and the DWARF debugging information are provided me as a byte stream for the various DWARF sections. I took a look at the documentation and DwarfDebug class ( http://llvm.org/docs/doxygen/html/classllvm_1_1DwarfDebug.html <http://llvm.org/docs/doxygen/html/classllvm_1_1DwarfDebug.html> ) but it doesn't seem to be a quick way to directly "feed the DWARF sections" to the IR directly generated from my code. Anyway I'd like to know if what I'm doing (i.e. manually parsing the DWARF sections, expression trees and everything else to get the variables / structures I'm interested in) is a useless effort or it is the only way to insert proper debugging information into the IR code I'm describing. -- View this message in context: http://llvm.1065342.n5.nabble.com/Feeding-DWARF-debug-information-for-an-LLVM-module-tp68167.html Sent from the LLVM - Dev mailing list archive at Nabble.com.
Eric Christopher
2014-Apr-28 22:12 UTC
[LLVMdev] Feeding DWARF debug information for an LLVM module
The way to add information to a module is going to be via DIBuilder, however, this doesn't match what you're attempting to do if you have fully fledged sections. You could try to write out type information as you've parsed it etc, but it's going to be a buyer beware sort of thing. The way clang does this is to emit type/variable/line information as it's generating code. I'd need more information about your actual setup to give any more of an answer though. -eric On Mon, Apr 28, 2014 at 2:42 PM, Marco Alesiani <marco.diiga at gmail.com> wrote:> I'm trying to insert some DWARF debugging information into a LLVM IR module > by manually parsing the DWARF debug DIEs. I'm doing it that way since I > wrote my custom front-end for my language and the DWARF debugging > information are provided me as a byte stream for the various DWARF sections. > > I took a look at the documentation and DwarfDebug class ( > http://llvm.org/docs/doxygen/html/classllvm_1_1DwarfDebug.html > <http://llvm.org/docs/doxygen/html/classllvm_1_1DwarfDebug.html> ) but it > doesn't seem to be a quick way to directly "feed the DWARF sections" to the > IR directly generated from my code. > > Anyway I'd like to know if what I'm doing (i.e. manually parsing the DWARF > sections, expression trees and everything else to get the variables / > structures I'm interested in) is a useless effort or it is the only way to > insert proper debugging information into the IR code I'm describing. > > > > -- > View this message in context: http://llvm.1065342.n5.nabble.com/Feeding-DWARF-debug-information-for-an-LLVM-module-tp68167.html > Sent from the LLVM - Dev mailing list archive at Nabble.com. > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Marco Alesiani
2014-Apr-29 15:50 UTC
[LLVMdev] Feeding DWARF debug information for an LLVM module
Thanks Eric. Using DIBuilder to manually insert debugging information is what I had in mind and I believe at the end of the day it will be the only way. Regarding my setup I'm using a parser which reads code generated by a front-end comprehensive of all DWARF (v2 IIRC) infos. Unfortunately I believe the parser I'm using was just designed to set up the IR routines with a basic debugging support since it doesn't provide (as far as I could see) any way to "browse" or "explore" the DWARF data, i.e. it just provides me a number of DWARF sections (debug_abbrev, debug_info, etc..) via byte streams. I searched through its code but I'm almost sure interpreting that data will be up to me. Thus what I had in mind was exactly to write code to parse the debug information and directly feed them via DIBuilder routines to LLVM. Line infos are available throughout all my IR representation but in order to at least enable variable/arrays watches I suppose I'll have to go through DWARF expressions and such. I will probably not need all the data contained in the DWARF sections (I'm not looking for a thoroughly debugging description of my code) but I'll have to do some more tests in order to determine if what I have in mind can somewhat be accomplished. I'm still pretty new to debugging formats. -- View this message in context: http://llvm.1065342.n5.nabble.com/Feeding-DWARF-debug-information-for-an-LLVM-module-tp68167p68186.html Sent from the LLVM - Dev mailing list archive at Nabble.com.
Seemingly Similar Threads
- [Dwarf] Register a local variable in DIBuilder and locate it later with a DwarfContext
- [Dwarf] Register a local variable in DIBuilder and locate it later with a DwarfContext
- [DebugInfo] DIBuilder missing interface to generate DWARF info for packed_decimal basic type.
- [Dwarf] Register a local variable in DIBuilder and locate it later with a DwarfContext
- [Dwarf] Register a local variable in DIBuilder and locate it later with a DwarfContext