[llvm] r264316 - [debuginfo] Include dwo_name in the split unit to improve dwp diagnostics

Chaoren Lin via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 28 13:57:57 PDT 2016


Hi David,

This change caused clang to produce inferior binaries that causes LLDB to
go into an infinite loop while parsing their debug info.

I don't know enough about the debug information format to tell if it's
clang now generating incorrect debug info due to this change, or if it's
lldb incorrectly parsing the debug info (which just happen to have been
working fine until now).
Could you please take a look?

For LLDB folks, it's looping through these 4 functions:

lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h:GetCompileUnitDIEPtrOnly()
lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h:GetCompileUnitDIEOnly()
lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp:AddCompileUnitDIE()
lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp:ExtractDIEsIfNeeded()



On Thu, Mar 24, 2016 at 11:37 AM, David Blaikie via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: dblaikie
> Date: Thu Mar 24 13:37:08 2016
> New Revision: 264316
>
> URL: http://llvm.org/viewvc/llvm-project?rev=264316&view=rev
> Log:
> [debuginfo] Include dwo_name in the split unit to improve dwp diagnostics
>
> When multiple DWP files are merged together and duplicate DWO IDs are
> found it's currently difficult to give an actionable error message - the
> DW_AT_name of the CU could be provided, but might be identical (if the
> same source file is built into two different configurations), which
> doesn't help the user identify the problem.
>
> When no intermediate DWP files are generated, the path to the two DWO
> files could be provided - but is lost once the DWOs are merged into a
> DWP.
>
> So, include the name of the DWO (dwo_name) in the split file so that
> collissions involving a source CU from a DWP can be better diagnosed.
>
> (improvements to llvm-dwp using this to come shortly)
>
> Modified:
>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>     llvm/trunk/test/DebugInfo/X86/fission-cu.ll
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=264316&r1=264315&r2=264316&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Thu Mar 24 13:37:08
> 2016
> @@ -391,8 +391,11 @@ DwarfDebug::constructDwarfCompileUnit(co
>    DwarfCompileUnit &NewCU = *OwnedUnit;
>    DIE &Die = NewCU.getUnitDie();
>    InfoHolder.addUnit(std::move(OwnedUnit));
> -  if (useSplitDwarf())
> +  if (useSplitDwarf()) {
>      NewCU.setSkeleton(constructSkeletonCU(NewCU));
> +    NewCU.addString(Die, dwarf::DW_AT_GNU_dwo_name,
> +                    DIUnit->getSplitDebugFilename());
> +  }
>
>    // LTO with assembly output shares a single line table amongst multiple
> CUs.
>    // To avoid the compilation directory being ambiguous, let the line
> table
>
> Modified: llvm/trunk/test/DebugInfo/X86/fission-cu.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/fission-cu.ll?rev=264316&r1=264315&r2=264316&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/DebugInfo/X86/fission-cu.ll (original)
> +++ llvm/trunk/test/DebugInfo/X86/fission-cu.ll Thu Mar 24 13:37:08 2016
> @@ -33,6 +33,7 @@
>  ; CHECK: .debug_abbrev.dwo contents:
>  ; CHECK: Abbrev table for offset: 0x00000000
>  ; CHECK: [1] DW_TAG_compile_unit DW_CHILDREN_yes
> +; CHECK: DW_AT_GNU_dwo_name  DW_FORM_GNU_str_index
>  ; CHECK: DW_AT_producer  DW_FORM_GNU_str_index
>  ; CHECK: DW_AT_language  DW_FORM_data2
>  ; CHECK: DW_AT_name      DW_FORM_GNU_str_index
> @@ -64,38 +65,41 @@
>  ; Check that the rest of the compile units have information.
>  ; CHECK: .debug_info.dwo contents:
>  ; CHECK: DW_TAG_compile_unit
> -; CHECK: DW_AT_producer [DW_FORM_GNU_str_index] ( indexed (00000000)
> string = "clang version 3.3 (trunk 169021) (llvm/trunk 169020)")
> +; CHECK: DW_AT_GNU_dwo_name [DW_FORM_GNU_str_index] ( indexed (00000000)
> string = "baz.dwo")
> +; CHECK: DW_AT_producer [DW_FORM_GNU_str_index] ( indexed (00000001)
> string = "clang version 3.3 (trunk 169021) (llvm/trunk 169020)")
>  ; CHECK: DW_AT_language [DW_FORM_data2]        (DW_LANG_C99)
> -; CHECK: DW_AT_name [DW_FORM_GNU_str_index]    ( indexed (00000001)
> string = "baz.c")
> +; CHECK: DW_AT_name [DW_FORM_GNU_str_index]    ( indexed (00000002)
> string = "baz.c")
>  ; CHECK-NOT: DW_AT_low_pc
>  ; CHECK-NOT: DW_AT_stmt_list
>  ; CHECK-NOT: DW_AT_comp_dir
>  ; CHECK: DW_AT_GNU_dwo_id [DW_FORM_data8]  (0x1f1f859683d49324)
>  ; CHECK: DW_TAG_variable
> -; CHECK: DW_AT_name [DW_FORM_GNU_str_index]     ( indexed (00000002)
> string = "a")
> +; CHECK: DW_AT_name [DW_FORM_GNU_str_index]     ( indexed (00000003)
> string = "a")
>  ; CHECK: DW_AT_type [DW_FORM_ref4]       (cu + 0x{{[0-9a-f]*}} =>
> {[[TYPE:0x[0-9a-f]*]]})
>  ; CHECK: DW_AT_external [DW_FORM_flag_present]   (true)
>  ; CHECK: DW_AT_decl_file [DW_FORM_data1] (0x01)
>  ; CHECK: DW_AT_decl_line [DW_FORM_data1] (1)
>  ; CHECK: DW_AT_location [DW_FORM_exprloc] (<0x2> fb 00 )
>  ; CHECK: [[TYPE]]: DW_TAG_base_type
> -; CHECK: DW_AT_name [DW_FORM_GNU_str_index]     ( indexed (00000003)
> string = "int")
> +; CHECK: DW_AT_name [DW_FORM_GNU_str_index]     ( indexed (00000004)
> string = "int")
>
>  ; CHECK: .debug_str contents:
>  ; CHECK: 0x00000000: "baz.dwo"
>  ; CHECK: 0x00000008: "/usr/local/google/home/echristo/tmp"
>
>  ; CHECK: .debug_str.dwo contents:
> -; CHECK: 0x00000000: "clang version 3.3 (trunk 169021) (llvm/trunk
> 169020)"
> -; CHECK: 0x00000035: "baz.c"
> -; CHECK: 0x0000003b: "a"
> -; CHECK: 0x0000003d: "int"
> +; CHECK: 0x00000000: "baz.dwo"
> +; CHECK: 0x00000008: "clang version 3.3 (trunk 169021) (llvm/trunk
> 169020)"
> +; CHECK: 0x0000003d: "baz.c"
> +; CHECK: 0x00000043: "a"
> +; CHECK: 0x00000045: "int"
>
>  ; CHECK: .debug_str_offsets.dwo contents:
>  ; CHECK: 0x00000000: 00000000
> -; CHECK: 0x00000004: 00000035
> -; CHECK: 0x00000008: 0000003b
> -; CHECK: 0x0000000c: 0000003d
> +; CHECK: 0x00000004: 00000008
> +; CHECK: 0x00000008: 0000003d
> +; CHECK: 0x0000000c: 00000043
> +; CHECK: 0x00000010: 00000045
>
>  ; Object file checks
>  ; For x86-64-linux we should have this set of relocations for the debug
> info section
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160328/65509857/attachment.html>


More information about the llvm-commits mailing list