[Tarantool-patches] [PATCH luajit v2] luajit-gdb: support dualnum mode
Максим Корякшин
m.kokryashkin at tarantool.org
Mon Aug 16 13:01:43 MSK 2021
Hello, Igor!
Thanks for your comments!
Here is the new commit message:
=========================================================
gdb: support LJ_DUALNUM mode
luajit-gdb.py displays integers in LJ_DUALNUM mode as nan-s. The
dumper function produces output considering any input value as a
double. However, in LJ_DUALNUM mode, integers and doubles are stored
differently, so the `itype` of a double must be less than
`LJ_TISNUM`, and the `itype` of an integer must be `LJ_TISNUM`. With
this fact in mind, we can easily differentiate one from another.
Closes tarantool/tarantool#6224
=========================================================
Here is the diff:
=========================================================
diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
index 9ccca66a..25428745 100644
--- a/src/luajit-gdb.py
+++ b/src/luajit-gdb.py
@@ -507,10 +507,14 @@ pointers respectively.
'''
def invoke(self, arg, from_tty):
- gdb.write('LJ_64: {LJ_64}, LJ_GC64: {LJ_GC64}\n'.format(
- LJ_64 = LJ_64,
- LJ_GC64 = LJ_GC64
- ))
+ gdb.write(
+ 'LJ_64: {LJ_64}, LJ_GC64: {LJ_GC64}, LJ_DUALNUM : {LJ_DUALNUM}\n'
+ .format(
+ LJ_64 = LJ_64,
+ LJ_GC64 = LJ_GC64,
+ LJ_DUALNUM = LJ_DUALNUM
+ )
+ )
class LJDumpTValue(LJBase):
'''
@@ -690,7 +694,7 @@ The command requires no args and dumps current GC stats:
))
def init(commands):
- global LJ_64, LJ_GC64, LJ_DUALNUM, LJ_TISNUM, LJ_FR2, PADDING
+ global LJ_64, LJ_GC64, LJ_FR2, LJ_DUALNUM, LJ_TISNUM, PADDING
# XXX Fragile: though connecting the callback looks like a crap but it
# respects both Python 2 and Python 3 (see #4828).
@@ -731,7 +735,7 @@ def init(commands):
try:
LJ_64 = str(gdb.parse_and_eval('IRT_PTR')) == 'IRT_P64'
LJ_FR2 = LJ_GC64 = str(gdb.parse_and_eval('IRT_PGC')) == 'IRT_P64'
- LJ_DUALNUM = lookup('lj_lib_checknumber') is not None
+ LJ_DUALNUM = gdb.lookup_global_symbol('lj_lib_checknumber') is not None
except:
gdb.write('luajit-gdb.py failed to load: '
'no debugging symbols found for libluajit\n')
=========================================================
>
>>Max,
>>
>>Thanks for the patch! Please consider the comments below.
><snipped>
>>> def tvislightud(o):
>>> if LJ_64 and not LJ_GC64:
>>> @@ -343,7 +346,10 @@ def dump_lj_tudata(tv):
>>> return 'userdata @ {}'.format(strx64(gcval(tv['gcr'])))
>>>
>>> def dump_lj_tnumx(tv):
>>> - return 'number {}'.format(cast('double', tv['n']))
>>> + if tvisint(tv):
>>> + return 'number {}'.format(cast('int32_t', tv['i']))
>>
>>Side note: Agree with Sergey here. It is more convenient to understand
>>that TValue structure for integer slot differs from double.
>I have already fixed the output format here with the fix for v2 of the patch.
><snipped>
>
>Best regards,
>Maxim Kokryashkin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20210816/597bb953/attachment.htm>
More information about the Tarantool-patches
mailing list