I regularly get this error when evaluating expressions in LLDB:
error: <EXPR>:4:20: class methods are only allowed within classes; use 'static' to declare a static method
final class func $__lldb_user_expr_30(_ $__lldb_arg : UnsafeMutablePointer<Any>) {
~~~~~ ^
static
warning: <EXPR>:11:7: initialization of variable '$__lldb_error_result' was never used; consider replacing with assignment to '_' or removing it
var $__lldb_error_result = __lldb_tmp_error
~~~~^~~~~~~~~~~~~~~~~~~~
_
I'm not even always calling a class method when it happens. What can I do to resolve this? It sometimes means I can't pursue a debugging lead at all because I just keep getting this message.
Hi, this is most likely an lldb bug. If you could provide us with a self contained reproducer to investigate that would be ideal.
Otherwise, collecting log files, and giving us some context of where you are stopped when that bug happens would be very helpful. Here are the steps:
Add the following line to your ~/.lldbinit file: log enable lldb types expr -f /path/to/file (make sure to remove this line after you're done as it can actually affect the debugger's performance).
Reproduce the bug.
Post the contents of /path/to/file somewhere (github gist, or if you prefer you can also open a bug report with Apple using feedback assistant and posting the number here).
Give us some information about the context where you are stopped at when this happens (what's the type of self, what's the type of the expression you're trying to print, is the function that you're stopped at a class method or not?)
What can I do to resolve this? It sometimes means I can't pursue a debugging lead at all because I just keep getting this message
Are you usually using po when this happens? If you're just printing variables a potential workaround would be to try p or v instead.