From: Mikhail Elhimov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Bronnikov <sergeyb@tarantool.org>,
Sergey Kaplun <skaplun@tarantool.org>,
Evgeniy Temirgaleev <e.temirgaleev@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit v3] dbg: display fast function name along with ffid
Date: Wed, 7 Oct 2026 19:27:48 +0300 [thread overview]
Message-ID: <5be43ac9-2e2b-4c33-aa84-f7ef500898a2@vk.team> (raw)
In-Reply-To: <ab1555b1-d453-44b5-981d-7b5d19c72e38@tarantool.org>
Hi, Sergey!
Thanks for the review! Updated according to your comments.
On 28.09.2026 16:02, Sergey Bronnikov wrote:
> Hi, Mikhail,
>
> thanks for the patch! LGTM with minor comments below.
>
> Sergey
>
> On 9/24/26 23:14, Mikhail Elhimov wrote:
>> Part of tarantool/tarantool#4808
>> ---
>> Changes in v3:
>> - Fixed fast function regexp in tests
>>
>> Changes in v2:
>> - Format is changed to 'ffname (#ffid)'
>> - Replaced single '_' with '.' in ffname
>> - Adjusted tests to check mapping
>>
>> This patch is to be applied after
>> https://lists.tarantool.org/pipermail/tarantool-patches/2026-September/030791.html.
>>
>> Branch:
>> https://github.com/tarantool/luajit/tree/elhimov/gh-4808-display-fast-function-name
>> Related issue: https://github.com/tarantool/tarantool/issues/4808
>>
>> src/luajit_dbg.py | 19 +++++++++++++------
>> .../debug-extension-tests.py | 6 ++++--
>> 2 files changed, 17 insertions(+), 8 deletions(-)
>>
>> diff --git a/src/luajit_dbg.py b/src/luajit_dbg.py
>> index 5cd23a88..a564801b 100644
>> --- a/src/luajit_dbg.py
>> +++ b/src/luajit_dbg.py
>> @@ -1121,6 +1121,11 @@ def frames(L):
>> # LuaJIT macro implementations and structure access.
>> +# Get FastFunc enum members and replace any single '_' with '.'.
>> +FF_NAMES = EnumBasedList('FastFunc', 'FF__MAX', lambda x:
>> + re.sub('(?<!_)_(?!_)', '.', cut_prefix(x,
>> 'FF_')))
>> +
>> +
>> def mref(typename, obj):
>> return dbg.cast(typename, obj['ptr64'] if LJ_GC64 else
>> obj['ptr32'])
>> @@ -1716,7 +1721,7 @@ def dump_lj_gco_proto(gcobj):
>> def dump_lj_gco_func(gcobj):
>> func = dbg.cast('struct GCfuncC *', gcobj)
>> - ffid = func['ffid']
>> + ffid = int(func['ffid'])
>> if ffid == 0:
>> pt = funcproto(func)
>> @@ -1729,7 +1734,8 @@ def dump_lj_gco_func(gcobj):
>> elif ffid == 1:
>> return 'C function @ {}'.format(strx64(func['f']))
>> else:
>> - return 'fast function #{}'.format(int(ffid))
>> + ffname = FF_NAMES[ffid] if ffid < len(FF_NAMES) else "unknown"
> use single quotes
Done
>> + return 'fast function {} (#{})'.format(ffname, ffid)
>> def dump_lj_gco_trace(gcobj):
>> @@ -2079,7 +2085,7 @@ def dump_proto(proto):
>> def dump_func(func):
>> - ffid = func['ffid']
>> + ffid = int(func['ffid'])
>> if ffid == 0:
>> pt = funcproto(func)
>> @@ -2087,7 +2093,8 @@ def dump_func(func):
>> elif ffid == 1:
>> return 'C function @ {}\n'.format(strx64(func['f']))
>> else:
>> - return 'fast function #{}\n'.format(int(ffid))
>> + ffname = FF_NAMES[ffid] if ffid < len(FF_NAMES) else "unknown"
> the same is used in dump_lj_gco_func(), I would create a helper for this
Done
>> + return 'fast function {} (#{})\n'.format(ffname, ffid)
>> # FFI dumpers.
>> @@ -2713,7 +2720,7 @@ the type and some info related to it.
>> * LJ_TFUNC: <LFUNC|CFUNC|FFUNC>
>> <LFUNC>: Lua function @ <gcr>, <nupvals> upvalues, <chunk:line>
>> <CFUNC>: C function <mcode address>
>> - <FFUNC>: fast function #<ffid>
>> + <FFUNC>: fast function <ffname> (#<ffid>)
>> * LJ_TTRACE: trace <traceno> @ <gcr>
>> * LJ_TCDATA: cdata @ <gcr>
>> * LJ_TTAB: table @ <gcr> (asize: <asize>, hmask: <hmask>)
>> @@ -2932,7 +2939,7 @@ the type and some info related to it.
>> * LJ_TFUNC: <LFUNC|CFUNC|FFUNC>
>> <LFUNC>: Lua function @ <gcr>, <nupvals> upvalues, <chunk:line>
>> <CFUNC>: C function <mcode address>
>> - <FFUNC>: fast function #<ffid>
>> + <FFUNC>: fast function <ffname> (#<ffid>)
>> * LJ_TTRACE: trace <traceno> @ <gcr>
>> * LJ_TCDATA: cdata @ <gcr>
>> * LJ_TTAB: table @ <gcr> (asize: <asize>, hmask: <hmask>)
>> diff --git a/test/tarantool-debugger-tests/debug-extension-tests.py
>> b/test/tarantool-debugger-tests/debug-extension-tests.py
>> index 5e369f00..fe5e34f5 100644
>> --- a/test/tarantool-debugger-tests/debug-extension-tests.py
>> +++ b/test/tarantool-debugger-tests/debug-extension-tests.py
> fallback "unknown" is not covered
Added the requested tests (both for 'lj-func' and 'lj-gco')
>> @@ -326,7 +326,7 @@ GCO_ARGS = (
>> 'coroutine.create(function() end),\n'
>> 'function() end,\n'
>> 'require,\n'
>> - 'print,\n'
>> + 'math.min,\n'
>> 'ffi.new("int*"),\n'
>> '{1},\n'
>> 'newproxy(),\n'
> added also tests for: getmetatable(io.stdout).__gc and
> getmetatable(io.stdout).__tostring to cover regexp
Done
>> @@ -338,7 +338,7 @@ GCO_RX = (
>> r'thread @ ' + RX_ADDR + r'\n'
>> r'Lua function @ ' + RX_ADDR + r', [0-9]+ upvalues, .+:[0-9]+\n'
>> r'C function @ ' + RX_ADDR + r'\n'
>> - r'fast function #[0-9]+\n'
>> + r'fast function math.min \(#[0-9]+\)\n'
>> r'cdata @ ' + RX_ADDR + r' \[\d+\] <int \*> 0x0\n'
>> r'table @ ' + RX_ADDR + r' \(asize: \d+, hmask: ' + RX_HASH +
>> r'\)\n'
>> r'userdata @ ' + RX_ADDR + r'\n'
>> @@ -367,6 +367,7 @@ class TestLJTV(TestCaseBase):
>> # Sorted in LJT order.
>> lua_script = (
>> 'local ffi = require("ffi")\n'
>> + 'local math = require("math")\n'
>> 'print(\n'
>> ' nil,\n'
>> ' false,\n'
>> @@ -435,6 +436,7 @@ class TestLJGCo(TestCaseBase):
>> lua_script = (
>> 'local ffi = require("ffi")\n'
>> + 'local math = require("math")\n'
>> 'print(\n' +
>> GCO_ARGS +
>> ' 1\n' # Stub for the pattern.
> add also a test with "lj-func" for any ffunc
Done
--
Best regards,
Mikhail Elhimov
next prev parent reply other threads:[~2026-10-07 16:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 13:07 [Tarantool-patches] [PATCH luajit] " Mikhail Elhimov via Tarantool-patches
2026-09-22 9:16 ` Sergey Kaplun via Tarantool-patches
2026-09-23 22:55 ` Mikhail Elhimov via Tarantool-patches
2026-09-24 16:48 ` [Tarantool-patches] [PATCH luajit v2] " Mikhail Elhimov via Tarantool-patches
2026-09-24 20:14 ` [Tarantool-patches] [PATCH luajit v3] " Mikhail Elhimov via Tarantool-patches
2026-09-28 13:02 ` Sergey Bronnikov via Tarantool-patches
2026-10-07 16:27 ` Mikhail Elhimov via Tarantool-patches [this message]
2026-10-07 16:33 ` [Tarantool-patches] [PATCH luajit v4] " Mikhail Elhimov via Tarantool-patches
2026-10-08 10:58 ` Sergey Bronnikov via Tarantool-patches
2026-09-23 22:27 [Tarantool-patches] [PATCH luajit v2] dbg: avoid hardcoded enums (get them from target) Mikhail Elhimov via Tarantool-patches
2026-09-24 17:33 ` [Tarantool-patches] [PATCH luajit v3] dbg: display fast function name along with ffid Mikhail Elhimov via Tarantool-patches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5be43ac9-2e2b-4c33-aa84-f7ef500898a2@vk.team \
--to=tarantool-patches@dev.tarantool.org \
--cc=e.temirgaleev@tarantool.org \
--cc=m.elhimov@vk.team \
--cc=sergeyb@tarantool.org \
--cc=skaplun@tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH luajit v3] dbg: display fast function name along with ffid' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox