Anders Waldenborg
2012-Mar-04 20:58 UTC
[LLVMdev] Debug info compileunit metadata strangeness..
Hi, I have a question regarding the metadata for compileunit debug info. I find a few things in it a bit strange, but maybe there it is a reason for it to be that way that I just don't understand (but if that is the case I guess the documentation needs to be clearer). Consider this C program: "int X;" Compiled with "clang -g" it debug metadata along these lines: !llvm.dbg.cu = !{!0} !0 = metadata !{i32 786449, ..... metadata !1, ;; List of enums types metadata !1, ;; List of retained types metadata !1, ;; List of subprograms metadata !3 ;; List of global variables } ; [ DW_TAG_compile_unit ] !1 = metadata !{metadata !2} !2 = metadata !{i32 0} !3 = metadata !{metadata !4} !4 = metadata !{metadata !5} !5 = metadata !{i32 786484, ...} ; [ DW_TAG_variable ] Documentation says "List of global variables", but it is built as a "One element list containing the list of global variables". Is there a reason it is built that way? Looking at DIBuilder::createCompileUnit it does indeed build it with an extra indirection. Another thing I find strange is the empty lists, such as "List of enums types" in my example above. They apparently end up being one-element lists containing "i32 0". I would expect that the reference to the empty lists would be "null". In other words, I'd expect it to look like this: !llvm.dbg.cu = !{!0} !0 = metadata !{i32 786449, ... null, ;; List of enums types null, ;; List of retained types null, ;; List of subprograms metadata !1 ;; List of global variables } ; [ DW_TAG_compile_unit ] !1 = metadata !{metadata !2} !2 = metadata !{i32 786484, ...} ; [ DW_TAG_variable ] I attached two patches that changes compileunit metadata to have the layout I think makes sense. I do not expect these patches to be applied (especially the second one is just a gross hack), I'm attaching them because maybe they may help show what I'm trying to say (a patch says more than 1000 words?). anders -------------- next part --------------
Eric Christopher
2012-Mar-26 01:36 UTC
[LLVMdev] Debug info compileunit metadata strangeness..
On Mar 4, 2012, at 12:58 PM, Anders Waldenborg wrote:> Documentation says "List of global variables", but it is built as a > "One element list containing the list of global variables". Is there a > reason it is built that way? > > Looking at DIBuilder::createCompileUnit it does indeed build it with > an extra indirection.You're right. This is weird. I haven't seen a reason why it's that way. -eric -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120325/d2cc42d0/attachment.html>
Maybe Matching Threads
- [LLVMdev] Newbie question(?): How to correctly create debug info, when generating IR
- [LLVMdev] Accessing metadata & creating DIVariable
- [LLVMdev] Accessing metadata & creating DIVariable
- [LLVMdev] Dwarf debug info misses while clang codegen
- [LLVMdev] Accessing metadata & creating DIVariable