Skip to content

Commit 5108154

Browse files
committed
[LLDB] Fix ValueObject::AddressOf() return value
1 parent 64737ce commit 5108154

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lldb/source/ValueObject/ValueObject.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2966,10 +2966,13 @@ ValueObjectSP ValueObject::AddressOf(Status &error) {
29662966
std::string name(1, '&');
29672967
name.append(m_name.AsCString(""));
29682968
ExecutionContext exe_ctx(GetExecutionContextRef());
2969+
2970+
lldb::DataBufferSP buffer(
2971+
new lldb_private::DataBufferHeap(&addr, sizeof(lldb::addr_t)));
29692972
m_addr_of_valobj_sp = ValueObjectConstResult::Create(
29702973
exe_ctx.GetBestExecutionContextScope(),
2971-
compiler_type.GetPointerType(), ConstString(name.c_str()), addr,
2972-
eAddressTypeInvalid, m_data.GetAddressByteSize());
2974+
compiler_type.GetPointerType(), ConstString(name.c_str()), buffer,
2975+
endian::InlHostByteOrder(), exe_ctx.GetAddressByteSize());
29732976
}
29742977
} break;
29752978
default:

lldb/test/API/python_api/sbvalue_const_addrof/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ int main (int argc, char const *argv[], char const *envp[])
2929
{
3030
printf ("g_thread_list is %p\n", g_thread_list_ptr);
3131
return 0; //% v = self.dbg.GetSelectedTarget().FindFirstGlobalVariable('g_thread_list_ptr')
32+
//% self.assertTrue(v.AddressOf().IsValid())
33+
//% self.assertFalse(v.AddressOf().AddressOf().IsValid())
3234
//% v_gla = v.GetChildMemberWithName('regs').GetLoadAddress()
3335
//% v_aof = v.GetChildMemberWithName('regs').AddressOf().GetValueAsUnsigned(lldb.LLDB_INVALID_ADDRESS)
3436
//% expr = '(%s)0x%x' % (v.GetType().GetName(), v.GetValueAsUnsigned(0))

0 commit comments

Comments
 (0)