本文介绍了Xcode lldb错误:无法打印出Swift变量-获取"$ __ lldb_injected_self.$ __ lldb_wrapped_expr_x";反而的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时,当尝试在调试器中打印出变量时,会显示以下错误消息:

Sometimes, when trying to print out a variable in the debugger, the following error message is displayed:

error: warning: <EXPR>:12: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
    ~~~~^~~~~~~~~~~~~~~~~~~~
    _

error: <EXPR>:18:5: error: use of unresolved identifier '$__lldb_injected_self'
    $__lldb_injected_self.$__lldb_wrapped_expr_120(
    ^~~~~~~~~~~~~~~~~~~~~

这是一个已知的lldb错误( https://bugs.swift.org/browse /SR-6156 ),但是也许有人知道在该错误修复之前可以使用的解决方法?

This is a known lldb bug (https://bugs.swift.org/browse/SR-6156), but perhaps someone knows a workaround that can be used until that bug is fixed?

推荐答案

作为一种解决方法,您可以在lldb调试器中使用以下命令将其打印出来:

As a workaround you can print it in the lldb debugger using:

frame variable variablename

也可以使用缩短的语法来加快键入速度

Also possible using shortened syntax for quicker typing

fr v variablename

由于XCode 10.2 ,因此支持更简单的lldb语法:

Since XCode 10.2 an ever simpler lldb syntax is supported:

v variable

更新-新的解决方法:

打印堆栈地址:

fr v -L variablename

po就像在堆栈框架变量上一样.属性

po like on stack frame variable.property

 fr v -o variablename.property

p

e unsafeBitCast(address, to: ClassName.self)

我会欣赏报告,实际上是有用的并且有效.谢谢.

I'd appreciate reports what is actually helpful and works. Thanks.

有关这种功能的更多信息,可以在这里找到: https://developer.apple.com/library/content/documentation/General/Conceptual/lldb-guide/chapters/C5-Examining-The-Call-Stack.html

More information on this kind of capabilities can be found here:https://developer.apple.com/library/content/documentation/General/Conceptual/lldb-guide/chapters/C5-Examining-The-Call-Stack.html

这篇关于Xcode lldb错误:无法打印出Swift变量-获取"$ __ lldb_injected_self.$ __ lldb_wrapped_expr_x";反而的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 03:25