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