This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Add "register info" command
ClosedPublic

Authored by DavidSpickett on Jun 14 2023, 6:48 AM.

Details

Summary

This adds a new command that will show all the information lldb
knows about a register.

(lldb) register info s0
       Name: s0
       Size: 4 bytes (32 bits)
Invalidates: v0, d0
  Read from: v0
    In sets: Floating Point Registers (index 1)

Currently it only allows a single register, and we get the
information from the RegisterInfo structure.

For those of us who know the architecture well, this information
is all pretty obvious. For those who don't, it's nice to have it
at a glance without leaving the debugger.

I hope to have more in depth information to show here in the future,
which will be of wider use.

Diff Detail

Event Timeline

DavidSpickett created this revision.Jun 14 2023, 6:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 14 2023, 6:48 AM
DavidSpickett requested review of this revision.Jun 14 2023, 6:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 14 2023, 6:48 AM
DavidSpickett added inline comments.
lldb/source/Core/DumpRegisterInfo.cpp
85

This is split out to make testing easier.

I think "info" is a fairly safe name for this command. I thought about "register help" but then you could do "help register help" and while that's amusing it's also pretty silly.

You might think at a glance "info" does something like check the register's value for symbols, but we have other things in lldb to do that so I don't think it's confusing once you look at the help or see the command output.

It could do multiple registers but my use case is one off cases where you are sanity checking an assumption, perhaps learning a new extension or architecture. Not throwing a list of registers at it like you might "register read". Easy to add later if needed.

jasonmolenda accepted this revision.Jun 14 2023, 1:35 PM

Looks good!

This revision is now accepted and ready to land.Jun 14 2023, 1:35 PM
This revision was automatically updated to reflect the committed changes.