mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 02:52:53 +02:00
6350896386
Summary: This patch extracts the logic for computing the "absolute" locations, which was partially present in the debug_loclists dumper, completes it, and moves it into a separate function. This makes it possible to later reuse the same logic for uses other than dumping. The dumper is changed to reuse the location list interpreter, and its format is changed somewhat. In "verbose" mode it prints the "raw" value of a location list, the interpreted location (if available) and the expression itself. In non-verbose mode it prints only one of the location forms: it prefers the interpreted form, but falls back to the "raw" format if interpretation is not possible (for instance, because we were not given a base address, or the resolution of indirect addresses failed). This patch also undos some of the changes made in D69672, namely the part about making all functions static. The main reason for this is that I learned that the original approach (dumping only fully resolved locations) meant that it was impossible to rewrite one of the existing tests. To make that possible (and make the "inline location" dump work in more cases), I now reuse the same dumping mechanism as is used for section-based dumping. As this required having more objects know about the various location lists classes, it seemed like a good idea to create an interface abstracting the difference between them. Therefore, I now create a DWARFLocationTable class, which will serve as a base class for the location list classes. DWARFDebugLoclists is made to inherit from that. DWARFDebugLoc will follow. Another positive effect of this change is that section-based dumping code will not need to use templates (as originally) envisioned, and that the argument lists of the dumping functions become shorter. Reviewers: dblaikie, probinson, JDevlieghere, aprantl, SouraVX Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70081
63 lines
2.5 KiB
LLVM
63 lines
2.5 KiB
LLVM
; RUN: llc -split-dwarf-file=%t1.dwo -filetype=obj -o %t1.o < %s
|
|
; RUN: llc -split-dwarf-file=%t2.dwo -filetype=obj -o %t2.o < %p/../Inputs/loclists-dwp-b.ll
|
|
; RUN: llvm-dwp %t1.o %t2.o -o %t.dwp
|
|
; RUN: llvm-dwarfdump -v %t.dwp | FileCheck %s
|
|
|
|
; Make sure that 2 location lists from different units within a dwp file are
|
|
; dumped correctly. The 2 location lists differ in the length of their address
|
|
; ranges.
|
|
;
|
|
; Generate both .ll files with clang -S -emit-llvm from the following sources:
|
|
; a.cpp:
|
|
; void y();
|
|
; void a(int i) {
|
|
; y();
|
|
; asm("" : : : "rdi");
|
|
; }
|
|
;
|
|
; b.cpp:
|
|
; void b(int i) { asm("" : : : "rdi"); }
|
|
|
|
; CHECK: DW_AT_location [DW_FORM_sec_offset] (0x00000000
|
|
; CHECK-NEXT: DW_LLE_startx_length (0x0000000000000000, 0x0000000000000006): DW_OP_reg5 RDI)
|
|
|
|
; CHECK: DW_AT_location [DW_FORM_sec_offset] (0x00000000
|
|
; CHECK-NEXT: DW_LLE_startx_length (0x0000000000000000, 0x0000000000000000): DW_OP_reg5 RDI)
|
|
|
|
target triple = "x86_64-unknown-linux-gnu"
|
|
|
|
define dso_local void @_Z1ai(i32 %i) local_unnamed_addr !dbg !7 {
|
|
entry:
|
|
call void @llvm.dbg.value(metadata i32 %i, metadata !12, metadata !DIExpression()), !dbg !13
|
|
tail call void @_Z1yv(), !dbg !14
|
|
tail call void asm sideeffect "", "~{rdi},~{dirflag},~{fpsr},~{flags}"(), !dbg !15, !srcloc !16
|
|
ret void, !dbg !17
|
|
}
|
|
|
|
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, !5}
|
|
!llvm.ident = !{!6}
|
|
|
|
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 8.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
|
|
!1 = !DIFile(filename: "a.cpp", directory: "/home/test/PRs/PR38990")
|
|
!2 = !{}
|
|
!3 = !{i32 2, !"Dwarf Version", i32 4}
|
|
!4 = !{i32 2, !"Debug Info Version", i32 3}
|
|
!5 = !{i32 1, !"wchar_size", i32 4}
|
|
!6 = !{!"clang version 8.0.0"}
|
|
!7 = distinct !DISubprogram(name: "a", linkageName: "_Z1ai", scope: !1, file: !1, line: 2, type: !8, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !11)
|
|
!8 = !DISubroutineType(types: !9)
|
|
!9 = !{null, !10}
|
|
!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
|
|
!11 = !{!12}
|
|
!12 = !DILocalVariable(name: "i", arg: 1, scope: !7, file: !1, line: 2, type: !10)
|
|
!13 = !DILocation(line: 2, column: 12, scope: !7)
|
|
!14 = !DILocation(line: 3, column: 3, scope: !7)
|
|
!15 = !DILocation(line: 4, column: 3, scope: !7)
|
|
!16 = !{i32 41}
|
|
!17 = !DILocation(line: 5, column: 1, scope: !7)
|