Is it possible to introduce an objective-C for loop as an LLDB expression?

I have seen passing assertions that you can enter complex operators such as the for loop in the LLDB command (in the language of the debugged program - in this case Objective-C)

I would really like to do this. I have never studied Python and would rather not waste time doing this to use the available LLDB support in python - hours are not enough for this.

+8
objective-c lldb
source share
2 answers

You can enter Objective-C statements using expr -- ... , for example:

 (lldb) po myArray

 (
 foo
 bar
 )

 (lldb) expr - for (NSString * s in myArray) {(void) NSLog (@ "% @", s);  }

 2013-12-03 18: 29: 03.637 myapp [1373: 70b] foo
 2013-12-03 18: 29: 03.639 myapp [1373: 70b] bar
+13
source share

Based on @ "Martin R" answer.

At a minimum, NSLog does not print anything with Xcode 6.0.1.

 (lldb) expr -- for(UIWindow *w in [(UIApplication *)[UIApplication sharedApplication] windows]) { (int)printf("%s\n\n", [(NSString *)[w recursiveDescription] UTF8String]); } 
0
source share

All Articles