summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2018-06-21 17:58:06 +0000
committerGreg Clayton <gclayton@apple.com>2018-06-21 17:58:06 +0000
commit59a1be3acf40663f078317cb0877def00a6cb673 (patch)
tree16fdececcbb8fdc42f90b0c19d854f57a59f4ef9 /lldb/source/Expression
parent3244537a3cb30e63fb49844db3afe132ff7defb4 (diff)
downloadbcm5719-llvm-59a1be3acf40663f078317cb0877def00a6cb673.tar.gz
bcm5719-llvm-59a1be3acf40663f078317cb0877def00a6cb673.zip
Fix an issue where DW_OP_deref might be dereferencing a file address. Convert the file address to a load address so this works.
https://bugs.llvm.org/show_bug.cgi?id=36871 llvm-svn: 335263
Diffstat (limited to 'lldb/source/Expression')
-rw-r--r--lldb/source/Expression/DWARFExpression.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp
index c851e052a52..2837caafd04 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -15,6 +15,7 @@
// C++ Includes
#include <vector>
+#include "lldb/Core/Module.h"
#include "lldb/Core/RegisterValue.h"
#include "lldb/Core/Scalar.h"
#include "lldb/Core/Value.h"
@@ -1452,6 +1453,33 @@ bool DWARFExpression::Evaluate(
stack.back().GetScalar() = ptr;
stack.back().ClearContext();
} break;
+ case Value::eValueTypeFileAddress: {
+ auto file_addr = stack.back().GetScalar().ULongLong(
+ LLDB_INVALID_ADDRESS);
+ if (!module_sp) {
+ if (error_ptr)
+ error_ptr->SetErrorStringWithFormat(
+ "need module to resolve file address for DW_OP_deref");
+ return false;
+ }
+ Address so_addr;
+ if (!module_sp->ResolveFileAddress(file_addr, so_addr)) {
+ if (error_ptr)
+ error_ptr->SetErrorStringWithFormat(
+ "failed to resolve file address in module");
+ return false;
+ }
+ addr_t load_Addr = so_addr.GetLoadAddress(exe_ctx->GetTargetPtr());
+ if (load_Addr == LLDB_INVALID_ADDRESS) {
+ if (error_ptr)
+ error_ptr->SetErrorStringWithFormat(
+ "failed to resolve load address");
+ return false;
+ }
+ stack.back().GetScalar() = load_Addr;
+ stack.back().SetValueType(Value::eValueTypeLoadAddress);
+ // Fall through to load address code below...
+ } LLVM_FALLTHROUGH;
case Value::eValueTypeLoadAddress:
if (exe_ctx) {
if (process) {
OpenPOWER on IntegriCloud