From df62e731ea92515d6725a0cf3120454c0d1b4ace Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Wed, 6 Jul 2016 23:16:24 +0000 Subject: [PATCH] "frame variable" and "target variable" shouldn't allow us to get the address of bitfields. "frame variable" and "target variable" are trying to emulate the expression parser when doing things like: (lldb) frame variable &my_struct.my_bitfield And since the expression parser doesn't allow this, we shouldn't allow "frame variable" or "target variable" to succeed. llvm-svn: 274703 --- lldb/source/Core/ValueObject.cpp | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index a74599e00df0..3e0a31833ef6 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -834,20 +834,20 @@ ValueObject::CreateChildAtIndex (size_t idx, bool synthetic_array_member, int32_ ExecutionContext exe_ctx (GetExecutionContextRef()); - child_compiler_type = GetCompilerType().GetChildCompilerTypeAtIndex (&exe_ctx, - idx, - transparent_pointers, - omit_empty_base_classes, - ignore_array_bounds, - child_name_str, - child_byte_size, - child_byte_offset, - child_bitfield_bit_size, - child_bitfield_bit_offset, - child_is_base_class, - child_is_deref_of_parent, - this, - language_flags); + child_compiler_type = GetCompilerType().GetChildCompilerTypeAtIndex(&exe_ctx, + idx, + transparent_pointers, + omit_empty_base_classes, + ignore_array_bounds, + child_name_str, + child_byte_size, + child_byte_offset, + child_bitfield_bit_size, + child_bitfield_bit_offset, + child_is_base_class, + child_is_deref_of_parent, + this, + language_flags); if (child_compiler_type) { if (synthetic_index) @@ -1789,6 +1789,10 @@ ValueObject::DumpPrintableRepresentation(Stream& s, addr_t ValueObject::GetAddressOf (bool scalar_is_load_address, AddressType *address_type) { + // Can't take address of a bitfield + if (IsBitfield()) + return LLDB_INVALID_ADDRESS; + if (!UpdateValueIfNeeded(false)) return LLDB_INVALID_ADDRESS;