summaryrefslogtreecommitdiff
path: root/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp b/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
index 811716111be5..4b9be85f6885 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
@@ -174,7 +174,10 @@ bool DWARFExpression::Operation::extract(DataExtractor Data,
case Operation::WasmLocationArg:
assert(Operand == 1);
switch (Operands[0]) {
- case 0: case 1: case 2:
+ case 0:
+ case 1:
+ case 2:
+ case 4:
Operands[Operand] = Data.getULEB128(&Offset);
break;
case 3: // global as uint32
@@ -294,8 +297,11 @@ bool DWARFExpression::Operation::print(raw_ostream &OS, DIDumpOptions DumpOpts,
} else if (Size == Operation::WasmLocationArg) {
assert(Operand == 1);
switch (Operands[0]) {
- case 0: case 1: case 2:
+ case 0:
+ case 1:
+ case 2:
case 3: // global as uint32
+ case 4:
OS << format(" 0x%" PRIx64, Operands[Operand]);
break;
default: assert(false);
@@ -319,6 +325,10 @@ void DWARFExpression::print(raw_ostream &OS, DIDumpOptions DumpOpts,
const MCRegisterInfo *RegInfo, DWARFUnit *U,
bool IsEH) const {
uint32_t EntryValExprSize = 0;
+ uint64_t EntryValStartOffset = 0;
+ if (Data.getData().empty())
+ OS << "<empty>";
+
for (auto &Op : *this) {
if (!Op.print(OS, DumpOpts, this, RegInfo, U, IsEH)) {
uint64_t FailOffset = Op.getEndOffset();
@@ -331,11 +341,12 @@ void DWARFExpression::print(raw_ostream &OS, DIDumpOptions DumpOpts,
Op.getCode() == DW_OP_GNU_entry_value) {
OS << "(";
EntryValExprSize = Op.getRawOperand(0);
+ EntryValStartOffset = Op.getEndOffset();
continue;
}
if (EntryValExprSize) {
- EntryValExprSize--;
+ EntryValExprSize -= Op.getEndOffset() - EntryValStartOffset;
if (EntryValExprSize == 0)
OS << ")";
}
@@ -501,4 +512,10 @@ bool DWARFExpression::printCompact(raw_ostream &OS, const MCRegisterInfo &MRI) {
return printCompactDWARFExpr(OS, begin(), end(), MRI);
}
+bool DWARFExpression::operator==(const DWARFExpression &RHS) const {
+ if (AddressSize != RHS.AddressSize || Format != RHS.Format)
+ return false;
+ return Data.getData() == RHS.Data.getData();
+}
+
} // namespace llvm