[Bug 23299] New: transparent_pointers not working

Bug ID 23299
Summary transparent_pointers not working
Product lldb
Version unspecified
Hardware PC
OS All
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@cs.uiuc.edu
Reporter ribrdb@google.com
Classification Unclassified

While working on a LanguageRuntime plugin for go, I noticed some strangeness
with ValueObjects for pointers.
If I use valobj.GetChildMemberWithName(...), it returns a child, but with the
wrong address so the value is unusable.
However, if I use valobj.Dereference()->GetChildMemberWithName(...) I can read
the data.

I think I've tracked this down to an interaction between
ValueObject::GetPointerValue and ValueObjectChild::UpdateValue:
 - UpdateValue performs pointer arithmetic, saves the result in
m_value.GetScalar(), and sets the value type to an address (could be Host, Load
or FileAddress).
 - However, GetPointerValue only uses m_value if the value type is
eValueTypeScalar or eValueTypeVector.

So at least in the case where the offset is != 0, GetPointerValue seems to be
returning something wrong.
Simply changing the value type to scalar doesn't work, because other code is
expecting it to be some sort of address.

Unfortunately I haven't found a way to reproduce this using the public api so I
can't write a test for it.