[Lldb-commits] [PATCH] D138197: [lldb] Fix bitfield incorrectly printing when field crosses a storage unit

Charlie Keaney via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 17 03:32:08 PST 2022


CharKeaney created this revision.
CharKeaney added reviewers: DavidSpickett, simoncook, lewis-revill, edward-jones.
CharKeaney added a project: LLDB.
Herald added subscribers: JDevlieghere, kbarton, nemanjai.
Herald added a project: All.
CharKeaney requested review of this revision.
Herald added a subscriber: lldb-commits.

This patch resolves an issue where bitfields will not be
printed correctly if a field crosses a storage unit.

The issue is caused by lldb internally storing bitfield
field's offsets as unsigned rather than signed values.
Negative offsets can be created when a field crosses a
storage unit.

The issue is resolved by changing lldb's internal representation
for bitfield field offsets to be stored using signed values.
Also, in the code responsible for extracting data for printing,
the mechanism must be changed such that it can handle negative
offsets appropriately.

This patch includes a test case to test that the issue is resolved.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138197

Files:
  lldb/include/lldb/Core/DumpDataExtractor.h
  lldb/include/lldb/Core/ValueObject.h
  lldb/include/lldb/Core/ValueObjectChild.h
  lldb/include/lldb/Symbol/CompilerType.h
  lldb/include/lldb/Symbol/TypeSystem.h
  lldb/include/lldb/Target/ProcessStructReader.h
  lldb/include/lldb/Utility/DataExtractor.h
  lldb/source/API/SBType.cpp
  lldb/source/Core/DumpDataExtractor.cpp
  lldb/source/Core/ValueObject.cpp
  lldb/source/Core/ValueObjectChild.cpp
  lldb/source/Core/ValueObjectConstResultImpl.cpp
  lldb/source/Plugins/ABI/PowerPC/ABISysV_ppc64.cpp
  lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
  lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp
  lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
  lldb/source/Symbol/CompilerType.cpp
  lldb/source/Utility/DataExtractor.cpp
  lldb/test/API/commands/expression/expr-bitfield-on-boundary/Makefile
  lldb/test/API/commands/expression/expr-bitfield-on-boundary/TestExprBitfieldOnBoundary.py
  lldb/test/API/commands/expression/expr-bitfield-on-boundary/main.cpp
  lldb/unittests/Platform/PlatformSiginfoTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138197.476072.patch
Type: text/x-patch
Size: 34293 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20221117/cf0d0a65/attachment-0001.bin>


More information about the lldb-commits mailing list