diff options
| author | Adrian Prantl <aprantl@apple.com> | 2018-05-03 23:32:47 +0000 |
|---|---|---|
| committer | Adrian Prantl <aprantl@apple.com> | 2018-05-03 23:32:47 +0000 |
| commit | b51804e0d8c0ecbc5befda89b376e189c652f6b3 (patch) | |
| tree | beb28a1c6b8d4aa4c9ed926ef668bd61acfdb495 /lldb/source/Expression | |
| parent | 3835320617d7c37e8ac545b0b7828db2a57d46a4 (diff) | |
| download | bcm5719-llvm-b51804e0d8c0ecbc5befda89b376e189c652f6b3.tar.gz bcm5719-llvm-b51804e0d8c0ecbc5befda89b376e189c652f6b3.zip | |
DWARFExpression: Convert file addresses to load addresses early on.
This is a change that only affects Swift and is NFC for the language
plugins on llvm.org. In Swift, we can have global variables with a
location such as DW_OP_addr <addr> DW_OP_deref. The DWARF expression
evaluator doesn't know how to apply a DW_OP_deref to a file address,
but at the very end we convert the file address into a load address.
This patch moves the file->load address conversion to right after the
result of the DW_OP_addr is pushed onto the stack so that a subsequent
DW_OP_deref (and potentially other operations) can be interpreted.
rdar://problem/39767528
Differential revision: https://reviews.llvm.org/D46362
llvm-svn: 331492
Diffstat (limited to 'lldb/source/Expression')
| -rw-r--r-- | lldb/source/Expression/DWARFExpression.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp index 71495715e75..8f54bf37ea0 100644 --- a/lldb/source/Expression/DWARFExpression.cpp +++ b/lldb/source/Expression/DWARFExpression.cpp @@ -1374,6 +1374,7 @@ bool DWARFExpression::Evaluate( } log->Printf("0x%8.8" PRIx64 ": %s", op_offset, DW_OP_value_to_name(op)); } + switch (op) { //---------------------------------------------------------------------- // The DW_OP_addr operation has a single operand that encodes a machine @@ -1382,6 +1383,11 @@ bool DWARFExpression::Evaluate( case DW_OP_addr: stack.push_back(Scalar(opcodes.GetAddress(&offset))); stack.back().SetValueType(Value::eValueTypeFileAddress); + // Convert the file address to a load address, so subsequent + // DWARF operators can operate on it. + if (frame) + stack.back().ConvertToLoadAddress(module_sp.get(), + frame->CalculateTarget().get()); break; //---------------------------------------------------------------------- |

