This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Add support for specifying language when setting watchpoint by expression
ClosedPublic

Authored by bulbazord on Apr 24 2023, 5:02 PM.

Details

Summary

This is useful in contexts where you have multiple languages in play:
You may be stopped in a frame for language A, but want to set a watchpoint
with an expression using language B. The current way to do this is to
use the setting target.language while setting the watchpoint and
unset it after the watchpoint is set, but that's kind of clunky and
somewhat error-prone. This should add a better way to do this.

rdar://108202559

Diff Detail

Event Timeline

bulbazord created this revision.Apr 24 2023, 5:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 24 2023, 5:02 PM
bulbazord requested review of this revision.Apr 24 2023, 5:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 24 2023, 5:02 PM
bulbazord edited the summary of this revision. (Show Details)Apr 25 2023, 1:27 PM
jasonmolenda accepted this revision.Apr 25 2023, 1:32 PM

LGTM.

lldb/source/Interpreter/OptionGroupWatchpoint.cpp
67

I don't care much, but the formatting of this entry is pretty inconsistent with the two SET_1's above. Should they match?

This revision is now accepted and ready to land.Apr 25 2023, 1:32 PM
bulbazord added inline comments.Apr 25 2023, 1:33 PM
lldb/source/Interpreter/OptionGroupWatchpoint.cpp
67

I applied clang-format to the entire thing and this is what it gave me.... /shrug

mib requested changes to this revision.Apr 25 2023, 2:13 PM

I think we should still be able to use this new flag with the previous ones (i.e. watchpoint set -l c++ -w read -- &my_var)

lldb/source/Interpreter/OptionGroupWatchpoint.cpp
67

Having a different option group for this flag means it can't be used with the other ones ... Is that really what you want ?

This revision now requires changes to proceed.Apr 25 2023, 2:13 PM
bulbazord requested review of this revision.Apr 25 2023, 2:19 PM

I think we should still be able to use this new flag with the previous ones (i.e. watchpoint set -l c++ -w read -- &my_var)

You can do that still with this patch. I'm placing the language flag in a 2nd group so that watchpoint set variable does not have access to this flag, but watchpoint set expression does. You can still mix and match the flags for expression.

lldb/source/Interpreter/OptionGroupWatchpoint.cpp
67

OptionGroupWatchpoint as far as I can tell is only used for watchpoint set expression and watchpoint set variable. I don't think this flag makes sense for watchpoint set variable, so I'm adding it to the 2nd group for expression and opting out for variable.

mib accepted this revision.Apr 25 2023, 4:16 PM

I think we should still be able to use this new flag with the previous ones (i.e. watchpoint set -l c++ -w read -- &my_var)

You can do that still with this patch. I'm placing the language flag in a 2nd group so that watchpoint set variable does not have access to this flag, but watchpoint set expression does. You can still mix and match the flags for expression.

Thanks for clarifying that. LGTM!

This revision is now accepted and ready to land.Apr 25 2023, 4:16 PM

Looks like this test does not pass on windows: https://lab.llvm.org/buildbot/#/builders/219/builds/2389

I'm aware and working on this.

Looks like this test does not pass on windows: https://lab.llvm.org/buildbot/#/builders/219/builds/2389

I'm aware and working on this.

I marked the test as unsupported on windows in 7590cc908807b1bfc63695ca016a60327c1aacdf. This should get the bot green again.