Search code examples
regexescapinglldbexpr

How to convert a unescaped string to NSString in lldb?


Suppose I have a

" aaaaa
  vnnvnvnvnv
  bbbbc
"

How can I convert it to a NSString and use it in next expression, normally I need to escape it use a tool first.

I found the return char always break interpreter parse expression.


Solution

  • You can do multi-line expressions in lldb by typing just expression. Then you'd type it just like you would type it in a source file. e.g.

    (lldb) expression
    Enter expressions, then terminate with an empty line to evaluate:
    1 NSString *test = @"\
    2 hi\
    3 there\
    4 ";
    5 NSLog (@"%@", test);
    6 
    2016-05-12 10:14:13.757 errteir[2052:170287] hithere