[Lldb-commits] [lldb] 585e7a3 - Diagnose unhandled cases in DW_OP_deref
Adrian Prantl via lldb-commits
lldb-commits at lists.llvm.org
Wed Feb 10 17:27:12 PST 2021
Author: Adrian Prantl
Date: 2021-02-10T17:27:02-08:00
New Revision: 585e7a359d250cc112917373dc4ae4f5f9a16647
URL: https://github.com/llvm/llvm-project/commit/585e7a359d250cc112917373dc4ae4f5f9a16647
DIFF: https://github.com/llvm/llvm-project/commit/585e7a359d250cc112917373dc4ae4f5f9a16647.diff
LOG: Diagnose unhandled cases in DW_OP_deref
Added:
Modified:
lldb/source/Expression/DWARFExpression.cpp
lldb/unittests/Expression/DWARFExpressionTest.cpp
Removed:
################################################################################
diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp
index c30fdf565cd5..e54624dea06a 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -1100,7 +1100,9 @@ bool DWARFExpression::Evaluate(
break;
default:
- break;
+ if (error_ptr)
+ error_ptr->SetErrorString("Unhandled value type for DW_OP_deref.\n");
+ return false;
}
} break;
diff --git a/lldb/unittests/Expression/DWARFExpressionTest.cpp b/lldb/unittests/Expression/DWARFExpressionTest.cpp
index 37bd900cb9b5..5f2da7070e06 100644
--- a/lldb/unittests/Expression/DWARFExpressionTest.cpp
+++ b/lldb/unittests/Expression/DWARFExpressionTest.cpp
@@ -276,3 +276,7 @@ TEST(DWARFExpression, DW_OP_unknown) {
llvm::FailedWithMessage(
"Unhandled opcode DW_OP_unknown_ff in DWARFExpression"));
}
+
+TEST(DWARFExpression, DW_OP_deref) {
+ EXPECT_THAT_EXPECTED(Evaluate({DW_OP_lit0, DW_OP_deref}), llvm::Failed());
+}
More information about the lldb-commits
mailing list