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>,
	Evgeniy Temirgaleev <e.temirgaleev@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit 2/4] dbg: fix DUALNUM detection for LLDB
Date: Fri, 5 Jun 2026 17:57:16 +0300	[thread overview]
Message-ID: <a6dee9f3-d54c-4b13-8671-df546cd569f5@tarantool.org> (raw)
In-Reply-To: <20260604093052.2221827-3-skaplun@tarantool.org>

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

Hi, Sergey,

thanks for the patch! LGTM with a minor comment below.

Sergey

On 6/4/26 12:30, Sergey Kaplun wrote:
> The `lj-arch` command on LLDB reports 'LJ_DUALNUM: True' for the
> single-number build since the `module.FindSymbol()` returns an invalid
> `SBSymbol` object [1], which is not `None`. This leads to invalid
> DUALNUM mode detection.
>
> This patch fixes this by checking that the returned symbol is valid.
>
> [1]:https://lldb.llvm.org/python_api/lldb.SBModule.html#lldb.SBModule.FindSymbol
> ---
>   src/luajit_dbg.py                                 |  3 ++-
>   .../debug-extension-tests.py                      | 15 +++++++++++++--
>   2 files changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/src/luajit_dbg.py b/src/luajit_dbg.py
> index 410f0191..300d65e9 100644
> --- a/src/luajit_dbg.py
> +++ b/src/luajit_dbg.py

I believe DUALNUM should be added to the help for `lj-arch`. Now it 
describes only LJ_64, LJ_GC64:

| (gdb) help lj-arch
| lj-arch
|
| The command requires no args and dumps values of LJ_64 and LJ_GC64
| compile-time flags. These values define the sizes of host and GC
| pointers, respectively.
| (gdb)

> @@ -498,7 +498,8 @@ class _LLDBDebugger(Debugger):
>           global LJ_64, LJ_DUALNUM, LJ_FR2, LJ_GC64
>           IRT_P64 = 9
>           module = self.target.modules[0]
> -        LJ_DUALNUM = module.FindSymbol('lj_lib_checknumber') is not None
> +        dualnum_sym = module.FindSymbol('lj_lib_checknumber')
> +        LJ_DUALNUM = dualnum_sym is not None and dualnum_sym.IsValid()
>           irtype_enum = self.target.FindFirstType('IRType').enum_members
>           for member in irtype_enum:
>               if member.name == 'IRT_PTR':
> diff --git a/test/tarantool-debugger-tests/debug-extension-tests.py b/test/tarantool-debugger-tests/debug-extension-tests.py
> index 7cb60d84..06a118ff 100644
> --- a/test/tarantool-debugger-tests/debug-extension-tests.py
> +++ b/test/tarantool-debugger-tests/debug-extension-tests.py
> @@ -92,6 +92,17 @@ def execute_process(cmd, timeout=TIMEOUT):
>           return process.stdout
>   
>   
> +IS_DUALNUM = execute_process([
> +    LUAJIT_BINARY, '-e', "print(require('ffi').abi('dualnum'))"
> +]).strip() == 'true'
> +
> +# If it is the guaranteed DUALNUM build (for example, on aarch64),
> +# we use this regexp for the guaranteed 'integer' check and
> +# 'number' for single-number build.
> +RX_INT = r'integer' if IS_DUALNUM else r'number'
> +RX_ISDUALNUM = r'True' if IS_DUALNUM else r'False'
> +
> +
>   class TestCaseBase(unittest.TestCase):
>       @classmethod
>       def construct_cmds(cls):
> @@ -150,7 +161,7 @@ class TestLJArch(TestCaseBase):
>       pattern = (
>           r'LJ_64: (True|False), '
>           r'LJ_GC64: (True|False), '
> -        r'LJ_DUALNUM: (True|False)'
> +        r'LJ_DUALNUM: ' + RX_ISDUALNUM
>       )
>   
>   
> @@ -265,7 +276,7 @@ class TestLJTV(TestCaseBase):
>           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'
> +        RX_INT + r' .*1.*\n'
>           r'number 1.1\d+\n'
>       )
>   

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

  reply	other threads:[~2026-06-05 14:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-04  9:30 [Tarantool-patches] [PATCH luajit 0/4] Introduce dumpers for bytecodes in debuggers Sergey Kaplun via Tarantool-patches
2026-06-04  9:30 ` [Tarantool-patches] [PATCH luajit 1/4] dbg: fix lj-stack command for LLDB Sergey Kaplun via Tarantool-patches
2026-06-05 14:55   ` Sergey Bronnikov via Tarantool-patches
2026-06-04  9:30 ` [Tarantool-patches] [PATCH luajit 2/4] dbg: fix DUALNUM detection " Sergey Kaplun via Tarantool-patches
2026-06-05 14:57   ` Sergey Bronnikov via Tarantool-patches [this message]
2026-06-05 16:01     ` Sergey Kaplun via Tarantool-patches
2026-06-04  9:30 ` [Tarantool-patches] [PATCH luajit 3/4] dbg: introduce lj-gco command Sergey Kaplun via Tarantool-patches
2026-06-05 15:02   ` Sergey Bronnikov via Tarantool-patches
2026-06-04  9:30 ` [Tarantool-patches] [PATCH luajit 4/4] dbg: introduce lj-bc, lj-func and lj-proto dumpers Sergey Kaplun via Tarantool-patches
2026-06-05 15:07   ` Sergey Bronnikov via Tarantool-patches
2026-06-05 16:10     ` Sergey Kaplun via Tarantool-patches
2026-06-05 14:55 ` [Tarantool-patches] [PATCH luajit 0/4] Introduce dumpers for bytecodes in debuggers Sergey Bronnikov via Tarantool-patches
2026-06-05 16:03 ` [Tarantool-patches] [PATCH luajit 3/5] dbg: update help for the lj-arch command 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=a6dee9f3-d54c-4b13-8671-df546cd569f5@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=e.temirgaleev@tarantool.org \
    --cc=sergeyb@tarantool.org \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit 2/4] dbg: fix DUALNUM detection for LLDB' \
    /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