[Tarantool-patches] [PATCH luajit 1/2] gdb: introduce dumpers for GCobj

Maxim Kokryashkin m.kokryashkin at tarantool.org
Mon Jul 4 18:24:43 MSK 2022


Hi, Sergey!
 
Thanks for the patch!
 
LGTM, except for the single nit below.
 
<snipped>
>
>+def dump_lj_tv_lightud(tv):
>+ return dump_lj_gco_lightud(gcval(tv['gcr']))
>+
>+def dump_lj_tv_str(tv):
>+ return dump_lj_gco_str(gcval(tv['gcr']))
>+
>+def dump_lj_tv_upval(tv):
>+ return dump_lj_gco_upval(gcval(tv['gcr']))
>+
>+def dump_lj_tv_thread(tv):
>+ return dump_lj_gco_thread(gcval(tv['gcr']))
>+
>+def dump_lj_tv_proto(tv):
>+ return dump_lj_gco_proto(gcval(tv['gcr']))
>+
>+def dump_lj_tv_func(tv):
>+ return dump_lj_gco_func(gcval(tv['gcr']))
>+
>+def dump_lj_tv_trace(tv):
>+ return dump_lj_gco_trace(gcval(tv['gcr']))
> 
>-def dump_lj_tnumx(tv):
>+def dump_lj_tv_cdata(tv):
>+ return dump_lj_gco_cdata(gcval(tv['gcr']))
>+
>+def dump_lj_tv_tab(tv):
>+ return dump_lj_gco_tab(gcval(tv['gcr']))
>+
>+def dump_lj_tv_udata(tv):
>+ return dump_lj_gco_udata(gcval(tv['gcr']))
>+
I think we can replace that load of wrappers with something
that looks more or less like that:
 
1 | gco_to_wrap = [func for func in globals().keys() if func.startswith('dump_lj_gco')]
2 |
3 | for func_name in gco_to_wrap:
4 |    wrapped_func_name = func_name.replace('gco', 'tv')
5 |    globals()[wrapped_func_name] = lambda tv: globals()[func_name](gcval(tv['gcr']))
 
I am not really sure if it is harder to read for those who are not really familiar
with python, so feel free to ignore.
 
<snipped>
--
Best regards,
Maxim Kokryashkin
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20220704/b383dd3a/attachment.htm>


More information about the Tarantool-patches mailing list