-
Notifications
You must be signed in to change notification settings - Fork 333
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
[SR-6156] LLDB: warning: initialization of variable '$__lldb_error_result' #4384
Comments
@swift-ci create |
FWIW I think I've been seeing this since Swift 1.0. |
So it's not a regression? Sorry, management won't let us fix it 😉 |
I've made some progress on this. So the problem for this specific case is that when lldb attempts to find `self` here, it finds the optional one, and ends up adding the extension to Optional, yet the `self` that ends up getting accessed is the non optional one, so the extension doesn't apply. This is the cause of the second half of this error. This isn't super surprising since in this case you can even see the problem by running `fr v`:
Since you end up with multiple self vars here. I'm not exactly sure what the solution is yet, or if it's even on the lldb side, but I'm still looking into it. |
Upon more investigation, the problem isn't the multiple `self` variables, it's that where lldb is fetching the variables from, SymbolContext->GetFunctionBlock->GetBlockVariableList, only includes the optional self, and not the non-optional one. You can see this using the python API to access the same variables:
In this case you end up with just the optional `self`. If you instead access the variables directly from the frame, you get both. |
Since swiftlang/swift#15306 you can now do this without the backticks, but lldb still has this issue (unsurprisingly) |
I recorded video about same issue. |
Comment by Erica Ehrhardt (JIRA) We keep running into this one at Thumbtack. One way it manifests in Xcode is that tracepoints showing the value of locals in a closure that uses |
Comment by Daniel W Roth (JIRA) Agreed. This effectively nullifies the value of being able to write (the very common) guard let self = self else { return } |
Comment by Christopher Fuller (JIRA) I completely and wholeheartedly agree with dwroth@gmail.com (JIRA User) !! As Swift developers, we LOVE the fact that SE-0079 was accepted and released with Swift 4.2. We have adopted that syntax ever since, however we regularly encounter this debugging issue. This causes a lot of friction in our engineering process and results in Swift engineers resorting to using `strongSelf` or `this` or `_self` or whatever. These workarounds are not ideal at all - we can do better!! |
Comment by Borys Gurtovyi (JIRA) Please, give this bug some attention! Thank you 👍 |
Comment by Johnson Hsieh (JIRA) This would be great |
Comment by Nicholas (JIRA) This one impacts us daily. Would be great to see a resolution. |
Comment by Owen Thomas (JIRA) I've been running into this for a while now too but didn't know there was a bug report for it till just now. Would love to see a fix for this one! |
Comment by Michael Doshi (JIRA) I've been running into this over the past couple years. Would be great to have a fix 👍 |
Comment by Connor Wybranowski (JIRA) Would love to see a fix for this! 👍 |
I'm looking at this now, but at least some of you will be disappointed... 🙂 I suspect there are multiple root cause failures that all manifest as an error "value of type 'Foo' has no member '$__lldb_wrapped_expr_0'", one of them being this issue with a shadowed 'self' declaration. However, once I fix this issue, we can see what else remains. |
Comment by Manjunath Chandrashekar (JIRA) Have crossed path with this issue when working on Generics recently. https://github.com/manjuhere/GenericsBugDemo Would be glad if it can help in solving the issue. |
Comment by rounak jain (JIRA) Would be really great to have a fix for this, given a lot of times issues can't be reproduced, and having a broken debugger at that instant is very limiting. |
Comment by Elliott Williams (JIRA) I've been using this workaround in lldb to sidestep the issue.
|
Comment by Leonid Kokhnovych (JIRA) This one impacts us daily. It would be great to see a resolution. |
The original specific example here has been fixed for a while. If anyone else has a new repro case please file a new ticket! |
Additional Detail from JIRA
md5: 48509e726972078e013416019229b090
Issue Description:
This test case:
Causes this error when attempting to `po self` inside of the dispatch closure:
To reproduce this you can compile and debug it with this:
This is probably the same core issue as https://bugs.swift.org/browse/SR-3886 but I wanted to file it separately since it has a different test case.
The text was updated successfully, but these errors were encountered: