This is an archive of the discontinued LLVM Phabricator instance.

Add "current" token for the -t option to "break set/modify"
ClosedPublic

Authored by jingham on Jul 28 2021, 5:08 PM.

Details

Summary

It's fairly common to want to set a breakpoint that is limited to the current thread. For instance, if you hit function A on thread 1, then you want to set a breakpoint on function B but only when this thread hits it. You can do this in Python, but it should be simple to do this just from the command line. With this patch you can do:

break set -t current -n foo

or something like that.

This actually uses the thread from the ExecutionContext passed to the CommandObjectBreakpointSet::DoExecute, not the currently selected thread, so it will work in breakpoint commands as well as from the command line. That's the right thing to do.

Diff Detail

Event Timeline

jingham created this revision.Jul 28 2021, 5:08 PM
jingham requested review of this revision.Jul 28 2021, 5:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 28 2021, 5:08 PM

Instead of using the token current, wouldn't it feel more natural to allow an empty value more natural? Would we reject that before we get to the option parsing code?

You can have options with optional values, but I don't favor using those. They have slightly odd behavior in the parser since you have to disambiguate them when they have a value, and them when they happen to be next to an argument. They aren't as easy to document, and just feel wrong to me. So I don't want to go with -t -n foo meaning the current thread.

This revision was not accepted when it landed; it landed in state Needs Review.Aug 6 2021, 3:30 PM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.