[PATCH] D52444: [DWARF] Make llvm-dwarfdump display the .debug_loc.dwo section (fixes PR38991)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 24 19:43:00 PDT 2018


Should the address size be required/used for parsing the debug_loc.dwo
section? I would think there shouldn't be any addresses, or otherwise
address-size-dependent there?

On Mon, Sep 24, 2018 at 4:21 PM Wolfgang Pieb via Phabricator <
reviews at reviews.llvm.org> wrote:

> wolfgangp created this revision.
> wolfgangp added a reviewer: dblaikie.
> Herald added a subscriber: JDevlieghere.
> Herald added a reviewer: alexshap.
>
> A trivial fix. When creating the DebugLocDWO context, look at the number
> of DWO compile units.
>
>
> https://reviews.llvm.org/D52444
>
> Files:
>   lib/DebugInfo/DWARF/DWARFContext.cpp
>   test/tools/llvm-dwarfdump/X86/debug_loc_dwo.ll
>
>
> Index: test/tools/llvm-dwarfdump/X86/debug_loc_dwo.ll
> ===================================================================
> --- test/tools/llvm-dwarfdump/X86/debug_loc_dwo.ll
> +++ test/tools/llvm-dwarfdump/X86/debug_loc_dwo.ll
> @@ -0,0 +1,52 @@
> +; RUN: llc -filetype=obj -o %t.o -split-dwarf-file=%t.dwo %s
> +; RUN: llvm-objcopy --split-dwo=%t.dwo %t.o
> +; RUN: llvm-dwarfdump --debug-loc %t.dwo | FileCheck %s
> +
> +; Make sure llvm-dwarfdump can display a location list in a split dwarf
> context
> +; (i.e. in the .debug_loc.dwo section).
> +;
> +; Generated from the following source with
> +; clang -emit-llvm -S -O2 -gsplit-dwarf from:
> +;
> +; void y();
> +; void a(int i) {
> +;   y();
> +;   asm("" : : : "rdi");
> +; }
> +;
> +; CHECK:      .debug_loc.dwo contents:
> +; CHECK-NEXT: 0x00000000:
> +; CHECK-NEXT: Addr idx 0 (w/ length 6): DW_OP_reg5 RDI
> +
> +define dso_local void @_Z1ai(i32 %i) local_unnamed_addr !dbg !6 {
> +entry:
> +  call void @llvm.dbg.value(metadata i32 %i, metadata !11, metadata
> !DIExpression()), !dbg !12
> +  tail call void @_Z1yv(), !dbg !13
> +  tail call void asm sideeffect "",
> "~{rdi},~{dirflag},~{fpsr},~{flags}"(), !dbg !14, !srcloc !15
> +  ret void, !dbg !16
> +}
> +
> +declare dso_local void @_Z1yv() local_unnamed_addr
> +declare void @llvm.dbg.value(metadata, metadata, metadata)
> +
> +!llvm.dbg.cu = !{!0}
> +!llvm.module.flags = !{!3, !4}
> +!llvm.ident = !{!5}
> +
> +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1,
> producer: "clang version 8.0.0 (trunk 342698)", isOptimized: true,
> runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: GNU)
> +!1 = !DIFile(filename: "a.cpp", directory: "/home/test/Bugzillas/PR38990")
> +!2 = !{}
> +!3 = !{i32 2, !"Debug Info Version", i32 3}
> +!4 = !{i32 1, !"wchar_size", i32 4}
> +!5 = !{!"clang version 8.0.0 (trunk 342698)"}
> +!6 = distinct !DISubprogram(name: "a", linkageName: "_Z1ai", scope: !1,
> file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, scopeLine:
> 2, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !10)
> +!7 = !DISubroutineType(types: !8)
> +!8 = !{null, !9}
> +!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
> +!10 = !{!11}
> +!11 = !DILocalVariable(name: "i", arg: 1, scope: !6, file: !1, line: 2,
> type: !9)
> +!12 = !DILocation(line: 2, column: 12, scope: !6)
> +!13 = !DILocation(line: 3, column: 3, scope: !6)
> +!14 = !DILocation(line: 4, column: 3, scope: !6)
> +!15 = !{i32 41}
> +!16 = !DILocation(line: 5, column: 1, scope: !6)
> Index: lib/DebugInfo/DWARF/DWARFContext.cpp
> ===================================================================
> --- lib/DebugInfo/DWARF/DWARFContext.cpp
> +++ lib/DebugInfo/DWARF/DWARFContext.cpp
> @@ -692,9 +692,9 @@
>
>    LocDWO.reset(new DWARFDebugLocDWO());
>    // Assume all compile units have the same address byte size.
> -  if (getNumCompileUnits()) {
> +  if (getNumDWOCompileUnits()) {
>      DataExtractor LocData(DObj->getLocDWOSection().Data, isLittleEndian(),
> -                          getUnitAtIndex(0)->getAddressByteSize());
> +                          getDWOUnitAtIndex(0)->getAddressByteSize());
>      LocDWO->parse(LocData);
>    }
>    return LocDWO.get();
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180924/442676ab/attachment.html>


More information about the llvm-commits mailing list