[lldb-dev] Various questions about lldbinit and python scripts.
gclayton at apple.com
Tue Oct 8 10:47:54 PDT 2013
On Oct 7, 2013, at 6:18 PM, Jean-Yves Avenard <jyavenard at gmail.com> wrote:
> 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.
You will need to substitute it into a string:
command = "command script add -f %s.the_framestats_command framestats" % (os.path.splitext(os.path.basename(__file__)))
Try using the "@lldb.command(“TheNameOfMyCommandHere")" decorator.
>> 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
>> def MyCommandImplementor(debugger,args,retval,unused):
>> print>>retval,"Hello world this is me"
> will try those... thanks
More information about the lldb-dev