This is an archive of the discontinued LLVM Phabricator instance.

Add an example command that runs to one of a set of breakpoints
Needs ReviewPublic

Authored by jingham on May 6 2022, 5:05 PM.

Details

Summary

In a situation where you have a lot of breakpoints set, some enabled and some not, and you want to continue till you hit one breakpoint but don't want to hit any of the others in the course of doing that, you have to hand disable the other breakpoints, then continue, then re-enable the ones that were enabled when you started (but not the others). That's tedious but easily done with scripting. I wrote up this little example for somebody and it seems generally useful.

Diff Detail

Event Timeline

jingham created this revision.May 6 2022, 5:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 6 2022, 5:05 PM
jingham requested review of this revision.May 6 2022, 5:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 6 2022, 5:05 PM
kastiglione added inline comments.May 6 2022, 6:04 PM
lldb/examples/python/cont_to_bkpt.py
14

is it worth supporting named breakpoints in addition to IDs

20

should this be int_value?

kastiglione added inline comments.May 6 2022, 6:59 PM
lldb/examples/python/cont_to_bkpt.py
22

can also be if not bkpt_ids:

32–33

these SetStatus lines aren't necessary since SetError(…) internally calls SetStatus(eReturnStatusFailed).

40

can also be if bkpt_id not in bkpt_ids:

kastiglione added inline comments.May 6 2022, 7:01 PM
lldb/examples/python/cont_to_bkpt.py
6–7

Are these properties needed by lldb? They aren't used in __call__.

Just trying to be helpful!

lldb/examples/python/cont_to_bkpt.py
27

Reuse target here rather than exe_ctx.target?

jingham updated this revision to Diff 431837.May 24 2022, 4:39 PM

Added support for breakpoint names as well as ID's.
Addressed other review comments.

jingham marked 7 inline comments as done.May 24 2022, 4:43 PM

The patch gets a little hard to read with all the no-longer in the right places comments, but I think I addressed everything.

The patch gets a little hard to read with all the no-longer in the right places comments

I just learned there's a keyboard shortcut (A) that hides them all.

JDevlieghere added inline comments.May 24 2022, 7:08 PM
lldb/examples/python/cont_to_bkpt.py
5

Nit: The "Pythonic" way of doing is using pass