From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 57BDC6ECF8; Wed, 27 May 2026 15:28:48 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 57BDC6ECF8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1779884928; bh=53jj13xVQfK0UbThz0UUfqMJf/Myk2c27xesHw6CkjI=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=PUubL/pojfSPYDlI2HQV7potRXdY3lcT+/DPM2apQy4rLMUV0DeihIPzRJMavsUmO Xj6DPd46LxixzrPu6Nuvc0hBEqEgN1adZyJ4bDUpzGkHawc1C4xWfP6Fh8r0Bqs2VQ JVIf1wyKseGW5vPQeb2SlEM9lnO0ybbvRNPp2hIY= Received: from send126.i.mail.ru (send126.i.mail.ru [89.221.237.221]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id E67EA6ECF8 for ; Wed, 27 May 2026 15:28:46 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E67EA6ECF8 Received: by exim-smtp-5b85998476-prrqw with esmtpa (envelope-from ) id 1wSDNM-00000000GMX-1xA0; Wed, 27 May 2026 15:28:46 +0300 Content-Type: multipart/alternative; boundary="------------gfneWwKWdyw13vSVlY7YrMBb" Message-ID: <255e0244-1740-4aca-ba00-33a33480b8d4@tarantool.org> Date: Wed, 27 May 2026 15:28:43 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Sergey Kaplun , Mikhail Elhimov , Evgeniy Temirgaleev Cc: tarantool-patches@dev.tarantool.org References: <20260519123913.178775-1-skaplun@tarantool.org> <20260519123913.178775-5-skaplun@tarantool.org> In-Reply-To: <20260519123913.178775-5-skaplun@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-618D5548: F2AEF890F8EF619C479CDAE959BF6424B09290FDB7A549DD83F1BADCC4CECF4209E207FA0D3910A6 X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD98DC58EE55F2C5C375FDB769493B02C03EB2180AF4F58A6CD00894C459B0CD1B9F2AEF890F8EF619C479CDAE959BF6424E9D58DB674B0919E83F1BADCC4CECF42F8D9167951636918 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE779AAD18609327F83EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637F28F4AF03526AA8F8638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B202EE8BDD3C551DAE2E070BE324C7D3C4EFB07BFF59F8C979F6B57BC7E64490618DEB871D839B73339E8FC8737B5C2249E5E764EB5D94DBD4CC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92176DF2183F8FC7C0B27420F9988F54058941B15DA834481F9449624AB7ADAF372E808ACE2090B5E14AD6D5ED66289B5259CC434672EE63711DD303D21008E298D5E8D9A59859A8B6B372FE9A2E580EFC725E5C173C3A84C30B8B320EE581A76035872C767BF85DA2F004C90652538430E4A6367B16DE6309 X-C1DE0DAB: 0D63561A33F958A55C898CD04F5C76EB5002B1117B3ED6965F64F512EC8B01294869453249F34FA4823CB91A9FED034534781492E4B8EEADEF0AF71940E62277BDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0ADB58128AB1E6D661A716CD42B3DD1D34CAB70F9BE574AE9C625B6776AC983F447FC0B9F89525902EE6F57B2FD27647F25E66C117BDB76D6591862AE4E21898C00639B490798E32417D8E85B54B8EF9FE4C6F1DF9566F93E6D359F1D7D3ACD9116B8341EE9D5BE9A0A203669F2B44424ECC52DF169D7DB73831EC7C9ED2138B23EC7CEAA0681F5848F4C41F94D744909CE2512F26BEC029E55448553D2254B8D95CD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVax5M0mESuWmNYOjTVb5Kq8= X-DA7885C5: 87748CA58B42512AF255D290C0D534F9FA976750970F8FE3C20A4006BB8DD59878C7E5CA953C50115B1A4C17EAA7BC4BEF2421ABFA55128DAF83EF9164C44C7E X-Mailru-Sender: 689FA8AB762F7393520AF17B8A65FDE2B510FC1B927110A5DDDC270DC476458A44E40511C5E1D148EF86D5F70DA33880E41E8EF7A07863ECB274557F927329BE2DDF8182D28ACDB545BD1C3CC395C826B4A721A3011E896F X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 luajit 4/6] lldb: support full-range 64-bit lightuserdata X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This is a multi-part message in MIME format. --------------gfneWwKWdyw13vSVlY7YrMBb Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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' > ) > > --------------gfneWwKWdyw13vSVlY7YrMBb Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

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'
     )
 
 
--------------gfneWwKWdyw13vSVlY7YrMBb--