Skip to content
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-4776] For "po" command debugger doesn't shows errors in better case and falls down in worse case #4633

Open
swift-ci opened this issue May 2, 2017 · 5 comments
Labels
bug Something isn't working LLDB for Swift

Comments

@swift-ci
Copy link

swift-ci commented May 2, 2017

Previous ID SR-4776
Radar rdar://problem/31938892
Original Reporter gerchicov.bp (JIRA User)
Type Bug
Environment

OSX 10.12, xCode 8.3.2

Additional Detail from JIRA
Votes 0
Component/s LLDB for Swift
Labels Bug
Assignee None
Priority Medium

md5: 11f5a2ba8456bd508c14d013f84b09de

Issue Description:

I imported this project:
https://github.com/kevin0571/Dratini

just try to debug sending of any request and log inputparams or outputparams info - debugger shows that these custom objects contain nil values and falls down when you try to output them via "po" command.
In the same time print("(some_object)") for these objects works well as expected.

Also this problem is described here:
http://stackoverflow.com/questions/19870176/xcode-debugger-doesnt-print-objects-and-shows-nil-when-they-arent

but in my case nothing from theses advices works

@belkadan
Copy link

belkadan commented May 2, 2017

@swift-ci create

@swift-ci
Copy link
Author

swift-ci commented May 2, 2017

Comment by Jim Ingham (JIRA)

Dratini is a library. With Swift debugging, how a library is included into your application is often important, especially when you are having issues where "nothing is working". So I really need to see an example of how you are using this library that shows the problems you are reporting here. Also, if you could along with the example include some explicit steps to get to a point where I can see the problem, that would help me get to the point where I can see and fix it.

@swift-ci
Copy link
Author

swift-ci commented May 3, 2017

Comment by Vyachaslav (JIRA)

It seems the problem is in Objective-C you can debug mutable and immutable variables and can't various constants. But in swift there is no difference between constant and just immutable variable defined with "let". So maybe debugger in swift treat all the "var" variables as mutable/immutable variables in Objective-C and all the "let" variables as constants (even if it is not correct).

So the only temporary solution I see is to forget about immutable variables in swift (use "let" keyword as less as possible)

You even don't need to test Dratini - try this example and run "po test" after the last line (or check its value with another debugger tool):

let test = ["1": "1", "2": "2", "3": "3"]
var test2 = test
test2["1"] = "one"

@swift-ci
Copy link
Author

swift-ci commented May 3, 2017

Comment by Jim Ingham (JIRA)

I actually don't see po failing for any of the variables as I step through the source above. I'm not sure what you mean "after the last line", however. If I step to the

test2["1"] = "one"

line above, I can print & po test2. If I step over that line then I end up out of the artificial function made to hold swift top-level statements, and back in the system "_start" function, which has no variables.

@swift-ci
Copy link
Author

swift-ci commented May 4, 2017

Comment by Vyachaslav (JIRA)

man do you troll me?
1)if you have no lines after test2["1"]="one" then you can always add something like print("") in the end to get a line you can set a breakpoint
2)And? I can po test2 from any place if it was previously defined too because it is defined with var. I meaned "po test"

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working LLDB for Swift
Projects
None yet
Development

No branches or pull requests

2 participants