diff options
Diffstat (limited to 'source/Core/ValueObjectChild.cpp')
-rw-r--r-- | source/Core/ValueObjectChild.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/source/Core/ValueObjectChild.cpp b/source/Core/ValueObjectChild.cpp index 01f2e20dd0bc..6b4ada154d68 100644 --- a/source/Core/ValueObjectChild.cpp +++ b/source/Core/ValueObjectChild.cpp @@ -175,6 +175,30 @@ bool ValueObjectChild::UpdateValue() { // Set this object's scalar value to the address of its value by // adding its byte offset to the parent address m_value.GetScalar() += GetByteOffset(); + + // If a bitfield doesn't fit into the child_byte_size'd + // window at child_byte_offset, move the window forward + // until it fits. The problem here is that Value has no + // notion of bitfields and thus the Value's DataExtractor + // is sized like the bitfields CompilerType; a sequence of + // bitfields, however, can be larger than their underlying + // type. + if (m_bitfield_bit_offset) { + const bool thread_and_frame_only_if_stopped = true; + ExecutionContext exe_ctx(GetExecutionContextRef().Lock( + thread_and_frame_only_if_stopped)); + if (auto type_bit_size = GetCompilerType().GetBitSize( + exe_ctx.GetBestExecutionContextScope())) { + uint64_t bitfield_end = + m_bitfield_bit_size + m_bitfield_bit_offset; + if (bitfield_end > *type_bit_size) { + uint64_t overhang_bytes = + (bitfield_end - *type_bit_size + 7) / 8; + m_value.GetScalar() += overhang_bytes; + m_bitfield_bit_offset -= overhang_bytes * 8; + } + } + } } } break; @@ -203,7 +227,7 @@ bool ValueObjectChild::UpdateValue() { if (GetCompilerType().GetTypeInfo() & lldb::eTypeHasValue) { Value &value = is_instance_ptr_base ? m_parent->GetValue() : m_value; m_error = - value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get()); + value.GetValueAsData(&exe_ctx, m_data, GetModule().get()); } else { m_error.Clear(); // No value so nothing to read... } |