【问题标题】:LLDB output error: use of undeclared type '$__lldb_context'LLDB 输出错误:使用未声明的类型“$__lldb_context”
【发布时间】:2016-09-29 11:38:35
【问题描述】:

为什么有时当我尝试像这样在控制台中打印时:

 po trip.id

我明白了:

error: <EXPR>:1:11: error: use of undeclared type '$__lldb_context'
extension $__lldb_context {                            
          ^~~~~~~~~~~~~~~
<EXPR>:16:5: error: use of unresolved identifier '$__lldb_injected_self'
    $__lldb_injected_self.$__lldb_wrapped_expr_79(     
    ^~~~~~~~~~~~~~~~~~~~~

error: <EXPR>:1:11: error: cannot find type '$__lldb_context' in scope
extension $__lldb_context {
          ^~~~~~~~~~~~~~~

有什么办法解决吗?

【问题讨论】:

标签: swift xcode console lldb


【解决方案1】:

为了让表达式像被注入当前选定的帧一样运行,我们需要使用适当的 self 参数构造一个上下文(例如某种类扩展),并评估表达式中的代码那个上下文。显然,您尝试打印“trip.id”的上下文是调试器无法重建的上下文。如果您可以向http://bugreporter.apple.com 提交错误报告以报告此问题,我们可以弄清楚如何支持此问题。

如果您不使用 Xcode 8.0,您可以尝试一下,修复了一堆此类错误。

lldb 有另一个命令“框架变量”,它提供对局部变量的快速访问。它不能运行函数调用等,但由于它不那么雄心勃勃,因此有时更健壮。您可以尝试以下方法:

(lldb) frame variable -O trip.id

【讨论】:

    猜你喜欢
    • 2017-06-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多