This is an archive of the discontinued LLVM Phabricator instance.

Complete breakpoint enable/disable/delete/modify with a list of breakpoint IDs
ClosedPublic

Authored by MrHate on May 9 2020, 2:06 AM.

Details

Summary
  1. A new common completion CommandCompletions::Breakpoints to provide a list of the breakpoints of the current context;
  2. Apply the completion above to the commands breakpoint enable/disable/delete/modify;
  3. Unit test.

Diff Detail

Event Timeline

MrHate created this revision.May 9 2020, 2:06 AM

A few small comments but this is looking pretty good to me.

lldb/source/Commands/CommandCompletions.cpp
558

GetSelectedTarget() returns a TargetSP. It seems like all the operations below can be performed on the shared pointer.

I think if you change this line you don't even need to change anything below.

TargetSP target = interpreter.GetDebugger().GetSelectedTarget();
lldb/test/API/functionalities/completion/TestCompletion.py
486

nit: missing period

497

It might be nice to split this up into self.assertTrue(bp) and self.assertEqual(bp.GetNumLocations(), 1). That way the error message will be a bit more informative if either fails. The same applies to bp2 below.

MrHate updated this revision to Diff 263046.EditedMay 9 2020, 7:10 PM

Thank you for your advice Jonas.
Btw, I also modified the raw Breakpoint pointer to be a BreakpointSP.

But I don't really understand your meaning of the comment "nit: missing period".

teemperor accepted this revision.May 11 2020, 6:19 AM

LGTM, thanks! I'll just add the two missing periods when committing.

This revision is now accepted and ready to land.May 11 2020, 6:19 AM
This revision was automatically updated to reflect the committed changes.

This is great, but you can also specify breakpoints by name. Should be possible to also complete on the list of breakpoint names.