[Lldb-commits] [lldb] [lldb] Improved formatting of 'register read' command. (PR #188049)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 2 03:01:41 PDT 2026


================
@@ -195,6 +253,8 @@ class CommandObjectRegisterRead : public CommandObjectParsed {
         result.AppendError("the --set <set> option can't be used when "
                            "registers names are supplied as arguments\n");
       } else {
+        int alignment = ComputeMatchingAlignment(command, reg_ctx, !m_command_options.dump_all_sets.GetCurrentValue());
+        alignment += 2; // Extra ident to be consistent with register sets dumping
----------------
DavidSpickett wrote:

Comments above the code they apply to (in most situations) please.

Also this is a strange difference isn't it.
```
(lldb) register read -s 0
General Purpose Registers:
        x0 = 0x0000000000000001
        x1 = 0x0000ffffffffefd8
        x2 = 0x0000ffffffffefe8
        x3 = 0x00000000004005b4  test.o`__wrap_main
```
But then:
```
(lldb) register read x0 x1 x2 x3 x4
      x0 = 0x0000000000000001
      x1 = 0x0000ffffffffefd8
      x2 = 0x0000ffffffffefe8
      x3 = 0x00000000004005b4  test.o`__wrap_main
```
Maybe we should just make them the same. I don't see what the extra 2 spaces are doing.

Maybe it was a guess that when you're printing sets, you would generally end up with longer names than choosing individual ones, on average?

Either way it seems like a poor substitute for figuring out the actual alignment.

https://github.com/llvm/llvm-project/pull/188049


More information about the lldb-commits mailing list