po Swift String "unresolved identifier"

lldb, swift

Solution

This is most likely a bug in the debug information output. You can check this by grabbing the PC, for instance from `register read pc`, and then doing:

(lldb) image lookup -va <PC VALUE>

That will print a bunch of stuff, but the last entries will be all the variables currently visible to the debugger, and where they live (in registers or memory.) If you don't see the variable there, then the debug information must have told lldb that the variable is not currently live.

If you can reproduce this in some example code you can make available, please file a bug with bug reporter.apple.com.

Problem

I am having trouble debugging Swift Strings ``` func stringTest() { let test1:String = "test1"; let test2:NSString = "test2"; // <-- Breakpoint here println(test1); println(test2); } ``` If I set a breakpoint after these lines and try and print test1 I get the following error: ``` po test1 error: <REPL>:1:1: error: use of unresolved identifier 'test1' test1 ^ ``` But I am able to print test2 successfully: ``` po test2 test2 ```

Original source

Related problems