This is an archive of the discontinued LLVM Phabricator instance.

tab completion for register read/write
ClosedPublic

Authored by MrHate on May 6 2020, 6:42 AM.

Details

Summary
  1. Created a new common completion for the registers of the current context;
  2. Apply this new common completion to the commands register read/write;
  3. Unit test.

Diff Detail

Event Timeline

MrHate created this revision.May 6 2020, 6:42 AM
teemperor requested changes to this revision.May 6 2020, 9:05 AM

I only have some minor comments (see the inline comments), but otherwise this is ready to go I think. Thanks, great work!

Small side note: If you do git diff -U9999 to generate your diff then Phabricator also shows the context of your changes on the site instead of the "Context not available" warning. It's one of the weird quirks of Phabricator using diffs instead of git.

lldb/include/lldb/Interpreter/CommandCompletions.h
37

I think this should be '9' and the last enum case bumped to 10?

lldb/source/Commands/CommandCompletions.cpp
542

If I understand this correctly this whole if can be simplified to:

if (request.GetCursorArgumentPrefix().startswith("$"))
  reg_prefix = "$".

Then you also don't need command_args.

lldb/test/API/functionalities/completion/TestCompletion.py
431

I think it's fine if you shorten this to:

lldbutil.run_to_source_breakpoint(self, '// Break here', lldb.SBFileSpec("main.cpp"))
This revision now requires changes to proceed.May 6 2020, 9:05 AM
MrHate updated this revision to Diff 262402.May 6 2020, 9:44 AM
  1. shortened lines in TestCompletion.py and CommandCompletions.cpp
  2. set eRegisterCompletion to (1u << 9) while eCustomCompletion to (1u << 10)
teemperor accepted this revision.May 6 2020, 1:28 PM

LGTM, thanks!

This revision is now accepted and ready to land.May 6 2020, 1:28 PM
This revision was automatically updated to reflect the committed changes.