Typecasting variables in lldb


Laurent Daudelin
 

I used to be able to do something like:

(lldb) po ((MyCustomDelegate *)UIApplication.shared.delegate).rootViewController

in lldb but now, when I try it, I get an error:

(lldb) po ((AppDelegateIOS *)UIApplication.shared.delegate).rootViewController
error: <EXPR>:8:19: error: expected expression after operator
((AppDelegateIOS *)UIApplication.shared.delegate).rootViewController
                  ^
 
error: <EXPR>:8:20: error: expected ',' separator

What am I missing?

-Laurent.
-- 
Laurent Daudelin   laurent@...


 


On May 12, 2021, at 2:17 PM, Laurent Daudelin <laurent@...> wrote:

I used to be able to do something like:

(lldb) po ((MyCustomDelegate *)UIApplication.shared.delegate).rootViewController

Take out the space(s). LLDB's argument parser isn’t smart, and will cut off an argument at a space even inside parens.

(I think this has always been the case.)

—Jens


Laurent Daudelin
 

Thanks, I will try that

-Laurent.
-- 

On May 14, 2021, at 20:55, Jens Alfke <jens@...> wrote:


On May 12, 2021, at 2:17 PM, Laurent Daudelin <laurent@...> wrote:

I used to be able to do something like:

(lldb) po ((MyCustomDelegate *)UIApplication.shared.delegate).rootViewController

Take out the space(s). LLDB's argument parser isn’t smart, and will cut off an argument at a space even inside parens.

(I think this has always been the case.)

—Jens
_._,_._,_