From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 95359469719 for ; Mon, 2 Mar 2020 19:06:05 +0300 (MSK) Date: Mon, 2 Mar 2020 19:00:44 +0300 From: Igor Munkin Message-ID: <20200302160044.GX404@tarantool.org> References: <20200226224148.pq3mqfd4amh63rqd@tkn_work_nb> <20200228104613.GQ404@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200228104613.GQ404@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH v2 luajit 0/3] Introduce gdb extension for LuaJIT List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Turenko Cc: tarantool-patches@dev.tarantool.org OK, this fix doesn't work e.g. for luajit w/o debuginfo. Consider the following: | | 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 | 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: > + 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. > > -- > Best regards, > IM -- Best regards, IM