Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Bronnikov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Kaplun <skaplun@tarantool.org>,
	Mikhail Elhimov <m.elhimov@vk.team>,
	Evgeniy Temirgaleev <e.temirgaleev@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v2 luajit 4/6] lldb: support full-range 64-bit lightuserdata
Date: Wed, 27 May 2026 15:28:43 +0300	[thread overview]
Message-ID: <255e0244-1740-4aca-ba00-33a33480b8d4@tarantool.org> (raw)
In-Reply-To: <20260519123913.178775-5-skaplun@tarantool.org>

[-- Attachment #1: Type: text/plain, Size: 3972 bytes --]

Hi, Sergey,

thanks for the patch! LGTM

Sergey

On 5/19/26 15:39, Sergey Kaplun wrote:
> This commit adds the missed support for the full-range 64-bit light
> userdata, which was lost during lldb extension implementation. The
> corresponding entries for the test of lj-tv are sorted according to LJT*
> types.
> ---
>   src/luajit_lldb.py                            | 20 +++++++++++++-
>   .../debug-extension-tests.py                  | 27 ++++++++++++-------
>   2 files changed, 36 insertions(+), 11 deletions(-)
>
> diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
> index 7668a94c..e3fe82fc 100644
> --- a/src/luajit_lldb.py
> +++ b/src/luajit_lldb.py
> @@ -18,6 +18,12 @@ IRT_P64 = 9
>   LJ_GCVMASK = ((1 << 47) - 1)
>   LJ_TISNUM = None
>   
> +# These constants are meaningful only for 'LJ_64' mode.
> +LJ_LIGHTUD_BITS_SEG = 8
> +LJ_LIGHTUD_BITS_LO = 47 - LJ_LIGHTUD_BITS_SEG
> +LIGHTUD_SEG_MASK = (1 << LJ_LIGHTUD_BITS_SEG) - 1
> +LIGHTUD_LO_MASK = (1 << LJ_LIGHTUD_BITS_LO) - 1
> +
>   # Debugger specific {{{
>   
>   
> @@ -440,6 +446,18 @@ def tvisnumber(o):
>       return itype(o) <= LJ_TISNUM
>   
>   
> +def lightudV(tv):
> +    if LJ_64:
> +        u = int(tv['u64'])
> +        # lightudseg macro expanded.
> +        seg = (u >> LJ_LIGHTUD_BITS_LO) & LIGHTUD_SEG_MASK
> +        segmap = mref('uint32_t *', G(L(None))['gc']['lightudseg'])
> +        # lightudlo macro expanded.
> +        return (int(segmap[seg]) << 32) | (u & LIGHTUD_LO_MASK)
> +    else:
> +        return gcval(tv['gcr'])
> +
> +
>   def dump_lj_tnil(tv):
>       return 'nil'
>   
> @@ -453,7 +471,7 @@ def dump_lj_ttrue(tv):
>   
>   
>   def dump_lj_tlightud(tv):
> -    return 'light userdata @ {}'.format(strx64(gcval(tv['gcr'])))
> +    return 'light userdata @ {}'.format(strx64(lightudV(tv)))
>   
>   
>   def dump_lj_tstr(tv):
> diff --git a/test/tarantool-debugger-tests/debug-extension-tests.py b/test/tarantool-debugger-tests/debug-extension-tests.py
> index f3ce3ced..2b67e151 100644
> --- a/test/tarantool-debugger-tests/debug-extension-tests.py
> +++ b/test/tarantool-debugger-tests/debug-extension-tests.py
> @@ -211,23 +211,28 @@ class TestLJTV(TestCaseBase):
>           'lj-tv L->base + 9\n'
>           'lj-tv L->base + 10\n'
>           'lj-tv L->base + 11\n'
> +        'lj-tv L->base + 12\n'
> +        'lj-tv L->base + 13\n'
>       )
>   
> +    # Sorted in LJT order.
>       lua_script = (
>           'local ffi = require("ffi")\n'
>           'print(\n'
>           '  nil,\n'
>           '  false,\n'
>           '  true,\n'
> +        '  debug.upvalueid(print, 1), \n'  # lightuserdata
>           '  "hello",\n'
> -        '  {1},\n'
> -        '  1,\n'
> -        '  1.1,\n'
>           '  coroutine.create(function() end),\n'
> -        '  ffi.new("int*"),\n'
>           '  function() end,\n'
> +        '  require,\n'
>           '  print,\n'
> -        '  require\n'
> +        '  ffi.new("int*"),\n'
> +        '  {1},\n'
> +        '  newproxy(),\n'
> +        '  1,\n'
> +        '  1.1\n'
>           ')\n'
>       )
>   
> @@ -235,15 +240,17 @@ class TestLJTV(TestCaseBase):
>           r'nil\n'
>           r'false\n'
>           r'true\n'
> +        r'light userdata @ ' + RX_ADDR + r'\n'
>           r'string \"hello\" @ ' + RX_ADDR + r'\n'
> -        r'table @ ' + RX_ADDR + r' \(asize: \d+, hmask: ' + RX_HASH + r'\)\n'
> -        r'(number|integer) .*1.*\n'
> -        r'number 1.1\d+\n'
>           r'thread @ ' + RX_ADDR + r'\n'
> -        r'cdata @ ' + RX_ADDR + r'\n'
>           r'Lua function @ ' + RX_ADDR + r', [0-9]+ upvalues, .+:[0-9]+\n'
> -        r'fast function #[0-9]+\n'
>           r'C function @ ' + RX_ADDR + r'\n'
> +        r'fast function #[0-9]+\n'
> +        r'cdata @ ' + RX_ADDR + r'\n'
> +        r'table @ ' + RX_ADDR + r' \(asize: \d+, hmask: ' + RX_HASH + r'\)\n'
> +        r'userdata @ ' + RX_ADDR + r'\n'
> +        r'(number|integer) .*1.*\n'
> +        r'number 1.1\d+\n'
>       )
>   
>   

[-- Attachment #2: Type: text/html, Size: 4214 bytes --]

  reply	other threads:[~2026-05-27 12:28 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-19 12:39 [Tarantool-patches] [PATCH v2 luajit 0/6] Unified extension for debuggers Sergey Kaplun via Tarantool-patches
2026-05-19 12:39 ` [Tarantool-patches] [PATCH v2 luajit 1/6] test: introduce tests for debugging extensions Sergey Kaplun via Tarantool-patches
2026-05-20 13:38   ` Sergey Bronnikov via Tarantool-patches
2026-05-25  9:14     ` Sergey Kaplun via Tarantool-patches
2026-05-27  9:54       ` Sergey Bronnikov via Tarantool-patches
2026-05-27 10:52         ` Sergey Kaplun via Tarantool-patches
2026-05-26 13:50   ` Evgeniy Temirgaleev via Tarantool-patches
2026-05-26 14:41     ` Sergey Kaplun via Tarantool-patches
2026-05-26 18:52       ` Evgeniy Temirgaleev via Tarantool-patches
2026-05-27  7:56         ` Sergey Kaplun via Tarantool-patches
2026-05-27 12:41   ` Sergey Bronnikov via Tarantool-patches
2026-05-19 12:39 ` [Tarantool-patches] [PATCH v2 luajit 2/6] lldb: refactor extension Sergey Kaplun via Tarantool-patches
2026-05-27 12:27   ` Sergey Bronnikov via Tarantool-patches
2026-05-19 12:39 ` [Tarantool-patches] [PATCH v2 luajit 3/6] dbg: sort initialization of commands Sergey Kaplun via Tarantool-patches
2026-05-20 13:43   ` Sergey Bronnikov via Tarantool-patches
2026-05-19 12:39 ` [Tarantool-patches] [PATCH v2 luajit 4/6] lldb: support full-range 64-bit lightuserdata Sergey Kaplun via Tarantool-patches
2026-05-27 12:28   ` Sergey Bronnikov via Tarantool-patches [this message]
2026-05-19 12:39 ` [Tarantool-patches] [PATCH v2 luajit 5/6] dbg: generalize extension Sergey Kaplun via Tarantool-patches
2026-05-27 12:38   ` Sergey Bronnikov via Tarantool-patches
2026-05-27 12:55     ` Sergey Kaplun via Tarantool-patches
2026-05-19 12:39 ` [Tarantool-patches] [PATCH v2 luajit 6/6] ci: introduce workflow to test debugger extension Sergey Kaplun via Tarantool-patches
2026-05-20 13:52   ` Sergey Bronnikov via Tarantool-patches
2026-05-25  7:00     ` Sergey Kaplun via Tarantool-patches
2026-05-27 10:57       ` Sergey Bronnikov via Tarantool-patches
2026-05-27 11:58         ` Sergey Kaplun 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=255e0244-1740-4aca-ba00-33a33480b8d4@tarantool.org \
    --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 v2 luajit 4/6] lldb: support full-range 64-bit lightuserdata' \
    /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