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-10702] Request: lldb setting to render strings literally #4485
Comments
I could see this being the difference between |
Comment by Jim Ingham (JIRA) The result of "expr" for a string should show the \n , \t, etc. Since you need something to compare against what you typed into your code, and expr is the debugger view of the object, it seems right that expr should show the characters as typed. The output of "po" for swift is the result of the debugDescription for String, which comes from the swift standard library. lldb just outputs the resultant text to the console, so real newlines would be newlines, etc. I don't have a strong opinion about how that behaves, but that's something to take that up with the standard library folks. Note that if you want to render the string - as opposed to getting its debug description, you can do: (lldb) expr print(someString) That will show the rendered string and it's actually more efficient than po for printing strings - since `po` has to evaluate the expression, then pass it the expression's result to the mirror printing routine. |
So,
That's a neat workaround![]( I'll definitely be using this in the meantime. Thank you) |
Comment by Jim Ingham (JIRA) Yes, probably the Standard Library folks thought the distinction between "description" - which doesn't escape - and which BTW is what print uses - and debugDescription which shows the string as typed in code was useful. I can actually see the sense behind that, especially given that you can get the rendered version from "print" in the debugger pretty easily... |
Additional Detail from JIRA
md5: e8d7a61ff7c776cb8b0974b0e22366cd
Issue Description:
Strings currently render like this in LLDB for Swift:
I realize this is intentional—I remember reading that somewhere—but this is never what I want. I think I speak for a lot of people when I say that I'd rather see this:
I would love either an lldb setting to change string printing behavior in Swift, or a special command to print them literally.
The text was updated successfully, but these errors were encountered: