Skip to content

Commit b45529f

Browse files
author
git apple-llvm automerger
committed
Merge commit '754fdf392aa5' from apple/master into swift/master-next
2 parents 9edc570 + 754fdf3 commit b45529f

14 files changed

+61
-53
lines changed

llvm/include/llvm/DebugInfo/DWARF/DWARFAddressRange.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
namespace llvm {
1818

1919
class raw_ostream;
20+
class DWARFObject;
2021

2122
struct DWARFAddressRange {
2223
uint64_t LowPC;
@@ -26,7 +27,9 @@ struct DWARFAddressRange {
2627
DWARFAddressRange() = default;
2728

2829
/// Used for unit testing.
29-
DWARFAddressRange(uint64_t LowPC, uint64_t HighPC, uint64_t SectionIndex = 0)
30+
DWARFAddressRange(
31+
uint64_t LowPC, uint64_t HighPC,
32+
uint64_t SectionIndex = object::SectionedAddress::UndefSection)
3033
: LowPC(LowPC), HighPC(HighPC), SectionIndex(SectionIndex) {}
3134

3235
/// Returns true if LowPC is smaller or equal to HighPC. This accounts for
@@ -42,8 +45,8 @@ struct DWARFAddressRange {
4245
return LowPC < RHS.HighPC && RHS.LowPC < HighPC;
4346
}
4447

45-
void dump(raw_ostream &OS, uint32_t AddressSize,
46-
DIDumpOptions DumpOpts = {}) const;
48+
void dump(raw_ostream &OS, uint32_t AddressSize, DIDumpOptions DumpOpts = {},
49+
const DWARFObject *Obj = nullptr) const;
4750
};
4851

4952
static inline bool operator<(const DWARFAddressRange &LHS,

llvm/lib/DebugInfo/DWARF/DWARFAddressRange.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,23 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "llvm/DebugInfo/DWARF/DWARFAddressRange.h"
10-
10+
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
1111
#include "llvm/Support/Format.h"
1212
#include "llvm/Support/raw_ostream.h"
1313

1414
using namespace llvm;
1515

1616
void DWARFAddressRange::dump(raw_ostream &OS, uint32_t AddressSize,
17-
DIDumpOptions DumpOpts) const {
17+
DIDumpOptions DumpOpts,
18+
const DWARFObject *Obj) const {
1819

1920
OS << (DumpOpts.DisplayRawContents ? " " : "[");
2021
OS << format("0x%*.*" PRIx64 ", ", AddressSize * 2, AddressSize * 2, LowPC)
2122
<< format("0x%*.*" PRIx64, AddressSize * 2, AddressSize * 2, HighPC);
2223
OS << (DumpOpts.DisplayRawContents ? "" : ")");
24+
25+
if (Obj)
26+
DWARFFormValue::dumpAddressSection(*Obj, OS, DumpOpts, SectionIndex);
2327
}
2428

2529
raw_ostream &llvm::operator<<(raw_ostream &OS, const DWARFAddressRange &R) {

llvm/lib/DebugInfo/DWARF/DWARFContext.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,16 +388,20 @@ void DWARFContext::dump(
388388
dumpDebugType(".debug_types.dwo", dwo_types_section_units());
389389
}
390390

391+
DIDumpOptions LLDumpOpts = DumpOpts;
392+
if (LLDumpOpts.Verbose)
393+
LLDumpOpts.DisplayRawContents = true;
394+
391395
if (const auto *Off = shouldDump(Explicit, ".debug_loc", DIDT_ID_DebugLoc,
392396
DObj->getLocSection().Data)) {
393-
getDebugLoc()->dump(OS, getRegisterInfo(), DumpOpts, *Off);
397+
getDebugLoc()->dump(OS, getRegisterInfo(), LLDumpOpts, *Off);
394398
}
395399
if (const auto *Off =
396400
shouldDump(Explicit, ".debug_loclists", DIDT_ID_DebugLoclists,
397401
DObj->getLoclistsSection().Data)) {
398402
DWARFDataExtractor Data(*DObj, DObj->getLoclistsSection(), isLittleEndian(),
399403
0);
400-
dumpLoclistsSection(OS, DumpOpts, Data, getRegisterInfo(), *Off);
404+
dumpLoclistsSection(OS, LLDumpOpts, Data, getRegisterInfo(), *Off);
401405
}
402406
if (const auto *Off =
403407
shouldDump(ExplicitDWO, ".debug_loc.dwo", DIDT_ID_DebugLoc,
@@ -409,10 +413,11 @@ void DWARFContext::dump(
409413
uint64_t Offset = **Off;
410414
Loc.dumpLocationList(&Offset, OS,
411415
/*BaseAddr=*/None, getRegisterInfo(), nullptr,
412-
DumpOpts, /*Indent=*/0);
416+
LLDumpOpts, /*Indent=*/0);
413417
OS << "\n";
414418
} else {
415-
Loc.dumpRange(0, Data.getData().size(), OS, getRegisterInfo(), DumpOpts);
419+
Loc.dumpRange(0, Data.getData().size(), OS, getRegisterInfo(),
420+
LLDumpOpts);
416421
}
417422
}
418423

llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,20 @@ bool DWARFLocationTable::dumpLocationList(uint64_t *Offset, raw_ostream &OS,
115115
OS << format("0x%8.8" PRIx64 ": ", *Offset);
116116
Error E = visitLocationList(Offset, [&](const DWARFLocationEntry &E) {
117117
Expected<Optional<DWARFLocationExpression>> Loc = Interp.Interpret(E);
118-
if (!Loc || DumpOpts.Verbose)
118+
if (!Loc || DumpOpts.DisplayRawContents)
119119
dumpRawEntry(E, OS, Indent);
120120
if (Loc && *Loc) {
121121
OS << "\n";
122122
OS.indent(Indent);
123-
if (DumpOpts.Verbose)
123+
if (DumpOpts.DisplayRawContents)
124124
OS << " => ";
125-
Loc.get()->Range->dump(OS, Data.getAddressSize(), DumpOpts);
125+
126+
DIDumpOptions RangeDumpOpts(DumpOpts);
127+
RangeDumpOpts.DisplayRawContents = false;
128+
const DWARFObject *Obj = nullptr;
129+
if (U)
130+
Obj = &U->getContext().getDWARFObj();
131+
Loc.get()->Range->dump(OS, Data.getAddressSize(), RangeDumpOpts, Obj);
126132
}
127133
if (!Loc)
128134
consumeError(Loc.takeError());

llvm/lib/DebugInfo/DWARF/DWARFDie.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,10 @@ static void dumpRanges(const DWARFObject &Obj, raw_ostream &OS,
6262
if (!DumpOpts.ShowAddresses)
6363
return;
6464

65-
ArrayRef<SectionName> SectionNames;
66-
if (DumpOpts.Verbose)
67-
SectionNames = Obj.getSectionNames();
68-
6965
for (const DWARFAddressRange &R : Ranges) {
7066
OS << '\n';
7167
OS.indent(Indent);
72-
R.dump(OS, AddressSize);
73-
74-
DWARFFormValue::dumpAddressSection(Obj, OS, DumpOpts, R.SectionIndex);
68+
R.dump(OS, AddressSize, DumpOpts, &Obj);
7569
}
7670
}
7771

@@ -91,9 +85,6 @@ static void dumpLocation(raw_ostream &OS, DWARFFormValue &FormValue,
9185
}
9286

9387
if (FormValue.isFormClass(DWARFFormValue::FC_SectionOffset)) {
94-
auto LLDumpOpts = DumpOpts;
95-
LLDumpOpts.Verbose = false;
96-
9788
uint64_t Offset = *FormValue.getAsSectionOffset();
9889

9990
if (FormValue.getForm() == DW_FORM_loclistx) {
@@ -104,7 +95,7 @@ static void dumpLocation(raw_ostream &OS, DWARFFormValue &FormValue,
10495
return;
10596
}
10697
U->getLocationTable().dumpLocationList(&Offset, OS, U->getBaseAddress(),
107-
MRI, U, LLDumpOpts, Indent);
98+
MRI, U, DumpOpts, Indent);
10899
return;
109100
}
110101

llvm/test/CodeGen/X86/debug-loclists.ll

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,18 @@
33

44
; CHECK: DW_TAG_variable
55
; CHECK-NEXT: DW_AT_location [DW_FORM_loclistx] (indexed (0x0) loclist = 0x00000018:
6-
; CHECK-NEXT: [0x0000000000000000, 0x0000000000000003): DW_OP_consts +3, DW_OP_stack_value
7-
; CHECK-NEXT: [0x0000000000000003, 0x0000000000000004): DW_OP_consts +4, DW_OP_stack_value)
6+
; CHECK-NEXT: [0x0000000000000000, 0x0000000000000003) ".text._Z2f1ii": DW_OP_consts +3, DW_OP_stack_value
7+
; CHECK-NEXT: [0x0000000000000003, 0x0000000000000004) ".text._Z2f1ii": DW_OP_consts +4, DW_OP_stack_value)
88
; CHECK-NEXT: DW_AT_name {{.*}} "y"
99

1010
; CHECK: DW_TAG_variable
1111
; CHECK-NEXT: DW_AT_location [DW_FORM_loclistx] (indexed (0x1) loclist = 0x00000029:
12-
; CHECK-NEXT: [0x0000000000000000, 0x0000000000000003): DW_OP_consts +5, DW_OP_stack_value)
12+
; CHECK-NEXT: [0x0000000000000000, 0x0000000000000003) ".text._Z2f1ii": DW_OP_consts +5, DW_OP_stack_value)
1313
; CHECK-NEXT: DW_AT_name {{.*}} "x"
1414

1515
; CHECK: DW_TAG_variable
16-
; FIXME: Use DW_FORM_loclistx to reduce relocations
1716
; CHECK-NEXT: DW_AT_location [DW_FORM_loclistx] (indexed (0x2) loclist = 0x00000031:
18-
; CHECK-NEXT: [0x0000000000000003, 0x0000000000000004): DW_OP_reg0 RAX)
17+
; CHECK-NEXT: [0x0000000000000003, 0x0000000000000004) ".text._Z2f1ii": DW_OP_reg0 RAX)
1918
; CHECK-NEXT: DW_AT_name {{.*}} "r"
2019

2120
; CHECK: .debug_loclists contents:

llvm/test/DebugInfo/ARM/PR26163.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: llc -filetype=obj -o - < %s | llvm-dwarfdump -v -debug-info - | FileCheck %s
1+
; RUN: llc -filetype=obj -o - < %s | llvm-dwarfdump -debug-info - | FileCheck %s
22
;
33
; Checks that we're omitting the first range, as it is empty, and that we're
44
; emitting one that spans the rest of the function. In this case, the first
@@ -10,7 +10,7 @@
1010
;
1111
; CHECK: DW_TAG_inlined_subroutine
1212
; CHECK: DW_TAG_variable
13-
; CHECK: DW_AT_location [DW_FORM_sec_offset] ({{.*}}
13+
; CHECK: DW_AT_location ({{.*}}
1414
; CHECK-NEXT: [0x00000004, 0x00000014): DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x4)
1515

1616
; Created form the following test case (PR26163) with

llvm/test/DebugInfo/Mips/dsr-fixed-objects.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ declare void @foo(i32*)
2424
; CHECK: DW_AT_name {{.*}}"e"
2525
; CHECK: DW_TAG_variable
2626
; CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (
27-
; CHECK-NEXT: [0x00000028, 0x0000002c): DW_OP_reg1 AT_64
28-
; CHECK-NEXT: [0x0000002c, 0x00000048): DW_OP_breg29 SP_64+16)
27+
; CHECK-NEXT: [0x00000028, 0x0000002c) ".text": DW_OP_reg1 AT_64
28+
; CHECK-NEXT: [0x0000002c, 0x00000048) ".text": DW_OP_breg29 SP_64+16)
2929
; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000006b] = "x")
3030

3131
define i32 @f0(i32 signext %a, i32 signext %b, i32 signext %c, i32 signext %d, i32 signext %e) !dbg !4 {
@@ -55,8 +55,8 @@ entry:
5555

5656
; CHECK: DW_TAG_variable
5757
; CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (
58-
; CHECK-NEXT: [0x00000080, 0x00000084): DW_OP_reg1 AT_64
59-
; CHECK-NEXT: [0x00000084, 0x00000098): DW_OP_breg29 SP_64+16)
58+
; CHECK-NEXT: [0x00000080, 0x00000084) ".text": DW_OP_reg1 AT_64
59+
; CHECK-NEXT: [0x00000084, 0x00000098) ".text": DW_OP_breg29 SP_64+16)
6060
; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000006b] = "x")
6161

6262
define i32 @f1(i32 signext %a, i32 signext %b, i32 signext %c, i32 signext %d, i32 signext %e) !dbg !15 {

llvm/test/DebugInfo/X86/DW_AT_location-reference.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
; CHECK: DW_TAG_variable
3434
; CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x00000000
3535
; Check that the location contains only 2 ranges.
36-
; CHECK-NEXT: [0x{{[0-9a-f]*}}, 0x{{[0-9a-f]*}}):
37-
; CHECK-NEXT: [0x{{[0-9a-f]*}}, 0x{{[0-9a-f]*}}): {{.*}})
36+
; CHECK-NEXT: [0x{{[0-9a-f]*}}, 0x{{[0-9a-f]*}})
37+
; CHECK-NEXT: [0x{{[0-9a-f]*}}, 0x{{[0-9a-f]*}}){{.*}})
3838
; CHECK-NEXT: DW_AT_name {{.*}} "x"
3939
; CHECK-NEXT: DW_AT_decl_file
4040
; CHECK-NEXT: DW_AT_decl_line

llvm/test/DebugInfo/X86/constant-loclist.ll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
; CHECK: .debug_info contents:
66
; CHECK: DW_TAG_variable
77
; CHECK-NEXT: DW_AT_location [DW_FORM_data4] (
8-
; CHECK-NEXT: [0x{{.*}}, 0x{{.*}}): DW_OP_constu 0x4000000000000000)
8+
; CHECK-NEXT: {{.*}}: DW_OP_constu 0x4000000000000000)
99
; CHECK-NEXT: DW_AT_name {{.*}}"d"
1010
; CHECK: DW_TAG_variable
1111
; CHECK-NEXT: DW_AT_location [DW_FORM_data4] (
12-
; CHECK-NEXT: [0x{{.*}}, 0x{{.*}}): DW_OP_consts +0
13-
; CHECK-NEXT: [0x{{.*}}, 0x{{.*}}): DW_OP_consts +4611686018427387904)
12+
; CHECK-NEXT: {{.*}}: DW_OP_consts +0
13+
; CHECK-NEXT: {{.*}}: DW_OP_consts +4611686018427387904)
1414
; CHECK-NEXT: DW_AT_name {{.*}}"i"
1515
; CHECK: DW_TAG_variable
1616
; CHECK-NEXT: DW_AT_location [DW_FORM_data4] (
17-
; CHECK-NEXT: [0x{{.*}}, 0x{{.*}}): DW_OP_lit0
18-
; CHECK-NEXT: [0x{{.*}}, 0x{{.*}}): DW_OP_constu 0x4000000000000000)
17+
; CHECK-NEXT: {{.*}}: DW_OP_lit0
18+
; CHECK-NEXT: {{.*}}: DW_OP_constu 0x4000000000000000)
1919
; CHECK-NEXT: DW_AT_name {{.*}}"u"
2020

2121
source_filename = "test.c"

llvm/test/DebugInfo/X86/dbg-value-frame-index.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
; RUN: llc -mtriple=x86_64-unknown-unknown -o - %s | FileCheck %s
22
; RUN: llc -mtriple=x86_64-unknown-unknown -filetype=obj < %s \
3-
; RUN: | llvm-dwarfdump -v - | FileCheck %s --check-prefix=DWARF
3+
; RUN: | llvm-dwarfdump - | FileCheck %s --check-prefix=DWARF
44

55
define i1 @test() !dbg !4 {
66
entry:
@@ -22,7 +22,7 @@ while.end:
2222
; CHECK-LABEL: test
2323
; To get the value of the variable, we need to do [$rsp+8], i.e:
2424
; CHECK: #DEBUG_VALUE: test:w <- [DW_OP_plus_uconst 8, DW_OP_deref] $rsp
25-
; DWARF: DW_AT_location [DW_FORM_sec_offset] (
25+
; DWARF: DW_AT_location (
2626
; DWARF-NEXT: [{{.*}}, {{.*}}): DW_OP_breg7 RSP+8)
2727

2828
; Note: A previous version of this test checked for `[DW_OP_plus_uconst 8] [$rsp+0]`,

llvm/test/DebugInfo/X86/dbg-value-regmask-clobber.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; RUN: llc < %s | FileCheck %s --check-prefix=ASM
2-
; RUN: llc < %s -filetype=obj | llvm-dwarfdump -v - | FileCheck %s --check-prefix=DWARF
2+
; RUN: llc < %s -filetype=obj | llvm-dwarfdump - | FileCheck %s --check-prefix=DWARF
33

44
; Values in registers should be clobbered by calls, which use a regmask instead
55
; of individual register def operands.
@@ -22,9 +22,9 @@
2222
; argc is the first formal parameter.
2323
; DWARF: .debug_info contents:
2424
; DWARF: DW_TAG_formal_parameter
25-
; DWARF-NEXT: DW_AT_location [DW_FORM_sec_offset] ({{0x.*}}
25+
; DWARF-NEXT: DW_AT_location ({{0x.*}}
2626
; DWARF-NEXT: [0x0000000000000000, 0x0000000000000013): DW_OP_reg2 RCX)
27-
; DWARF-NEXT: DW_AT_name [DW_FORM_strp] {{.*}} "argc"
27+
; DWARF-NEXT: DW_AT_name ("argc")
2828

2929
; ModuleID = 't.cpp'
3030
source_filename = "test/DebugInfo/X86/dbg-value-regmask-clobber.ll"

llvm/test/DebugInfo/X86/debug-loc-frame.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
; for the stack location directly instead of generating a register+offset indirection.
55

66
; RUN: llc -O2 -filetype=obj -disable-post-ra -mtriple=x86_64-unknown-linux-gnu < %s \
7-
; RUN: | llvm-dwarfdump -v - | FileCheck %s
7+
; RUN: | llvm-dwarfdump - | FileCheck %s
88
;
99
; int data = 17;
1010
; int sum = 0;
@@ -26,7 +26,7 @@
2626
; CHECK: DW_TAG_subprogram
2727
; CHECK-NOT: NULL
2828
; CHECK: DW_TAG_variable
29-
; CHECK: DW_AT_location [DW_FORM_sec_offset] ({{.*}}
29+
; CHECK: DW_AT_location ({{.*}}
3030
; CHECK-NEXT: [{{0x.*}}, {{0x.*}}): DW_OP_reg0 RAX
3131
;
3232
; Note: This is a location, so we don't want an extra DW_OP_deref at the end.
@@ -36,7 +36,7 @@
3636
; ... [rsp+4] DW_OP_deref
3737
;
3838
; CHECK-NEXT: [{{0x.*}}, {{0x.*}}): DW_OP_breg7 RSP+4)
39-
; CHECK-NEXT: DW_AT_name {{.*}}"val"
39+
; CHECK-NEXT: DW_AT_name ("val")
4040

4141
; ModuleID = 'frame.c'
4242
source_filename = "frame.c"

llvm/test/DebugInfo/X86/debug-loc-offset.mir

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
# CHECK: DW_TAG_formal_parameter
4343
# CHECK-NOT: DW_TAG
4444
# CHECK: DW_AT_location [DW_FORM_sec_offset] ({{.*}}
45-
# CHECK-NEXT: [0x00000029, 0x00000037): DW_OP_breg0 EAX+0, DW_OP_deref
46-
# CHECK-NEXT: [0x00000037, 0x00000063): DW_OP_breg5 EBP-8, DW_OP_deref, DW_OP_deref
45+
# CHECK-NEXT: [0x00000029, 0x00000037) ".text": DW_OP_breg0 EAX+0, DW_OP_deref
46+
# CHECK-NEXT: [0x00000037, 0x00000063) ".text": DW_OP_breg5 EBP-8, DW_OP_deref, DW_OP_deref
4747
# CHECK-NEXT: DW_AT_name [DW_FORM_strp]{{.*}}"a"
4848
#
4949
# CHECK: DW_TAG_variable
@@ -61,8 +61,8 @@
6161
# CHECK: DW_TAG_formal_parameter
6262
# CHECK-NOT: DW_TAG
6363
# CHECK: DW_AT_location [DW_FORM_sec_offset] ({{.*}}
64-
# CHECK-NEXT: [0x00000000, 0x0000000a): DW_OP_consts +0, DW_OP_stack_value
65-
# CHECK-NEXT: [0x0000000a, 0x00000017): DW_OP_consts +1, DW_OP_stack_value)
64+
# CHECK-NEXT: [0x00000000, 0x0000000a) ".text": DW_OP_consts +0, DW_OP_stack_value
65+
# CHECK-NEXT: [0x0000000a, 0x00000017) ".text": DW_OP_consts +1, DW_OP_stack_value)
6666
# CHECK-NEXT: DW_AT_name [DW_FORM_strp]{{.*}}"b"
6767
#
6868
# CHECK: .debug_loc contents:

0 commit comments

Comments
 (0)