Hi all, In LLVM documentation about source level debugging (http://www.llvm.org/releases/2.9/docs/SourceLevelDebugging.html) Subprogram descriptor is defined as: !2 = metadata !{ i32, ;; Tag = 46 + LLVMDebugVersion <http://www.llvm.org/releases/2.9/docs/SourceLevelDebugging.html#LLVMDebugVersion> ;; (DW_TAG_subprogram) i32, ;; Unused field. metadata, ;; Reference to context descriptor metadata, ;; Name metadata, ;; Display name (fully qualified C++ name) metadata, ;; MIPS linkage name (for C++) metadata, ;; Reference to file where defined i32, ;; Line number where defined metadata, ;; Reference to type descriptor i1, ;; True if the global is local to compile unit (static) i1 ;; True if the global is defined in the compile unit (not extern) i32 ;; Virtuality, e.g. dwarf::DW_VIRTUALITY__virtual i32 ;; Index into a virtual function metadata, ;; indicates which base type contains the vtable pointer for the ;; derived class i1 ;; isArtificial i1 ;; isOptimized Function *;; Pointer to LLVM function } When I use clang 2.9 and emit-llvm code metadata generated for a routine foo is: !0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"", metadata !1, i32 1, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 0, i1 false, void ()* @foo} ; [ DW_TAG_subprogram ] !1 = metadata !{i32 589865, metadata !"foodbg.c", metadata !"/home/deldon/tmp", metadata !2} ; [ DW_TAG_file_type ] !2 = metadata !{i32 589841, i32 0, i32 12, metadata !"foodbg.c", metadata !"/home/deldon/tmp", metadata !"clang version 2.9 (tags/RELEASE_29/final)", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ] !3 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !4, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] !4 = metadata !{null} ... As you can see metadata definition !0 doesn't match documentation. What is the correct definition (CLANG or LLVM documentation ?). Thanks for your answer Seb -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111215/96260573/attachment.html>
On Dec 15, 2011, at 2:32 AM, Seb wrote:> Hi all, > > In LLVM documentation about source level debugging (http://www.llvm.org/releases/2.9/docs/SourceLevelDebugging.html) > > > Subprogram descriptor is defined as: > > !2 = metadata !{ > i32, ;; Tag = 46 + LLVMDebugVersion > ;; (DW_TAG_subprogram) > > i32, ;; Unused field. > metadata, ;; Reference to context descriptor > metadata, ;; Name > metadata, ;; Display name (fully qualified C++ name) > metadata, ;; MIPS linkage name (for C++) > metadata, ;; Reference to file where defined > > i32, ;; Line number where defined > metadata, ;; Reference to type descriptor > i1, ;; True if the global is local to compile unit (static) > i1 ;; True if the global is defined in the compile unit (not extern) > > i32 ;; Virtuality, e.g. dwarf::DW_VIRTUALITY__virtual > i32 ;; Index into a virtual function > metadata, ;; indicates which base type contains the vtable pointer for the > ;; derived classIf you're wondering about this field then it is unused in 'c' style functions so it does not matter. I fixed it in r146665. Thanks! - Devang> i1 ;; isArtificial > i1 ;; isOptimized > Function *;; Pointer to LLVM function > > } > > When I use clang 2.9 and emit-llvm code metadata generated for a routine foo is: > > !0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"", metadata !1, i32 1, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 0, i1 false, void ()* @foo} ; [ DW_TAG_subprogram ] > > !1 = metadata !{i32 589865, metadata !"foodbg.c", metadata !"/home/deldon/tmp", metadata !2} ; [ DW_TAG_file_type ] > !2 = metadata !{i32 589841, i32 0, i32 12, metadata !"foodbg.c", metadata !"/home/deldon/tmp", metadata !"clang version 2.9 (tags/RELEASE_29/final)", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ] > > !3 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !4, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] > !4 = metadata !{null} > ... > > As you can see metadata definition !0 doesn't match documentation. What is the correct definition (CLANG or LLVM documentation ?). > > Thanks for your answer > Seb > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111215/57a27485/attachment.html>
Hi Devang, Not only "vtable ptr" is a problem, for this field it seems that CLANG emits a NULL metadata node which is translated into 'i32 0'. The other problem is for 'isArtificial' field with is described as being of type i1 and CLANG emits i32. Looking at sources, it seems that it should be a i32 flag field. Hope this helps, Best Regards Seb 2011/12/15 Devang Patel <dpatel at apple.com>> > On Dec 15, 2011, at 2:32 AM, Seb wrote: > > Hi all, > > In LLVM documentation about source level debugging (http://www.llvm.org/releases/2.9/docs/SourceLevelDebugging.html) > > > Subprogram descriptor is defined as: > > !2 = metadata !{ > i32, ;; Tag = 46 + LLVMDebugVersion <http://www.llvm.org/releases/2.9/docs/SourceLevelDebugging.html#LLVMDebugVersion> > ;; (DW_TAG_subprogram) > > i32, ;; Unused field. > metadata, ;; Reference to context descriptor > metadata, ;; Name > metadata, ;; Display name (fully qualified C++ name) > metadata, ;; MIPS linkage name (for C++) > metadata, ;; Reference to file where defined > > i32, ;; Line number where defined > metadata, ;; Reference to type descriptor > i1, ;; True if the global is local to compile unit (static) > i1 ;; True if the global is defined in the compile unit (not extern) > > i32 ;; Virtuality, e.g. dwarf::DW_VIRTUALITY__virtual > i32 ;; Index into a virtual function > metadata, ;; indicates which base type contains the vtable pointer for the > ;; derived class > > > If you're wondering about this field then it is unused in 'c' style > functions so it does not matter. I fixed it in r146665. > Thanks! > - > Devang > > i1 ;; isArtificial > i1 ;; isOptimized > Function *;; Pointer to LLVM function > > } > > When I use clang 2.9 and emit-llvm code metadata generated for a routine foo is: > > !0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foo", metadata !"foo", metadata !"", metadata !1, i32 1, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 0, i1 false, void ()* @foo} ; [ DW_TAG_subprogram ] > > !1 = metadata !{i32 589865, metadata !"foodbg.c", metadata !"/home/deldon/tmp", metadata !2} ; [ DW_TAG_file_type ] > !2 = metadata !{i32 589841, i32 0, i32 12, metadata !"foodbg.c", metadata !"/home/deldon/tmp", metadata !"clang version 2.9 (tags/RELEASE_29/final)", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ] > > !3 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !4, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] > !4 = metadata !{null} > ... > > As you can see metadata definition !0 doesn't match documentation. What is the correct definition (CLANG or LLVM documentation ?). > > Thanks for your answer > Seb > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111216/f744b7f2/attachment.html>