[Lldb-commits] [PATCH] D108090: [lldb/lua] Supplement Lua bindings for lldb module

Pedro Tammela via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 17 20:21:24 PDT 2021


tammela added a comment.

Hi Siger,

We are almost there.
I encourage you to continue working on this patch.

I have been busy the past weeks, but I will try to review ASAP once you address my comments.



================
Comment at: lldb/bindings/lua/lua-typemaps.swig:219-221
+%typecheck(SWIG_TYPECHECK_STRING_ARRAY) char ** {
+   $1 = (lua_istable(L, $input) || lua_isnil(L, $input));
+}
----------------
siger-young wrote:
> tammela wrote:
> > This is not being generated by SWIG for some reason.
> > 
> > I think it's more readable to just have an else clause that raises an error on line 212.
> I tried commenting and uncommenting these lines then diff, found that the typecheck is actually generated on those overloaded functions. `SBTarget::Launch` no longer works after commenting in my cases:
> ```
> lua5.3: test.lua:27: Wrong 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 &)
> ```
> 
> It seems that SWIG uses "SWIG_isptrtype" to decide arg matches "char**", so this typecheck is necessary.
> 
> For those functions with just one definition (i.e. not overloaded), this typecheck does nothing on them, so it will be `typemap(in)`'s responsibility to check arg types.
I see, Thanks.
That was indeed a good way to see what SWIG is generating :).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108090/new/

https://reviews.llvm.org/D108090



More information about the lldb-commits mailing list