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/Core/ValueObjectVariable.cpp | |
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/Core/ValueObjectVariable.cpp')
-rw-r--r-- | lldb/source/Core/ValueObjectVariable.cpp | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/lldb/source/Core/ValueObjectVariable.cpp b/lldb/source/Core/ValueObjectVariable.cpp index e08963210ec..95b58b3336c 100644 --- a/lldb/source/Core/ValueObjectVariable.cpp +++ b/lldb/source/Core/ValueObjectVariable.cpp @@ -235,25 +235,8 @@ bool ValueObjectVariable::UpdateValue() { // m_data. Make sure this type has a value before we try and read it // If we have a file address, convert it to a load address if we can. - if (value_type == Value::eValueTypeFileAddress && process_is_alive) { - lldb::addr_t file_addr = - m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS); - if (file_addr != LLDB_INVALID_ADDRESS) { - SymbolContext var_sc; - variable->CalculateSymbolContext(&var_sc); - if (var_sc.module_sp) { - ObjectFile *objfile = var_sc.module_sp->GetObjectFile(); - if (objfile) { - Address so_addr(file_addr, objfile->GetSectionList()); - lldb::addr_t load_addr = so_addr.GetLoadAddress(target); - if (load_addr != LLDB_INVALID_ADDRESS) { - m_value.SetValueType(Value::eValueTypeLoadAddress); - m_value.GetScalar() = load_addr; - } - } - } - } - } + if (value_type == Value::eValueTypeFileAddress && process_is_alive) + m_value.ConvertToLoadAddress(GetModule().get(), target); if (!CanProvideValue()) { // this value object represents an aggregate type whose children have |