aboutsummaryrefslogtreecommitdiff
path: root/lldb/include
diff options
context:
space:
mode:
authorDavid Spickett <david.spickett@linaro.org>2023-06-05 17:02:09 +0000
committerDavid Spickett <david.spickett@linaro.org>2023-06-21 09:28:48 +0000
commit8b73a2e8219127b707280b689edb20753849bd4c (patch)
treed758c8ed20299044c5ea7def2018ec7153043251 /lldb/include
parent92af1183c3f1a7621bceab29461cbc80c5ca3e26 (diff)
downloadllvm-8b73a2e8219127b707280b689edb20753849bd4c.zip
llvm-8b73a2e8219127b707280b689edb20753849bd4c.tar.gz
llvm-8b73a2e8219127b707280b689edb20753849bd4c.tar.bz2
[LLDB] Add table formatting for register fields
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. Reviewed By: jasonmolenda Differential Revision: https://reviews.llvm.org/D152917
Diffstat (limited to 'lldb/include')
-rw-r--r--lldb/include/lldb/Target/RegisterFlags.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/lldb/include/lldb/Target/RegisterFlags.h b/lldb/include/lldb/Target/RegisterFlags.h
index 2dd20f9..0b9961e 100644
--- a/lldb/include/lldb/Target/RegisterFlags.h
+++ b/lldb/include/lldb/Target/RegisterFlags.h
@@ -93,6 +93,13 @@ public:
unsigned GetSize() const { return m_size; }
void log(Log *log) const;
+ /// Produce a text table showing the layout of all the fields. Unamed/padding
+ /// fields will be included, with only their positions shown.
+ /// max_width will be the width in characters of the terminal you are
+ /// going to print the table to. If the table would exceed this width, it will
+ /// be split into many tables as needed.
+ std::string AsTable(uint32_t max_width) const;
+
private:
const std::string m_id;
/// Size in bytes