什么时候调用__lldb_init_module? [英] When is __lldb_init_module called?

查看:164
本文介绍了什么时候调用__lldb_init_module?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注WWDC会话412 - 在Xcode中进行调试。那里有一个关于为你自己的课程创建自定义LLDB摘要的演示。

I'm following WWDC session 412 - Debugging in Xcode. There is a demo there about creating custom LLDB summaries for your own classes.

我根本无法获得摘要显示。

I simply can't get the summaries to show up.

通过在Python脚本中插入打印调用,我已经能够确定:

By inserting print calls in the Python script I have been able to determine that:


  1. 脚本文件正在获取导入

  2. __ lldb_init_module永远不会被调用

有什么可以防止__lldb_init_module被调用?是否需要导入脚本的特定时间?

Any idea about what could prevent __lldb_init_module from being called? Is there a specific time when you need to import the script?

推荐答案

对我来说,这是通过添加

For me this worked by adding

command script import /path/to/CustomSummaries.py

〜/ .lldbinit 文件并重新启动Xcode,或者在main中设置断点并在调试器控制台中执行import命令。

to the ~/.lldbinit file and restarting Xcode, or by setting a breakpoint in "main" and executing the import command in the debugger console.

我用最小的自定义描述脚本测试了它:

I tested it with a minimal custom description script:

import lldb

def myobject_summary(valueObject, dictionary):

    return 'MyCustomDescription'

def __lldb_init_module(debugger, dict):

    debugger.HandleCommand('type summary add MyObject -F CustomSummaries.myobject_summary')

这是Xcode调试器窗口中的视图:

and this is the view in the Xcode debugger window:

请注意,在更改脚本后必须重新启动Xcode。如果在Xcode调试器控制台中导入脚本,似乎也不会显示init方法中print语句的输出。

Note that you have to restart Xcode after changes to the script. It also seems that the output of "print" statements in the init method is not shown if the script is imported in the Xcode debugger console.

这篇关于什么时候调用__lldb_init_module?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆