[lldb-dev] Issue with Launch API

Matthew Gardiner mg11 at csr.com
Mon Oct 20 22:31:55 PDT 2014


No I don't really know swig, either.

If you don't have commit access then I could try to test out your patch
some more and then commit it.

Matt

On Mon, 2014-10-20 at 22:25 -0700, zephyr git wrote:
> Hi Matthew,
> 
> 
> It seems to be some swig
> issue: http://stackoverflow.com/questions/14220151/swig-typemap-with-c-overloaded-function
> 
> 
> I'm still playing with it.(I'm not familiar with swig)
> 
> 
> If I rename one version as suggested in the link above, it works:
> 
> 
> diff --git a/scripts/Python/interface/SBTarget.i
> b/scripts/Python/interface/SBTarget.i
> index 345929a..fc4e8ea 100644
> --- a/scripts/Python/interface/SBTarget.i
> +++ b/scripts/Python/interface/SBTarget.i
> @@ -425,6 +425,7 @@ public:
>                    const char **envp,
>                    const char *working_directory);
> 
> 
> +    %rename(Launch_2) Launch;
>      lldb::SBProcess
>      Launch (lldb::SBLaunchInfo &launch_info, lldb::SBError& error);
> 
> 
> 
> 
> 
> 
> 
> On Mon, Oct 20, 2014 at 10:18 PM, Matthew Gardiner <mg11 at csr.com>
> wrote:
>         Hi Zephyr
>         
>         I too have seen similar issue with this API.
>         
>         I noticed that the file
>         scripts/Python/python-swigsafecast.swig has no
>         entry for SBListener, and wondered if this was relevant.
>         
>         Matt
>         
>         
>         On Mon, 2014-10-20 at 21:57 -0700, zephyr git wrote:
>         > Hi,
>         >
>         >
>         > I'm using the SBTarget.Launch() API in Python:
>         >
>         >
>         > process = target.Launch(self.dbg.GetListener(), ['a','b'],
>         env, stdin,
>         > 'stdour.txt, 'stderr.txt', os.getcwd(), 0 , True, err)
>         >
>         >
>         >
>         > I got the following error:
>         >
>         >
>         > ...
>         >   File
>         >
>         "/home/media/llvm/lib/python2.7/site-packages/lldb/__init__.py", line
>         > 7973, in Launch
>         >     return _lldb.SBTarget_Launch(self, *args)
>         > NotImplementedError: Wrong number or type of arguments for
>         overloaded
>         > function 'SBTarget_Launch'.
>         >   Possible C/C++ prototypes are:
>         >     lldb::SBTarget::Launch(lldb::SBListener &,char const
>         **,char const
>         > **,char const *,char const *,char const *,char const
>         > *,uint32_t,bool,lldb::SBError &)
>         >     lldb::SBTarget::Launch(lldb::SBLaunchInfo
>         &,lldb::SBError &)
>         >
>         >
>         > If I replace the string list ['a','b'] with None, it works.
>         >
>         >
>         > I find that all the tests and samples uses None.
>         >
>         >
>         > It looks the problem stems from overloaded Launch in
>         SBTarget.i.
>         >
>         >
>         > In LLDBWrapPython.cpp:
>         >
>         >
>         > _wrap_SBTarget_Launch__SWIG_0 () { ...} // wrapper for
>         > Launch(lldb::SBListener &...)
>         >
>         > _wrap_SBTarget_Launch__SWIG_1 () { ...} // wrapper for
>         Launch
>         > (lldb::SBLaunchInfo &...);
>         >
>         >
>         >
>         > SWIGINTERN PyObject *_wrap_SBTarget_Launch(PyObject *self,
>         PyObject
>         > *args) {
>         >
>         > ...
>         >   if (argc == 3) {
>         >  ....
>         >   }
>         >   if (argc == 11) {
>         >     int _v;
>         >     void *vptr = 0;
>         >     int res = SWIG_ConvertPtr(argv[0], &vptr,
>         > SWIGTYPE_p_lldb__SBTarget, 0);
>         >     _v = SWIG_CheckState(res);
>         >     if (_v) {
>         >       void *vptr = 0;
>         >       int res = SWIG_ConvertPtr(argv[1], &vptr,
>         > SWIGTYPE_p_lldb__SBListener, 0);
>         >       _v = SWIG_CheckState(res);
>         >       if (_v) {
>         >         void *vptr = 0;
>         >         int res = SWIG_ConvertPtr(argv[2], &vptr,
>         SWIGTYPE_p_p_char,
>         > 0); // ===================== Fails here. unable to cast to
>         char**
>         >         _v = SWIG_CheckState(res);
>         >         if (_v) {
>         >        ....
>         >                         if (_v) {
>         >                           return
>         _wrap_SBTarget_Launch__SWIG_0(self,
>         > args);   ================> real check here
>         >                ...
>         >   }
>         >
>         > fail:
>         >   SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number
>         or type of
>         > arguments for overloaded function 'SBTarget_Launch'.\n"
>         >     "  Possible C/C++ prototypes are:\n"
>         >     "    lldb::SBTarget::Launch(lldb::SBListener &,char
>         const **,char
>         > const **,char const *,char const *,char const *,char const
>         > *,uint32_t,bool,lldb::SBError &)\n"
>         >     "    lldb::SBTarget::Launch(lldb::SBLaunchInfo
>         &,lldb::SBError
>         > &)\n");
>         >   return 0;
>         >
>         >
>         >
>         >
>         > It seems to me the swig code does some unnecessary check
>         before it
>         > goes into the real wrapper.
>         > Any inputs?
>         >
>         >
>         > Thanks,
>         > Zephyr
>         >
>         >
>         
>         >                To report this email as spam click here.
>         >
>         > _______________________________________________
>         > lldb-dev mailing list
>         > lldb-dev at cs.uiuc.edu
>         > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
>         
>         
>         
>         
>         Member of the CSR plc group of companies. CSR plc registered
>         in England and Wales, registered number 4187346, registered
>         office Churchill House, Cambridge Business Park, Cowley Road,
>         Cambridge, CB4 0WZ, United Kingdom
>         More information can be found at www.csr.com. Keep up to date
>         with CSR on our technical blog, www.csr.com/blog, CSR people
>         blog, www.csr.com/people, YouTube,
>         www.youtube.com/user/CSRplc, Facebook,
>         www.facebook.com/pages/CSR/191038434253534, or follow us on
>         Twitter at www.twitter.com/CSR_plc.
>         New for 2014, you can now access the wide range of products
>         powered by aptX at www.aptx.com.
> 
> 





More information about the lldb-dev mailing list