[Tarantool-patches] [PATCH v2 luajit 0/3] Introduce gdb extension for LuaJIT

Igor Munkin imun at tarantool.org
Mon Mar 2 19:00:44 MSK 2020


OK, this fix doesn't work e.g. for luajit w/o debuginfo. Consider the
following:

| <snipped>
| luajit-gdb.py initialization is postponed until libluajit objfile is loaded
| Reading symbols from /home/imun/projects/tarantool-luajit/src/luajit...
| (No debugging symbols found in /home/imun/projects/tarantool-luajit/src/luajit)
| luajit-gdb.py initialization is postponed until libluajit objfile is loaded
| <snipped>

The extension initialization goes in loops, since it fails to find
luaJIT_setmode global symbol. I didn't investigate the problem a lot,
just made the extension work.

On 28.02.20, Igor Munkin wrote:

<snipped>

> +    if not gdb.lookup_global_symbol('luaJIT_setmode'):
> +        gdb.write('luajit-gdb.py initialization is postponed '
> +                  'until libluajit objfile is loaded\n')
> +        gdb.events.new_objfile.connect(load)
> +        return
> +

Here is the problem, so I rewrote it the following way:

================================================================================

diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
index 2e20642..f142fc5 100644
--- a/src/luajit-gdb.py
+++ b/src/luajit-gdb.py
@@ -662,7 +662,9 @@ The command requires no args and dumps current GC stats:
 def init(commands):
     global LJ_64, LJ_GC64, LJ_FR2
 
-    if not gdb.lookup_global_symbol('luaJIT_setmode'):
+    try:
+        gdb.parse_and_eval('luaJIT_setmode')
+    except:
         gdb.write('luajit-gdb.py initialization is postponed '
                   'until libluajit objfile is loaded\n')
         gdb.events.new_objfile.connect(load)

================================================================================

Squashed, force-pushed to the branch.

<snipped>

> 
> -- 
> Best regards,
> IM

-- 
Best regards,
IM


More information about the Tarantool-patches mailing list