When is __lldb_init_module called?
Question: 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:

  1. The script file is getting imported
  2. __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?


Answer: 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:

![enter image description here](http://i.stack.imgur.com/J9cFd.png)

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.

