<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Apr 29, 2011, at 5:49 PM, Matt Pharr wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>I'm running into a problem with generating debugging information that I'm not sure how to debug; I'd be happy to have some suggestions about where to start digging in.<br><br>In short, I believe that I'm correctly generating debug info (with DIBuilder, which has so far been quite nice!), and a scan of the meta-data in the IR looks generally right.  However, if I run dwarfdump on my object file, I'm not seeing any DIE information for the local variables.  I'm wondering what might be going wrong along the way.<br><br>More specifically, given a program that is equivalent to the following in C:<br><br>float foo() {<br><span class="Apple-tab-span" style="white-space:pre">        </span>float y = 1234;<br><span class="Apple-tab-span" style="white-space:pre">   </span>return y;<br>}<br><br>My compiler generates the following IR (pay no attention to the ___ at the end of "foo"..):<br><br>define i32 @foo___(<4 x i32>) nounwind readnone alwaysinline {<br>entry:<br>  tail call void @llvm.dbg.value(metadata !6, i64 0, metadata !4), !dbg !7<br>  ret i32 1234<br>}<br><font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#144FAE"><br></font></font></div></blockquote><div><br></div>Here there is not any instruction (ignoring dbg intrinsics) with line number information. If you add !dbg !7 at the end of 'ret' then it'll work.</div><div>-</div><div>Devang</div><div><br><blockquote type="cite"><div>declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone<br><br>!llvm.dbg.sp = !{!0}<br>!llvm.dbg.lv.foo___ = !{!4}<br><br>!0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"foo___", metadata !1, i32 4, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 0, i1 true, i32 (<4 x i32>)* @foo___, null, null} ; [ DW_TAG_subprogram ]<br>!1 = metadata !{i32 589865, metadata !"a.c", metadata !"/Users/mmp/foo/", metadata !2} ; [ DW_TAG_file_type ]<br>!2 = metadata !{i32 589841, i32 0, i32 12, metadata !"a.c", metadata !"/Users/mmp/foo", metadata !"foo", i1 true, i1 true, metadata !"-g", i32 0} ; [ DW_TAG_compile_unit ]<br>!3 = metadata !{i32 589860, metadata !2, metadata !"int32", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]<br>!4 = metadata !{i32 590080, metadata !5, metadata !"y", metadata !1, i32 5, metadata !3, i32 0} ; [ DW_TAG_auto_variable ]<br>!5 = metadata !{i32 589835, metadata !0, i32 4, i32 0, metadata !1, i32 0} ; [ DW_TAG_lexical_block ]<br>!6 = metadata !{i32 1234}<br>!7 = metadata !{i32 5, i32 0, metadata !5, null}<br><br>However, if I run dwarfdump on the object file, there's nothing there for the variable 'y' (see below).  Note that I am able to get correct DWARF output for global variables, so presumably the rest of my infrastructure isn't totally broken.<br><br>Any guidance about how best to proceed would be greatly appreciated!<br><br>Thanks,<br>-matt<br><br><br>----------------------------------------------------------------------<br> File: a.o (x86_64)<br>----------------------------------------------------------------------<br>.debug_info contents:<br><br>0x00000000: Compile Unit: length = 0x00000043  version = 0x0002  abbr_offset = 0x00000000  addr_size = 0x08  (next CU at 0x00000047)<br><br>0x0000000b: TAG_compile_unit [1] *<br>             AT_producer( "volta" )<br>             AT_language( DW_LANG_C99 )<br>             AT_name( "a.c" )<br>             AT_entry_pc( 0x0000000000000000 )<br>             AT_stmt_list( 0x00000000 )<br>             AT_comp_dir( "/Users/mmp/foo" )<br>             AT_APPLE_optimized( 0x01 )<br>             AT_APPLE_flags( "-g" )<br><br>0x00000039:     TAG_subprogram [2]  <br>                 AT_name( "foo" )<br>                 AT_MIPS_linkage_name( "foo___" )<br>                 AT_external( 0x01 )<br><br>0x00000046:     NULL<br><br><br><br>_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br></div></blockquote></div><br></body></html>