<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">I think Enrico's patch r220306 fixes it</span><br><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Thanks!</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 21, 2014 at 5:59 PM, Greg Clayton <span dir="ltr"><<a href="mailto:gclayton@apple.com" target="_blank">gclayton@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">What is your type for 'env' below?<br>
<br>
process = target.Launch(self.dbg.GetListener(), ['a','b'], env, stdin, 'stdout.txt, 'stderr.txt', os.getcwd(), 0 , True, err)<br>
<br>
<br>
It must be a list like ['FOO=BAR', 'STUFF=COOL']:<br>
<br>
process = target.Launch(self.dbg.GetListener(), ['a','b'], ['FOO=BAR', 'STUFF=COOL'], stdin, 'stdout.txt', 'stderr.txt', os.getcwd(), 0 , True, err)<br>
<br>
<br>
Also how did you create "err"? You should create it first like this:<br>
<br>
err = lldb.SBError()<br>
env = ['FOO=BAR', 'STUFF=COOL']<br>
process = target.Launch(self.dbg.GetListener(), ['a','b'], env, stdin, 'stdout.txt', 'stderr.txt', os.getcwd(), 0 , True, err)<br>
<br>
'stdin' must be a string, and you probably want to make a full path to stdin and stdout.txt and stderr.txt just to be safe.<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
> On Oct 20, 2014, at 10:31 PM, Matthew Gardiner <<a href="mailto:mg11@csr.com">mg11@csr.com</a>> wrote:<br>
><br>
> No I don't really know swig, either.<br>
><br>
> If you don't have commit access then I could try to test out your patch<br>
> some more and then commit it.<br>
><br>
> Matt<br>
><br>
> On Mon, 2014-10-20 at 22:25 -0700, zephyr git wrote:<br>
>> Hi Matthew,<br>
>><br>
>><br>
>> It seems to be some swig<br>
>> issue: <a href="http://stackoverflow.com/questions/14220151/swig-typemap-with-c-overloaded-function" target="_blank">http://stackoverflow.com/questions/14220151/swig-typemap-with-c-overloaded-function</a><br>
>><br>
>><br>
>> I'm still playing with it.(I'm not familiar with swig)<br>
>><br>
>><br>
>> If I rename one version as suggested in the link above, it works:<br>
>><br>
>><br>
>> diff --git a/scripts/Python/interface/SBTarget.i<br>
>> b/scripts/Python/interface/SBTarget.i<br>
>> index 345929a..fc4e8ea 100644<br>
>> --- a/scripts/Python/interface/SBTarget.i<br>
>> +++ b/scripts/Python/interface/SBTarget.i<br>
>> @@ -425,6 +425,7 @@ public:<br>
>>                   const char **envp,<br>
>>                   const char *working_directory);<br>
>><br>
>><br>
>> +    %rename(Launch_2) Launch;<br>
>>     lldb::SBProcess<br>
>>     Launch (lldb::SBLaunchInfo &launch_info, lldb::SBError& error);<br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>> On Mon, Oct 20, 2014 at 10:18 PM, Matthew Gardiner <<a href="mailto:mg11@csr.com">mg11@csr.com</a>><br>
>> wrote:<br>
>>        Hi Zephyr<br>
>><br>
>>        I too have seen similar issue with this API.<br>
>><br>
>>        I noticed that the file<br>
>>        scripts/Python/python-swigsafecast.swig has no<br>
>>        entry for SBListener, and wondered if this was relevant.<br>
>><br>
>>        Matt<br>
>><br>
>><br>
>>        On Mon, 2014-10-20 at 21:57 -0700, zephyr git wrote:<br>
>>> Hi,<br>
>>><br>
>>><br>
>>> I'm using the SBTarget.Launch() API in Python:<br>
>>><br>
>>><br>
>>> process = target.Launch(self.dbg.GetListener(), ['a','b'],<br>
>>        env, stdin,<br>
>>> 'stdour.txt, 'stderr.txt', os.getcwd(), 0 , True, err)<br>
>>><br>
>>><br>
>>><br>
>>> I got the following error:<br>
>>><br>
>>><br>
>>> ...<br>
>>>  File<br>
>>><br>
>>        "/home/media/llvm/lib/python2.7/site-packages/lldb/__init__.py", line<br>
>>> 7973, in Launch<br>
>>>    return _lldb.SBTarget_Launch(self, *args)<br>
>>> NotImplementedError: Wrong number or type of arguments for<br>
>>        overloaded<br>
>>> function 'SBTarget_Launch'.<br>
>>>  Possible C/C++ prototypes are:<br>
>>>    lldb::SBTarget::Launch(lldb::SBListener &,char const<br>
>>        **,char const<br>
>>> **,char const *,char const *,char const *,char const<br>
>>> *,uint32_t,bool,lldb::SBError &)<br>
>>>    lldb::SBTarget::Launch(lldb::SBLaunchInfo<br>
>>        &,lldb::SBError &)<br>
>>><br>
>>><br>
>>> If I replace the string list ['a','b'] with None, it works.<br>
>>><br>
>>><br>
>>> I find that all the tests and samples uses None.<br>
>>><br>
>>><br>
>>> It looks the problem stems from overloaded Launch in<br>
>>        SBTarget.i.<br>
>>><br>
>>><br>
>>> In LLDBWrapPython.cpp:<br>
>>><br>
>>><br>
>>> _wrap_SBTarget_Launch__SWIG_0 () { ...} // wrapper for<br>
>>> Launch(lldb::SBListener &...)<br>
>>><br>
>>> _wrap_SBTarget_Launch__SWIG_1 () { ...} // wrapper for<br>
>>        Launch<br>
>>> (lldb::SBLaunchInfo &...);<br>
>>><br>
>>><br>
>>><br>
>>> SWIGINTERN PyObject *_wrap_SBTarget_Launch(PyObject *self,<br>
>>        PyObject<br>
>>> *args) {<br>
>>><br>
>>> ...<br>
>>>  if (argc == 3) {<br>
>>> ....<br>
>>>  }<br>
>>>  if (argc == 11) {<br>
>>>    int _v;<br>
>>>    void *vptr = 0;<br>
>>>    int res = SWIG_ConvertPtr(argv[0], &vptr,<br>
>>> SWIGTYPE_p_lldb__SBTarget, 0);<br>
>>>    _v = SWIG_CheckState(res);<br>
>>>    if (_v) {<br>
>>>      void *vptr = 0;<br>
>>>      int res = SWIG_ConvertPtr(argv[1], &vptr,<br>
>>> SWIGTYPE_p_lldb__SBListener, 0);<br>
>>>      _v = SWIG_CheckState(res);<br>
>>>      if (_v) {<br>
>>>        void *vptr = 0;<br>
>>>        int res = SWIG_ConvertPtr(argv[2], &vptr,<br>
>>        SWIGTYPE_p_p_char,<br>
>>> 0); // ===================== Fails here. unable to cast to<br>
>>        char**<br>
>>>        _v = SWIG_CheckState(res);<br>
>>>        if (_v) {<br>
>>>       ....<br>
>>>                        if (_v) {<br>
>>>                          return<br>
>>        _wrap_SBTarget_Launch__SWIG_0(self,<br>
>>> args);   ================> real check here<br>
>>>               ...<br>
>>>  }<br>
>>><br>
>>> fail:<br>
>>>  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number<br>
>>        or type of<br>
>>> arguments for overloaded function 'SBTarget_Launch'.\n"<br>
>>>    "  Possible C/C++ prototypes are:\n"<br>
>>>    "    lldb::SBTarget::Launch(lldb::SBListener &,char<br>
>>        const **,char<br>
>>> const **,char const *,char const *,char const *,char const<br>
>>> *,uint32_t,bool,lldb::SBError &)\n"<br>
>>>    "    lldb::SBTarget::Launch(lldb::SBLaunchInfo<br>
>>        &,lldb::SBError<br>
>>> &)\n");<br>
>>>  return 0;<br>
>>><br>
>>><br>
>>><br>
>>><br>
>>> It seems to me the swig code does some unnecessary check<br>
>>        before it<br>
>>> goes into the real wrapper.<br>
>>> Any inputs?<br>
>>><br>
>>><br>
>>> Thanks,<br>
>>> Zephyr<br>
>>><br>
>>><br>
>><br>
>>>               To report this email as spam click here.<br>
>>><br>
>>> _______________________________________________<br>
>>> lldb-dev mailing list<br>
>>> <a href="mailto:lldb-dev@cs.uiuc.edu">lldb-dev@cs.uiuc.edu</a><br>
>>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br>
>><br>
>><br>
>><br>
>><br>
>>        Member of the CSR plc group of companies. CSR plc registered<br>
>>        in England and Wales, registered number 4187346, registered<br>
>>        office Churchill House, Cambridge Business Park, Cowley Road,<br>
>>        Cambridge, CB4 0WZ, United Kingdom<br>
>>        More information can be found at <a href="http://www.csr.com" target="_blank">www.csr.com</a>. Keep up to date<br>
>>        with CSR on our technical blog, <a href="http://www.csr.com/blog" target="_blank">www.csr.com/blog</a>, CSR people<br>
>>        blog, <a href="http://www.csr.com/people" target="_blank">www.csr.com/people</a>, YouTube,<br>
>>        <a href="http://www.youtube.com/user/CSRplc" target="_blank">www.youtube.com/user/CSRplc</a>, Facebook,<br>
>>        <a href="http://www.facebook.com/pages/CSR/191038434253534" target="_blank">www.facebook.com/pages/CSR/191038434253534</a>, or follow us on<br>
>>        Twitter at <a href="http://www.twitter.com/CSR_plc" target="_blank">www.twitter.com/CSR_plc</a>.<br>
>>        New for 2014, you can now access the wide range of products<br>
>>        powered by aptX at <a href="http://www.aptx.com" target="_blank">www.aptx.com</a>.<br>
>><br>
>><br>
><br>
><br>
> _______________________________________________<br>
> lldb-dev mailing list<br>
> <a href="mailto:lldb-dev@cs.uiuc.edu">lldb-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br>
<br>
</div></div></blockquote></div><br></div>