[lldb-dev] .lldbinit and lldb-version-specific configuration

Greg Clayton gclayton at apple.com
Fri Sep 5 14:49:34 PDT 2014


(lldb) script print lldb.SBDebugger.GetVersionString()

You should be able to use that in your script to do something like:


def __lldb_init_module (debugger, dict):
    version = lldb.SBDebugger.GetVersionString()
    if version contains '123':
        debugger.HandleCommand("do one thing")
    else
	debugger.HandleCommand("do another") 

Then you can save this somewhere and add a "command script import /path/to/initlldb.py" to your ~/.lldbinit file.

Greg


> On Sep 5, 2014, at 1:52 PM, Todd Fiala <tfiala at google.com> wrote:
> 
> Ok.  It might be possible to have a distribution bundle some kind of init that does this to manage side-by-side installations.  I may bounce this idea around with Sylvestre and see if I can figure out how to make that work.
> 
> 
> On Fri, Sep 5, 2014 at 12:52 PM, Greg Clayton <gclayton at apple.com> wrote:
> You will have to import a python module and check the lldb version from python to do any conditional stuff that is based on the LLDB version. There is nothing in the command interpreter (no flow control or conditionals).
> 
> Greg
> 
> > On Sep 4, 2014, at 9:25 AM, Todd Fiala <tfiala at google.com> wrote:
> >
> > Hi all,
> >
> > Do we have any existing way to handle conditionally making settings based on lldb version, within the .lldbinit system?
> >
> > The specific case I have in mind is helping support side-by-side lldb installs (e.g. on debian/ubuntu) where, across lldb 3.4, 3.5 and 3.6, the python path to the correct lldb python module differs.  Right now, the default behavior is that lldb 3.5 and 3.6 are picking up the older 3.4 lldb python library and choking due to the mismatch.
> >
> > Thanks for any thoughts on this!
> >
> > -Todd
> >
> > _______________________________________________
> > lldb-dev mailing list
> > lldb-dev at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
> 
> 
> 
> 
> -- 
> Todd Fiala |	 Software Engineer |	 tfiala at google.com |	 650-943-3180
> 




More information about the lldb-dev mailing list