问题
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.
By inserting print calls in the Python script I have been able to determine that:
- The script file is getting imported
- __lldb_init_module is never called
Any idea about what could prevent __lldb_init_module from being called? Is there a specific time when you need to import the script?
回答1:
For me this worked by adding
command script import /path/to/CustomSummaries.py
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')
and this is the view in the Xcode debugger window:
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.
来源:https://stackoverflow.com/questions/14159070/when-is-lldb-init-module-called