Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to use po command in console (debug area)

Suddenly I have started to get this message randomly ( but pretty much often)

expression produced error: warning: /var/folders/53/0z4yfqt16tvbcn0z7f2385n80000gn/T/expr3-d271e2..swift:3:9: warning: initialization of variable '$__lldb_error_result' was never used; consider replacing with assignment to '_' or removing it var $__lldb_error_result = __lldb_tmp_error ~~~~^~~~~~~~~~~~~~~~~~~~ _

when I try to type something like this in console:

po myObject

So, the console prints only message above, rather than it gives me something useful... How to fix this, and what caused it?

like image 527
Whirlwind Avatar asked Apr 04 '19 11:04

Whirlwind


1 Answers

lldb has changed in Xcode 10.2. Apple recommends use of 'p' or more recently 'v' to view the values of variables.

from the Xcode 10.2 Release Notes

The LLDB debugger has a new command alias, v, for the “frame variable” command to print variables in the current stack frame. Because it bypasses the expression evaluator, v can be a lot faster and should be preferred over p or po. (40066460)

There is also good information on this in the LLDB Tutorial in the section named Examining Stack Frame State.

The frame variable command will also perform "object printing" operations on variables (currently we only support ObjC printing, using the object's "description" method. Turn this on by passing the -o flag to frame variable:

(lldb) frame variable -o self 
(SKTGraphicView *) self = 0x0000000100208b40 
<SKTGraphicView: 0x100208b40>

like image 71
Mike Hay Avatar answered Nov 05 '22 07:11

Mike Hay