[lldb-dev] Various questions about lldbinit and python scripts.

Jean-Yves Avenard jyavenard at gmail.com
Mon Oct 7 18:18:00 PDT 2013

On 8 October 2013 11:43, Enrico Granata <egranata at apple.com> wrote:

> This is unfortunately Python’s fault
> There are a couple ways that we could work around it.
> One is to use __file__ (without the .py extension of course) to know the
> module name. Now you still somehow depend on your module name, but this
> dependency is masked by Python itself doing the undignified work of figuring
> that out for you

But the name of the module is within a string, so I doubt using
__file__ would work here.
if I was to use __file__ in the argument of HandleCommand you get:

Function __file__.the_framestats_command was not found. Containing
module might be missing.

> Alternatively, you can use the @lldb.command decorator
> At the top of your life, just import lldb (which you might be doing anyway),
> and then you can mark your commands with @lldb.command, as in:
> import lldb
> @lldb.command(“TheNameOfMyCommandHere")
> def MyCommandImplementor(debugger,args,retval,unused):
> print>>retval,"Hello world this is me"
> print>>retval,args

will try those... thanks

More information about the lldb-dev mailing list