summaryrefslogtreecommitdiffstats
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.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp b/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
index 3417fee14c0..16058e461f4 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
@@ -104,7 +104,9 @@ static DescVector getDescriptions() {
static DWARFExpression::Operation::Description getOpDesc(unsigned OpCode) {
// FIXME: Make this constexpr once all compilers are smart enough to do it.
static DescVector Descriptions = getDescriptions();
- assert(OpCode < Descriptions.size());
+ // Handle possible corrupted or unsupported operation.
+ if (OpCode >= Descriptions.size())
+ return {};
return Descriptions[OpCode];
}
@@ -117,8 +119,10 @@ bool DWARFExpression::Operation::extract(DataExtractor Data, uint16_t Version,
Opcode = Data.getU8(&Offset);
Desc = getOpDesc(Opcode);
- if (Desc.Version == Operation::DwarfNA)
+ if (Desc.Version == Operation::DwarfNA) {
+ EndOffset = Offset;
return false;
+ }
for (unsigned Operand = 0; Operand < 2; ++Operand) {
unsigned Size = Desc.Op[Operand];
@@ -221,7 +225,7 @@ bool DWARFExpression::Operation::print(raw_ostream &OS,
const MCRegisterInfo *RegInfo,
bool isEH) {
if (Error) {
- OS << "decoding error.";
+ OS << "<decoding error>";
return false;
}
OpenPOWER on IntegriCloud