diff options
author | Johnny Chen <johnny.chen@apple.com> | 2011-12-16 23:04:52 +0000 |
---|---|---|
committer | Johnny Chen <johnny.chen@apple.com> | 2011-12-16 23:04:52 +0000 |
commit | b456b792e04c178df5ff8fca7c2320b2efdcd31e (patch) | |
tree | 6d7cb532c878d199d090b610e2527af4c997258f /lldb/source/Core/ValueObjectConstResultImpl.cpp | |
parent | 9790187b6c4803fb0f47b6adf03fd5602292c210 (diff) | |
download | bcm5719-llvm-b456b792e04c178df5ff8fca7c2320b2efdcd31e.tar.gz bcm5719-llvm-b456b792e04c178df5ff8fca7c2320b2efdcd31e.zip |
http://llvm.org/bugs/show_bug.cgi?id=11588
valobj.AddressOf() returns None when an address is expected in a SyntheticChildrenProvider
Patch from Enrico Granata:
The problem was that the frozen object created by the expression parser was a copy of the contents of the StgClosure, rather than a pointer to it. Thus, the expression parser was correctly computing the result of the arithmetic&cast operation along with its address, but only saving it in the live object. This meant that the frozen copy acted as an address-less variable, hence the problem.
The fix attached to this email lets the expression parser store the "live address" in the frozen copy of the address when the object is built without a valid address of its own.
Doing so, along with delegating ValueObjectConstResult to calculate its own address when necessary, solves the issue. I have also added a new test case to check for regressions in this area, and checked that existing test cases pass correctly.
llvm-svn: 146768
Diffstat (limited to 'lldb/source/Core/ValueObjectConstResultImpl.cpp')
-rw-r--r-- | lldb/source/Core/ValueObjectConstResultImpl.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/lldb/source/Core/ValueObjectConstResultImpl.cpp b/lldb/source/Core/ValueObjectConstResultImpl.cpp index 119ba015590..afe050291b0 100644 --- a/lldb/source/Core/ValueObjectConstResultImpl.cpp +++ b/lldb/source/Core/ValueObjectConstResultImpl.cpp @@ -40,7 +40,8 @@ using namespace lldb_private; ValueObjectConstResultImpl::ValueObjectConstResultImpl (ValueObject* valobj, lldb::addr_t live_address) : m_impl_backend(valobj), - m_live_address(live_address), + m_live_address(live_address), + m_live_address_type(eAddressTypeLoad), m_load_addr_backend(), m_address_of_backend() { @@ -201,6 +202,26 @@ ValueObjectConstResultImpl::AddressOf (Error &error) return lldb::ValueObjectSP(); } +lldb::addr_t +ValueObjectConstResultImpl::GetAddressOf (bool scalar_is_load_address, + AddressType *address_type) +{ + + if (m_impl_backend == NULL) + return 0; + + if (m_live_address == LLDB_INVALID_ADDRESS) + { + return m_impl_backend->ValueObject::GetAddressOf (scalar_is_load_address, + address_type); + } + + if (address_type) + *address_type = m_live_address_type; + + return m_live_address; +} + size_t ValueObjectConstResultImpl::GetPointeeData (DataExtractor& data, uint32_t item_idx, |