On Oct 7, 2013, at 5:19 PM, Jean-Yves Avenard <[email protected]> wrote:
> Hello > > Thanks for answering!... very much appreciated > > On 8 October 2013 10:40, Greg Clayton <[email protected]> wrote: > >> This works for me currently using the exact source for cmdtemplate.py: > > duh.. I feel silly. > > I had called the script lldbfunc.py > After I changed: > debugger.HandleCommand('command script add -f > cmdtemplate.the_framestats_command framestats') > > into: > debugger.HandleCommand('command script add -f > lldbfunc.the_framestats_command framestats') > > then it works... > > It's a bit of a worry though when the code being run in a file is > dependent on the name of that file ! 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 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 Enrico Granata 📩 egranata@.com ☎️ 27683
_______________________________________________ lldb-dev mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
