diff options
| author | Enrico Granata <egranata@apple.com> | 2013-04-30 20:45:04 +0000 |
|---|---|---|
| committer | Enrico Granata <egranata@apple.com> | 2013-04-30 20:45:04 +0000 |
| commit | 82fabf89b493625df34b8ee5bea48a52d8b48179 (patch) | |
| tree | 4475aea2e38644ff2070f4a26f2d94e598a8c085 /lldb/source/Core/ValueObject.cpp | |
| parent | 0b914fe8395caa6ab1a11d829207d693e43fb957 (diff) | |
| download | bcm5719-llvm-82fabf89b493625df34b8ee5bea48a52d8b48179.tar.gz bcm5719-llvm-82fabf89b493625df34b8ee5bea48a52d8b48179.zip | |
<rdar://problem/13695846>
Enabling LLDB to write to variables that are stored in registers
Previously, this would not work since the Value's Context loses the notion of the data being in a register
We now store an "original" context that comes out of DWARF parsing, and use that context's data when attempting a write
llvm-svn: 180803
Diffstat (limited to 'lldb/source/Core/ValueObject.cpp')
| -rw-r--r-- | lldb/source/Core/ValueObject.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index 6105a8ab31e..2692ecc8bbc 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -401,37 +401,49 @@ ValueObject::GetName() const const char * ValueObject::GetLocationAsCString () { + return GetLocationAsCStringImpl(m_value, + m_data); +} + +const char * +ValueObject::GetLocationAsCStringImpl (const Value& value, + const DataExtractor& data) +{ if (UpdateValueIfNeeded(false)) { if (m_location_str.empty()) { StreamString sstr; - - switch (m_value.GetValueType()) + + Value::ValueType value_type = value.GetValueType(); + + switch (value_type) { case Value::eValueTypeScalar: case Value::eValueTypeVector: - if (m_value.GetContextType() == Value::eContextTypeRegisterInfo) + if (value.GetContextType() == Value::eContextTypeRegisterInfo) { - RegisterInfo *reg_info = m_value.GetRegisterInfo(); + RegisterInfo *reg_info = value.GetRegisterInfo(); if (reg_info) { if (reg_info->name) m_location_str = reg_info->name; else if (reg_info->alt_name) m_location_str = reg_info->alt_name; - - m_location_str = (reg_info->encoding == lldb::eEncodingVector) ? "vector" : "scalar"; + if (m_location_str.empty()) + m_location_str = (reg_info->encoding == lldb::eEncodingVector) ? "vector" : "scalar"; } } + if (m_location_str.empty()) + m_location_str = (value_type == Value::eValueTypeVector) ? "vector" : "scalar"; break; case Value::eValueTypeLoadAddress: case Value::eValueTypeFileAddress: case Value::eValueTypeHostAddress: { - uint32_t addr_nibble_size = m_data.GetAddressByteSize() * 2; - sstr.Printf("0x%*.*llx", addr_nibble_size, addr_nibble_size, m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS)); + uint32_t addr_nibble_size = data.GetAddressByteSize() * 2; + sstr.Printf("0x%*.*llx", addr_nibble_size, addr_nibble_size, value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS)); m_location_str.swap(sstr.GetString()); } break; |

