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