Skip to content

Commit 8c1aca1

Browse files
committed
Revert "Reapply "[NFC][DebugInfo][DWARF] Create new low-level dwarf library (#… (llvm#145959) (llvm#146112)"
This reverts commit 23f1ba3.
1 parent cadf26b commit 8c1aca1

File tree

57 files changed

+839
-893
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+839
-893
lines changed

bolt/include/bolt/Core/DIEBuilder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
#include "llvm/CodeGen/DIE.h"
2121
#include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
2222
#include "llvm/DebugInfo/DWARF/DWARFDie.h"
23+
#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
2324
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
24-
#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
2525
#include "llvm/Support/Allocator.h"
2626

2727
#include <list>

bolt/lib/Core/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
set(LLVM_LINK_COMPONENTS
22
DebugInfoDWARF
3-
DebugInfoDWARFLowLevel
43
Demangle
54
MC
65
MCDisassembler

bolt/lib/Core/DIEBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
#include "llvm/CodeGen/DIE.h"
1515
#include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
1616
#include "llvm/DebugInfo/DWARF/DWARFDie.h"
17+
#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
1718
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
1819
#include "llvm/DebugInfo/DWARF/DWARFTypeUnit.h"
1920
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
2021
#include "llvm/DebugInfo/DWARF/DWARFUnitIndex.h"
21-
#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
2222
#include "llvm/Support/Casting.h"
2323
#include "llvm/Support/Debug.h"
2424
#include "llvm/Support/ErrorHandling.h"

bolt/lib/Core/DebugNames.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
#include "bolt/Core/DebugNames.h"
1010
#include "bolt/Core/BinaryContext.h"
11+
#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
1112
#include "llvm/DebugInfo/DWARF/DWARFTypeUnit.h"
12-
#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
1313
#include "llvm/Support/EndianStream.h"
1414
#include "llvm/Support/LEB128.h"
1515
#include <cstdint>

bolt/lib/Rewrite/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
set(LLVM_LINK_COMPONENTS
22
Core
33
DebugInfoDWARF
4-
DebugInfoDWARFLowLevel
54
JITLink
65
MC
76
Object

bolt/lib/Rewrite/DWARFRewriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
2525
#include "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
2626
#include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
27+
#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
2728
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
2829
#include "llvm/DebugInfo/DWARF/DWARFTypeUnit.h"
2930
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
30-
#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
3131
#include "llvm/MC/MCAsmBackend.h"
3232
#include "llvm/MC/MCAssembler.h"
3333
#include "llvm/MC/MCObjectWriter.h"

compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ $LINK $LIBCXX_ARCHIVE_DIR/libc++.a \
174174
$LLVM_BUILD/lib/libLLVMObject.a \
175175
$LLVM_BUILD/lib/libLLVMBinaryFormat.a \
176176
$LLVM_BUILD/lib/libLLVMDebugInfoDWARF.a \
177-
$LLVM_BUILD/lib/libLLVMDebugInfoDWARFLowLevel.a \
178177
$LLVM_BUILD/lib/libLLVMDebugInfoGSYM.a \
179178
$LLVM_BUILD/lib/libLLVMSupport.a \
180179
$LLVM_BUILD/lib/libLLVMDebugInfoPDB.a \

lldb/source/Expression/DWARFExpression.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@
3636
#include "lldb/Target/StackID.h"
3737
#include "lldb/Target/Target.h"
3838
#include "lldb/Target/Thread.h"
39-
#include "llvm/DebugInfo/DWARF/DWARFExpressionPrinter.h"
40-
#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
39+
#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
4140

4241
using namespace lldb;
4342
using namespace lldb_private;
@@ -82,7 +81,7 @@ void DWARFExpression::DumpLocation(Stream *s, lldb::DescriptionLevel level,
8281
llvm::DIDumpOptions DumpOpts;
8382
DumpOpts.GetNameForDWARFReg = GetRegName;
8483
llvm::DWARFExpression E(m_data.GetAsLLVM(), m_data.GetAddressByteSize());
85-
llvm::printDwarfExpression(&E, s->AsRawOstream(), DumpOpts, nullptr);
84+
llvm::DWARFExpressionPrinter::print(&E, s->AsRawOstream(), DumpOpts, nullptr);
8685
}
8786

8887
RegisterKind DWARFExpression::GetRegisterKind() const { return m_reg_kind; }

lldb/source/Symbol/UnwindPlan.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
#include "lldb/Utility/Log.h"
1818
#include "llvm/ADT/STLExtras.h"
1919
#include "llvm/DebugInfo/DIContext.h"
20-
#include "llvm/DebugInfo/DWARF/DWARFExpressionPrinter.h"
21-
#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
20+
#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
2221
#include <optional>
2322

2423
using namespace lldb;
@@ -90,7 +89,8 @@ static void DumpDWARFExpr(Stream &s, llvm::ArrayRef<uint8_t> expr, Thread *threa
9089
order_and_width->second);
9190
llvm::DWARFExpression E(data, order_and_width->second,
9291
llvm::dwarf::DWARF32);
93-
printDwarfExpression(&E, s.AsRawOstream(), llvm::DIDumpOptions(), nullptr);
92+
llvm::DWARFExpressionPrinter::print(&E, s.AsRawOstream(),
93+
llvm::DIDumpOptions(), nullptr);
9494
} else
9595
s.PutCString("dwarf-expr");
9696
}

lldb/unittests/Symbol/PostfixExpressionTest.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
#include "lldb/Utility/StreamString.h"
1212
#include "llvm/ADT/StringExtras.h"
1313
#include "llvm/DebugInfo/DIContext.h"
14-
#include "llvm/DebugInfo/DWARF/DWARFExpressionPrinter.h"
15-
#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
14+
#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
1615
#include "llvm/Support/FormatVariadic.h"
1716
#include "llvm/Support/raw_ostream.h"
1817
#include "gmock/gmock.h"
@@ -161,7 +160,7 @@ static std::string ParseAndGenerateDWARF(llvm::StringRef expr) {
161160
std::string result;
162161
llvm::raw_string_ostream os(result);
163162
llvm::DWARFExpression E(extractor, addr_size, llvm::dwarf::DWARF32);
164-
llvm::printDwarfExpression(&E, os, llvm::DIDumpOptions(), nullptr);
163+
llvm::DWARFExpressionPrinter::print(&E, os, llvm::DIDumpOptions(), nullptr);
165164
return result;
166165
}
167166

lldb/unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
#include "lldb/Utility/StreamBuffer.h"
1717
#include "lldb/Utility/StreamString.h"
1818
#include "llvm/DebugInfo/DIContext.h"
19-
#include "llvm/DebugInfo/DWARF/DWARFExpressionPrinter.h"
20-
#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
19+
#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
2120

2221
using namespace lldb;
2322
using namespace lldb_private;
@@ -41,7 +40,7 @@ CheckValidProgramTranslation(llvm::StringRef fpo_program,
4140
std::string result;
4241
llvm::raw_string_ostream os(result);
4342
llvm::DWARFExpression E(extractor, /*AddressSize=*/4, llvm::dwarf::DWARF32);
44-
llvm::printDwarfExpression(&E, os, llvm::DIDumpOptions(), nullptr);
43+
llvm::DWARFExpressionPrinter::print(&E, os, llvm::DIDumpOptions(), nullptr);
4544

4645
// actual check
4746
ASSERT_EQ(expected_dwarf_expression, result);

llvm/include/llvm/DWARFLinker/AddressesMap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
#include "llvm/ADT/AddressRanges.h"
1313
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
1414
#include "llvm/DebugInfo/DWARF/DWARFDie.h"
15+
#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
1516
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
16-
#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
1717
#include <cstdint>
1818

1919
namespace llvm {

llvm/include/llvm/DWARFLinker/Classic/DWARFLinker.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "llvm/DebugInfo/DWARF/DWARFDebugLine.h"
2121
#include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
2222
#include "llvm/DebugInfo/DWARF/DWARFDie.h"
23-
#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
23+
#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
2424
#include "llvm/Support/Compiler.h"
2525
#include <map>
2626

llvm/include/llvm/DWARFLinker/DWARFLinkerBase.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "llvm/DebugInfo/DWARF/DWARFDebugLine.h"
1717
#include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
1818
#include "llvm/DebugInfo/DWARF/DWARFDie.h"
19-
#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
19+
#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
2020
#include "llvm/Support/Compiler.h"
2121
#include <map>
2222
namespace llvm {

llvm/include/llvm/DebugInfo/DWARF/DWARFCFIPrinter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#ifndef LLVM_DEBUGINFO_DWARF_DWARFCFIPRINTER_H
1010
#define LLVM_DEBUGINFO_DWARF_DWARFCFIPRINTER_H
1111

12-
#include "llvm/DebugInfo/DWARF/LowLevel/DWARFCFIProgram.h"
12+
#include "llvm/DebugInfo/DWARF/DWARFCFIProgram.h"
1313
#include "llvm/Support/Compiler.h"
1414

1515
namespace llvm {

llvm/include/llvm/DebugInfo/DWARF/LowLevel/DWARFCFIProgram.h renamed to llvm/include/llvm/DebugInfo/DWARF/DWARFCFIProgram.h

Lines changed: 4 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
#include "llvm/ADT/ArrayRef.h"
1313
#include "llvm/ADT/SmallString.h"
1414
#include "llvm/ADT/iterator.h"
15-
#include "llvm/DebugInfo/DWARF/LowLevel/DWARFDataExtractorSimple.h"
16-
#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
15+
#include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
16+
#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
1717
#include "llvm/Support/Compiler.h"
1818
#include "llvm/Support/Error.h"
1919
#include "llvm/TargetParser/Triple.h"
@@ -78,150 +78,8 @@ class CFIProgram {
7878
/// starting at *Offset and ending at EndOffset. *Offset is updated
7979
/// to EndOffset upon successful parsing, or indicates the offset
8080
/// where a problem occurred in case an error is returned.
81-
template <typename T>
82-
LLVM_ABI Error parse(DWARFDataExtractorBase<T> &Data, uint64_t *Offset,
83-
uint64_t EndOffset) {
84-
// See DWARF standard v3, section 7.23
85-
const uint8_t DWARF_CFI_PRIMARY_OPCODE_MASK = 0xc0;
86-
const uint8_t DWARF_CFI_PRIMARY_OPERAND_MASK = 0x3f;
87-
88-
DataExtractor::Cursor C(*Offset);
89-
while (C && C.tell() < EndOffset) {
90-
uint8_t Opcode = Data.getRelocatedValue(C, 1);
91-
if (!C)
92-
break;
93-
94-
// Some instructions have a primary opcode encoded in the top bits.
95-
if (uint8_t Primary = Opcode & DWARF_CFI_PRIMARY_OPCODE_MASK) {
96-
// If it's a primary opcode, the first operand is encoded in the
97-
// bottom bits of the opcode itself.
98-
uint64_t Op1 = Opcode & DWARF_CFI_PRIMARY_OPERAND_MASK;
99-
switch (Primary) {
100-
case DW_CFA_advance_loc:
101-
case DW_CFA_restore:
102-
addInstruction(Primary, Op1);
103-
break;
104-
case DW_CFA_offset:
105-
addInstruction(Primary, Op1, Data.getULEB128(C));
106-
break;
107-
default:
108-
llvm_unreachable("invalid primary CFI opcode");
109-
}
110-
continue;
111-
}
112-
113-
// Extended opcode - its value is Opcode itself.
114-
switch (Opcode) {
115-
default:
116-
return createStringError(errc::illegal_byte_sequence,
117-
"invalid extended CFI opcode 0x%" PRIx8,
118-
Opcode);
119-
case DW_CFA_nop:
120-
case DW_CFA_remember_state:
121-
case DW_CFA_restore_state:
122-
case DW_CFA_GNU_window_save:
123-
case DW_CFA_AARCH64_negate_ra_state_with_pc:
124-
// No operands
125-
addInstruction(Opcode);
126-
break;
127-
case DW_CFA_set_loc:
128-
// Operands: Address
129-
addInstruction(Opcode, Data.getRelocatedAddress(C));
130-
break;
131-
case DW_CFA_advance_loc1:
132-
// Operands: 1-byte delta
133-
addInstruction(Opcode, Data.getRelocatedValue(C, 1));
134-
break;
135-
case DW_CFA_advance_loc2:
136-
// Operands: 2-byte delta
137-
addInstruction(Opcode, Data.getRelocatedValue(C, 2));
138-
break;
139-
case DW_CFA_advance_loc4:
140-
// Operands: 4-byte delta
141-
addInstruction(Opcode, Data.getRelocatedValue(C, 4));
142-
break;
143-
case DW_CFA_restore_extended:
144-
case DW_CFA_undefined:
145-
case DW_CFA_same_value:
146-
case DW_CFA_def_cfa_register:
147-
case DW_CFA_def_cfa_offset:
148-
case DW_CFA_GNU_args_size:
149-
// Operands: ULEB128
150-
addInstruction(Opcode, Data.getULEB128(C));
151-
break;
152-
case DW_CFA_def_cfa_offset_sf:
153-
// Operands: SLEB128
154-
addInstruction(Opcode, Data.getSLEB128(C));
155-
break;
156-
case DW_CFA_LLVM_def_aspace_cfa:
157-
case DW_CFA_LLVM_def_aspace_cfa_sf: {
158-
auto RegNum = Data.getULEB128(C);
159-
auto CfaOffset = Opcode == DW_CFA_LLVM_def_aspace_cfa
160-
? Data.getULEB128(C)
161-
: Data.getSLEB128(C);
162-
auto AddressSpace = Data.getULEB128(C);
163-
addInstruction(Opcode, RegNum, CfaOffset, AddressSpace);
164-
break;
165-
}
166-
case DW_CFA_offset_extended:
167-
case DW_CFA_register:
168-
case DW_CFA_def_cfa:
169-
case DW_CFA_val_offset: {
170-
// Operands: ULEB128, ULEB128
171-
// Note: We can not embed getULEB128 directly into function
172-
// argument list. getULEB128 changes Offset and order of evaluation
173-
// for arguments is unspecified.
174-
uint64_t op1 = Data.getULEB128(C);
175-
uint64_t op2 = Data.getULEB128(C);
176-
addInstruction(Opcode, op1, op2);
177-
break;
178-
}
179-
case DW_CFA_offset_extended_sf:
180-
case DW_CFA_def_cfa_sf:
181-
case DW_CFA_val_offset_sf: {
182-
// Operands: ULEB128, SLEB128
183-
// Note: see comment for the previous case
184-
uint64_t op1 = Data.getULEB128(C);
185-
uint64_t op2 = (uint64_t)Data.getSLEB128(C);
186-
addInstruction(Opcode, op1, op2);
187-
break;
188-
}
189-
case DW_CFA_def_cfa_expression: {
190-
uint64_t ExprLength = Data.getULEB128(C);
191-
addInstruction(Opcode, 0);
192-
StringRef Expression = Data.getBytes(C, ExprLength);
193-
194-
DataExtractor Extractor(Expression, Data.isLittleEndian(),
195-
Data.getAddressSize());
196-
// Note. We do not pass the DWARF format to DWARFExpression, because
197-
// DW_OP_call_ref, the only operation which depends on the format, is
198-
// prohibited in call frame instructions, see sec. 6.4.2 in DWARFv5.
199-
Instructions.back().Expression =
200-
DWARFExpression(Extractor, Data.getAddressSize());
201-
break;
202-
}
203-
case DW_CFA_expression:
204-
case DW_CFA_val_expression: {
205-
uint64_t RegNum = Data.getULEB128(C);
206-
addInstruction(Opcode, RegNum, 0);
207-
208-
uint64_t BlockLength = Data.getULEB128(C);
209-
StringRef Expression = Data.getBytes(C, BlockLength);
210-
DataExtractor Extractor(Expression, Data.isLittleEndian(),
211-
Data.getAddressSize());
212-
// Note. We do not pass the DWARF format to DWARFExpression, because
213-
// DW_OP_call_ref, the only operation which depends on the format, is
214-
// prohibited in call frame instructions, see sec. 6.4.2 in DWARFv5.
215-
Instructions.back().Expression =
216-
DWARFExpression(Extractor, Data.getAddressSize());
217-
break;
218-
}
219-
}
220-
}
221-
222-
*Offset = C.tell();
223-
return C.takeError();
224-
}
81+
LLVM_ABI Error parse(DWARFDataExtractor Data, uint64_t *Offset,
82+
uint64_t EndOffset);
22583

22684
void addInstruction(const Instruction &I) { Instructions.push_back(I); }
22785

llvm/include/llvm/DebugInfo/DWARF/DWARFDataExtractor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
#define LLVM_DEBUGINFO_DWARF_DWARFDATAEXTRACTOR_H
1111

1212
#include "llvm/BinaryFormat/Dwarf.h"
13+
#include "llvm/DebugInfo/DWARF/DWARFDataExtractorSimple.h"
1314
#include "llvm/DebugInfo/DWARF/DWARFObject.h"
1415
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
1516
#include "llvm/DebugInfo/DWARF/DWARFSection.h"
16-
#include "llvm/DebugInfo/DWARF/LowLevel/DWARFDataExtractorSimple.h"
1717
#include "llvm/Support/Compiler.h"
1818

1919
namespace llvm {

llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
#include "llvm/ADT/ArrayRef.h"
1313
#include "llvm/ADT/SmallString.h"
1414
#include "llvm/ADT/iterator.h"
15-
#include "llvm/DebugInfo/DWARF/LowLevel/DWARFCFIProgram.h"
16-
#include "llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
15+
#include "llvm/DebugInfo/DWARF/DWARFCFIProgram.h"
16+
#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
1717
#include "llvm/Support/Compiler.h"
1818
#include "llvm/Support/Error.h"
1919
#include "llvm/TargetParser/Triple.h"

0 commit comments

Comments
 (0)