[Tarantool-patches] [PATCH luajit 2/3] dbg: introduce lj-ctype command, extend cdata dump

Sergey Kaplun skaplun at tarantool.org
Tue Jun 30 17:03:56 MSK 2026


Evgeniy,

On 30.06.26, Evgeniy Temirgaleev wrote:
> Sergey, thanks for the answer!
> 
> > I'm not sure that ctype_preplit -> dump_ctype_preplit helps for find the
> > original logic for this dumper from the LuaJIT source code. So, I'm open
> > to ideas ;).
> 
> I think, we can use original names from LuaJIT(ctype_prelit for ctype_prelit) and differ names for routines which are not present in LuaJIT. No more ideas at a time :)
> 
> I can’t find cdata_val_int64 or cdata_val_complex in LuaJIT code, ‘dump_’ prefix missed?

They are partially inspired by __tostring metamethod for FFI.
Added the prefix as you suggested:

===================================================================
diff --git a/src/luajit_dbg.py b/src/luajit_dbg.py
index 28cbe97d..19cefaed 100644
--- a/src/luajit_dbg.py
+++ b/src/luajit_dbg.py
@@ -2081,9 +2081,9 @@ def dump_lj_gco_cdata(gcobj):
     size = ctype['size']
     value = ''
     if ctype_iscomplex(info):
-        value = cdata_val_complex(cdata, ctype)
+        value = dump_cdata_val_complex(cdata, ctype)
     elif size == 8 and ctype_isinteger(info):
-        value = cdata_val_int64(cdata, ctype)
+        value = dump_cdata_val_int64(cdata, ctype)
     else:
         value = cdataptr(cdata)
         if ctype_isptr(info):
@@ -2425,7 +2425,7 @@ def dump_func(func):
 # FFI dumpers.
 
 
-def cdata_val_int64(cdata, ctype):
+def dump_cdata_val_int64(cdata, ctype):
     info = ctype['info']
     isunsigned = info & CTF_UNSIGNED
     cdataval = cdataptr(cdata)
@@ -2439,7 +2439,7 @@ def cdata_val_int64(cdata, ctype):
     return str(valueptr[0]) + usuffix + 'LL'
 
 
-def cdata_val_complex(cdata, ctype):
+def dump_cdata_val_complex(cdata, ctype):
     size = ctype['size']
     cdataval = cdataptr(cdata)
     casttype = None
===================================================================

Branch is force-pushed.

> 
> --
> Best regards,
> Evgeniy Temirgaleev
> 
> > 
> > From: Sergey Kaplun <skaplun at tarantool.org>
> > To: Evgeniy Temirgaleev <e.temirgaleev at tarantool.org>
> > Cc: tarantool-patches at dev.tarantool.org, Sergey Bronnikov <sergeyb at tarantool.org
> > >
> > Date: Tuesday, June 30, 2026 3:27 PM +03:00
> > Evgeniy,
> > Thanks for the answer, see my thoughts below.
> > 
> > On 30.06.26, Evgeniy Temirgaleev wrote:

<snipped>

> > --
> > Best regards,
> > Sergey Kaplun
> >

-- 
Best regards,
Sergey Kaplun


More information about the Tarantool-patches mailing list