How do I use the "log expression" feature on a breakpoint?

Rather than littering my code with NSLog calls, I see an opportunity to create a breakpoint, uncheck the "suspend" option, and enter the expression that I would like logged. This would allow me to dynamically choose what to log without having to recompile my application. However, I don't see how to use it, because I am unable to output strings. Specifically, I would like to know the contents of a CGRect, but I am not having much luck with logging anything at all.

I have tried the following:

Input: @"Test String"
Output: 0x087e7e10

Input: Aaaaaa
Output: use of undeclared identifier 'Aaaaa'


Input: [self.textArea frame]
Output: (blank)

Input: (CGRect)[self.textArea frame]
Output: (blank)


Input: self.textArea
Output: 0x092eac00

Input: [self.textArea description]
Output: 0x087ead90

Input: "Test"
Output: 0x0ec18b90

The only one that works is this:

Input: 12345
Output: 12345

I feel that this feature could certainly do with some examples as part of the user interface. Or perhaps I am totally misunderstanding the purpose of this feature?
2 comments
Comment actions Permalink

For objects, I've used things like:

     printf((char const *) ([[object description] cString]))


That works.

Given that it's just outputting the results of evaluating an expression, I would have thought it should just work though for scalars, but after reading your question I tried some structs, and, as you suggest, nothing's displayed. You could use printf with format specifiers, but it might be more trouble than it's worth.

0
Comment actions Permalink

Steve,
this is indeed our problem, and we'll fix it in future updates. Please vote for: http://youtrack.jetbrains.com/issue/OC-5278.

0

Please sign in to leave a comment.