In the debugger (gdb and llvm),
I usually do:
po self
po myIvar
p (CGPoint)whatEver
and works fine except when I am inside of a block. How can I access them in the debugger? I don’t like very much writing NSLogs everywhere …
I suppose inside blocks In the debugger I need to access ivars in a different way but I don’t know how 🙁
Blocks are their own environment when they’re executed. The neat thing about them is that they’ll capture any variables from the surrounding scope that you mention in their bodies. The flip side of that is that there’s no access to variables that aren’t captured.
Take a look at this snippet:
The Block captures
sand uses it. TheNSIntegerparameter,i, is also used and accessible inside the Block. The breakpoint gets hit when the Block is executed, though, which means that the creating scope, with the arrayaand dictionaryd, no longer exists. You can see this if you look at the local variable display in Xcode:Aside from globals, that’s all you or the debugger have access to when the Block is executing. If you really need to know the values of other variables during that time, I think you’ll have to mention them inside the Block. This will capture them, which will mean (for objects) they’ll be retained and then released when the Block is deallocated.