-
Notifications
You must be signed in to change notification settings - Fork 341
[lldb] Support breakpoints on specific property accessor blocks #8546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lldb] Support breakpoints on specific property accessor blocks #8546
Conversation
TODO
|
Saying that the getter & setter names are variants of the property name makes sense. Is it worth thinking of a way to specify "only setters" or "only getters"? You can always disable the extra locations after the fact, but that might get tedious. This needs some tests, first that show it works for the property access variants. It would also be nice to test that this doesn't cause unintended hits against classes that just happen to have a method with one of these names. |
I don't understand. With this change, property breakpoints must explicitly indicate which accessor the breakpoint should be set on (
done ✅
I'm also not sure what you mean. Could you illustrate an example of an unintended match? thanks |
@swift-ci test |
do you meaning that |
@swift-ci test windows |
@swift-ci test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed where this came in the breakpoint flow, I thought it would add hits not candidates. Since it's just adding candidates, the user gets to choose which ones they want, so that's taken care of.
What is the flow when I have a property that doesn't have a willSet, but I set a breakpoint on willSet? The GetMethodNameVariants will add a willSet name to the list of variants, but that method doesn't actually exist. Is it clear what went on in that case?
If that's not confusing, I'm fine with this. Thanks for the test!
@swift-ci test windows |
@@ -138,6 +138,25 @@ SwiftLanguage::GetMethodNameVariants(ConstString method_name) const { | |||
if (method_name.GetMangledCounterpart(counterpart)) | |||
if (SwiftLanguageRuntime::IsSwiftMangledName(counterpart.GetStringRef())) | |||
variant_names.emplace_back(counterpart, eFunctionNameTypeFull); | |||
|
|||
// Properties can have multiple accessor blocks. This section of code supports | |||
// breakpoints on accessor blocks by name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is accessor "block" a term of art? I would have expected this to be called an "accessor method" or just an "accessor".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the documentation of the swift grammar calls them blocks, see "variable-declaration" in https://docs.swift.org/swift-book/documentation/the-swift-programming-language/summaryofthegrammar#Declarations
I'm fine with removing the word block though.
...t/API/functionalities/breakpoint/swift_property_accessors/TestPropertyAccessorBreakpoints.py
Outdated
Show resolved
Hide resolved
...t/API/functionalities/breakpoint/swift_property_accessors/TestPropertyAccessorBreakpoints.py
Outdated
Show resolved
Hide resolved
@swift-ci test |
@swift-ci test windows |
Allows breakpoints to be set on computed properties, as well as other property accessor blocks including setters, and observers (
willSet
,didSet
).This change allows property accessor blocks to be set using the suffix generated for these by the compiler. They are:
.get
.set
.willset
.didset
In particular, this change allows the following command to work:
b computed_prop.get
. This will create a breakpoint on a computed property's getter – which is the motivation of this change. Currently, there's no way to set a breakpoint by name on computed properties.Note that these suffixes are emitted by the compiler into debug info. Ex:
rdar://125740294