[Lldb-commits] [PATCH] D152917: [LLDB] Add table formatting for register fields

David Spickett via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 14 06:49:16 PDT 2023


DavidSpickett created this revision.
Herald added a project: All.
DavidSpickett requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This will be used by the "register info" command to show
the layout of register contents. For example if we have
these fields coming in from XML:

  <field name="D" start="0" end="7"/>
  <field name="C" start="8" end="15"/>
  <field name="B" start="16" end="23"/>
  <field name="A" start="24" end="31"/>

We get:

  | 31-24 | 23-16 | 15-8 | 7-0 |
  |-------|-------|------|-----|
  |   A   |   B   |  C   |  D  |

Note that this is only the layout, not the values.
For values, use "register read".

The tables' columns are center padded (left bias
if there's an odd padding) and will wrap if the terminal width
is too low.

  | 31-24 | 23-16 |
  |-------|-------|
  |   A   |   B   |
  
  | 15-8 | 7-0 |
  |------|-----|
  |  C   |  D  |

This means we match the horizontal format seen in many architecture
manuals but don't spam the user with lots of misaligned text when the
output gets very long.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152917

Files:
  lldb/include/lldb/Target/RegisterFlags.h
  lldb/source/Target/RegisterFlags.cpp
  lldb/unittests/Target/RegisterFlagsTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152917.531310.patch
Type: text/x-patch
Size: 9027 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230614/20a9d094/attachment-0001.bin>


More information about the lldb-commits mailing list