[llvm] r188297 - Output DW_AT_stmt_list dwarf debug info as DW_FORM_sec_offset instead of DW_FORM_data4 as it is a section offset (fixes the coff/dwarf debug info statement locations)

Kristof Beyls kristof.beyls at arm.com
Tue Sep 3 00:30:21 PDT 2013


Hi Eric, Carlo,

This change seems to be breaking the ability to parse the debug
info produced by LLVM in a number of tools that only supports
parsing up to DWARF3.

My limited understanding is that this is caused because the debug
info produced states it is DWARF3, but it now contains a DWARF4-only
attribute form (DW_FORM_sec_offset), which seems to make it
impossible to parse the debug info using DWARF parsers implemented
at a time that DWARF4 wasn't defined yet.

If my understanding above is correct, it seems to me that this
patch either needs to be reverted, or the production of
DW_FORM_sec_offset needs to be conditionalized on producing DWARF4
debug info (in which case the compilation unit header should state
that it is DWARF4, not DWARF3).

I'm afraid I don't know enough about DWARF to know what the right
action is, but to me it seems that breaking the ability of existing
debug info consumers to parse the debug info produced by LLVM shouldn't
be done.

Do you happen to have a proposal on what the best way is to either make
sure DWARF3 debug info consumers can keep on parsing the LLVM debug info,
or to properly encode in the debug info header that DWARF4 is produced,
not DWARF3?

Thanks,

Kristof

> -----Original Message-----
> From: llvm-commits-bounces at cs.uiuc.edu [mailto:llvm-commits-
> bounces at cs.uiuc.edu] On Behalf Of Eric Christopher
> Sent: 13 August 2013 19:00
> To: Carlo Kok
> Cc: llvm-commits at cs.uiuc.edu
> Subject: Re: [llvm] r188297 - Output DW_AT_stmt_list dwarf debug info
> as DW_FORM_sec_offset instead of DW_FORM_data4 as it is a section
> offset (fixes the coff/dwarf debug info statement locations)
> 
> As a note this may break the darwin gdb bot because of the newer form.
> We can conditionalize it on the "support old gdb"/"we should have a
> way to specify dwarf level" support.
> 
> -eric
> 
> On Tue, Aug 13, 2013 at 10:46 AM, Carlo Kok <ck at remobjects.com> wrote:
> > Author: carlokok
> > Date: Tue Aug 13 12:46:57 2013
> > New Revision: 188297
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=188297&view=rev
> > Log:
> > Output DW_AT_stmt_list dwarf debug info as DW_FORM_sec_offset instead
> of DW_FORM_data4 as it is a section offset (fixes the coff/dwarf debug
> info statement locations)
> >
> > Added:
> >     llvm/trunk/test/DebugInfo/X86/DW_AT_stmt_list_sec_offset.ll
> > Modified:
> >     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> >
> > Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> > URL: http://llvm.org/viewvc/llvm-
> project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=188297&r1=
> 188296&r2=188297&view=diff
> >
> =======================================================================
> =======
> > --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
> > +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue Aug 13
> 12:46:57 2013
> > @@ -740,7 +740,7 @@ CompileUnit *DwarfDebug::constructCompil
> >    // is not okay to use line_table_start here.
> >    if (!useSplitDwarf()) {
> >      if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
> > -      NewCU->addLabel(Die, dwarf::DW_AT_stmt_list,
> dwarf::DW_FORM_data4,
> > +      NewCU->addLabel(Die, dwarf::DW_AT_stmt_list,
> dwarf::DW_FORM_sec_offset,
> >                        UseTheFirstCU ?
> >                        Asm->GetTempSymbol("section_line") :
> LineTableStartSym);
> >      else if (UseTheFirstCU)
> >
> > Added: llvm/trunk/test/DebugInfo/X86/DW_AT_stmt_list_sec_offset.ll
> > URL: http://llvm.org/viewvc/llvm-
> project/llvm/trunk/test/DebugInfo/X86/DW_AT_stmt_list_sec_offset.ll?rev
> =188297&view=auto
> >
> =======================================================================
> =======
> > --- llvm/trunk/test/DebugInfo/X86/DW_AT_stmt_list_sec_offset.ll
> (added)
> > +++ llvm/trunk/test/DebugInfo/X86/DW_AT_stmt_list_sec_offset.ll Tue
> Aug 13 12:46:57 2013
> > @@ -0,0 +1,40 @@
> > +; RUN: llc -mtriple=i686-w64-mingw32 -o %t -filetype=obj %s
> > +; RUN: llvm-dwarfdump -debug-dump=all %t | FileCheck %s
> > +
> > +; CHECK:        DW_AT_stmt_list [DW_FORM_sec_offset]
> > +;
> > +; generated from:
> > +; clang -g -S -emit-llvm test.c -o test.ll
> > +; int main()
> > +; {
> > +;      return 0;
> > +; }
> > +
> > +; ModuleID = 'test.c'
> > +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-
> i64:64:64-f32:32:32-f64:64:64-f80:128:128-v64:64:64-v128:128:128-
> a0:0:64-f80:32:32-n8:16:32-S32"
> > +target triple = "i686-pc-win32"
> > +
> > +; Function Attrs: nounwind
> > +define i32 @main() #0 {
> > +entry:
> > +  %retval = alloca i32, align 4
> > +  store i32 0, i32* %retval
> > +  ret i32 0, !dbg !10
> > +}
> > +
> > +attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-
> pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-
> fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-
> size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
> > +
> > +!llvm.dbg.cu = !{!0}
> > +!llvm.module.flags = !{!9}
> > +
> > +!0 = metadata !{i32 786449, metadata !1, i32 12, metadata !"clang
> version 3.4 ", i1 false, metadata !"", i32 0, metadata !2, metadata !2,
> metadata !3, metadata !2, metadata !2, metadata !""} ; [
> DW_TAG_compile_unit ] [C:\Projects/test.c] [DW_LANG_C99]
> > +!1 = metadata !{metadata !"test.c", metadata !"C:\5CProjects"}
> > +!2 = metadata !{i32 0}
> > +!3 = metadata !{metadata !4}
> > +!4 = metadata !{i32 786478, metadata !1, metadata !5, metadata
> !"main", metadata !"main", metadata !"", i32 1, metadata !6, i1 false,
> i1 true, i32 0, i32 0, null, i32 0, i1 false, i32 ()* @main, null,
> null, metadata !2, i32 2} ; [ DW_TAG_subprogram ] [line 1] [def] [scope
> 2] [main]
> > +!5 = metadata !{i32 786473, metadata !1}          ; [
> DW_TAG_file_type ] [C:\Projects/test.c]
> > +!6 = metadata !{i32 786453, i32 0, i32 0, metadata !"", i32 0, i64
> 0, i64 0, i64 0, i32 0, null, metadata !7, i32 0, i32 0} ; [
> DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
> > +!7 = metadata !{metadata !8}
> > +!8 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64
> 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0,
> size 32, align 32, offset 0, enc DW_ATE_signed]
> > +!9 = metadata !{i32 2, metadata !"Dwarf Version", i32 3}
> > +!10 = metadata !{i32 3, i32 0, metadata !4, null}
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits







More information about the llvm-commits mailing list