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 2CDC26EC40; Wed, 30 Jun 2021 17:20:24 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2CDC26EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1625062824; bh=ITmKH7lYlqoI/OBZuBzmO930xwd2uNtojFyekLC4vGs=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=gKzHQkZ08kyWqQw2L2DeEIVZhWr7Ti91BvQ1wLqIMwbkaa08AG/TGTmYhdzVHqL78 Fp/3K2aYoZ9Q4Ox9LOqAPqrTQiGhqLWPTyQpJVd/sFTBRYSG5u1lFypNhHQ1rvRyzt GAqwrMirmDH/mb9xOZoBVTH2UDHcu25hrp2Zf+/s= Received: from smtp30.i.mail.ru (smtp30.i.mail.ru [94.100.177.90]) (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 1752F6EC40 for ; Wed, 30 Jun 2021 17:20:22 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 1752F6EC40 Received: by smtp30.i.mail.ru with esmtpa (envelope-from ) id 1lyb4f-0003KM-6U; Wed, 30 Jun 2021 17:20:21 +0300 To: tarantool-patches@dev.tarantool.org, imun@tarantool.org, skaplun@tarantool.org Date: Wed, 30 Jun 2021 17:20:20 +0300 Message-Id: <20210630142020.326411-1-m.shishatskiy@tarantool.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-4EC0790: 2 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD954DFF1DC42D673FB4F75AC5594ACDC16869A51A860A12816182A05F538085040FA8DFA457CC99E744073D08B5F34BDD379B9BDE7C685E0DB71704C5D0E691F72 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE77AA33865E80AF043EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637BB2557E27C12D3EF8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D83709965BDB2849F7885349D7AB63017F117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCAA867293B0326636D2E47CDBA5A96583BD4B6F7A4D31EC0BC014FD901B82EE079FA2833FD35BB23D27C277FBC8AE2E8BF1175FABE1C0F9B6A471835C12D1D977C4224003CC836476EB9C4185024447017B076A6E789B0E975F5C1EE8F4F765FC92E945CA19D5D9D23AA81AA40904B5D9CF19DD082D7633A078D18283394535A93AA81AA40904B5D98AA50765F7900637EFEE248DCEC35FEAD81D268191BDAD3D698AB9A7B718F8C4D1B931868CE1C5781A620F70A64A45A98AA50765F79006372E808ACE2090B5E1725E5C173C3A84C3C5EA940A35A165FF2DBA43225CD8A89FBC98423A6B99EAC057739F23D657EF2BB5C8C57E37DE458BEDA766A37F9254B7 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2AD77751E876CB595E8F7B195E1C97831CD9927ABEA1E6DCED5EE6400B98F466E X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975CA007D7800FCDDA271E2DE8B9560CB4BB3FBE6EB298C228F29C2B6934AE262D3EE7EAB7254005DCED71D53F46A3E560A81E0A4E2319210D9B64D260DF9561598F01A9E91200F654B0F5DD670F6F5D62878E8E86DC7131B365E7726E8460B7C23C X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34AC6E62257D6CD1C92B33C3DB199E888B1BC22A1648015F9F7C90BEB5B8771159792ACD162C503B991D7E09C32AA3244C5D64E7F2F0BF18B2B1DA738ED78E2D10408A6A02710B7304FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojbL9S8ysBdXhkkDFj3GPz2dQnqrm4czJp X-Mailru-Sender: EFA0F3A8419EF21622E4D85484454F2CA2F92D41B5EAA6E94073D08B5F34BDD3B67A942A63B4089A2376072A51849BFFE66B5C1DBFD5D09D5E022D45988A037B448E0EA96F20AB367402F9BA4338D657ED14614B50AE0675 X-Mras: Ok Subject: [Tarantool-patches] [PATCH] luajit-gdb: fix misalignment in lj-stack 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: Mikhail Shishatskiy via Tarantool-patches Reply-To: Mikhail Shishatskiy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" When LJ_GC64 was enabled, the alignment of stack slots printed by lj-stack command failed. It looked like the following: | 0x7ffff7fb0d90:0x7ffff7fb0dc0 [ ] 7 slots: Red zone | 0x7ffff7fb0d88 [ M] | 0x7ffff7fb0cc0:0x7ffff7fb0d80 [ ] 25 slots: Free stack slots | 0x7ffff7fb0cb8 [ T ] This patch fixes the output to look as expected: | 0x7ffff7fb0d90:0x7ffff7fb0dc0 [ ] 7 slots: Red zone | 0x7ffff7fb0d88 [ M] | 0x7ffff7fb0cc0:0x7ffff7fb0d80 [ ] 25 slots: Free stack slots | 0x7ffff7fb0cb8 [ T ] To test changes do the following: | $ gdb -q --args ./luajit -e 'print("QQ")' | Reading symbols from ./luajit... | lj-arch command initialized | lj-tv command initialized | lj-str command initialized | lj-tab command initialized | lj-stack command initialized | lj-state command initialized | lj-gc command initialized | luajit-gdb.py is successfully loaded | (gdb) lj-arch | LJ_64: True, LJ_GC64: True | (gdb) b lj_cf_print | Breakpoint 1 at 0x298b0: file /mnt/WorkDisk/share/dev/__tarantool/lj-tarantool/src/lib_base.c, line 485. | (gdb) r | Starting program: /mnt/WorkDisk/share/dev/__tarantool/lj-tarantool/src/luajit -e print\(\"QQ\"\) | | Breakpoint 1, lj_cf_print (L=0x0) | at /mnt/WorkDisk/share/dev/__tarantool/lj-tarantool/src/lib_base.c:485 | 485 { | (gdb) s | 486 ptrdiff_t i, nargs = L->top - L->base; | (gdb) lj-stack L | 0x7ffff7fa8d90:0x7ffff7fa8dc0 [ ] 7 slots: Red zone | 0x7ffff7fa8d88 [ M] | 0x7ffff7fa8cc0:0x7ffff7fa8d80 [ ] 25 slots: Free stack slots | 0x7ffff7fa8cb8 [ T ] | 0x7ffff7fa8cb0 [ B ] VALUE: string "QQ" @ 0x7ffff7fb1178 | 0x7ffff7fa8ca0:0x7ffff7fa8ca8 [ ] FRAME: [L] delta=2, fast function #29 | 0x7ffff7fa8c90:0x7ffff7fa8c98 [ ] FRAME: [V] delta=2, Lua function @ 0x7ffff7fb1240, 0 upvalues, "=(command line)":0 | 0x7ffff7fa8c80:0x7ffff7fa8c88 [ ] FRAME: [CP] delta=4, Lua function @ 0x7ffff7fb1240, 0 upvalues, "=(command line)":0 | 0x7ffff7fa8c78 [ ] VALUE: C function @ 0x55555555c962 | 0x7ffff7fa8c70 [ ] VALUE: light userdata @ 0x0 | 0x7ffff7fa8c60:0x7ffff7fa8c68 [ ] FRAME: [CP] delta=2, C function @ 0x55555555df1c | 0x7ffff7fa8c58:0x7ffff7fa8c60 [S ] FRAME: dummy L Fixes: tarantool/tarantool#5876 Branch: https://github.com/tarantool/luajit/tree/shishqa/gh-5876 --- src/luajit-gdb.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py index f1fd6230..720d989a 100644 --- a/src/luajit-gdb.py +++ b/src/luajit-gdb.py @@ -160,7 +160,7 @@ LJ_FR2 = None LJ_GCVMASK = ((1 << 47) - 1) -PADDING = ' ' * len(':' + hex((1 << (47 if LJ_GC64 else 32)) - 1)) +PADDING = None # }}} @@ -665,7 +665,7 @@ The command requires no args and dumps current GC stats: )) def init(commands): - global LJ_64, LJ_GC64, LJ_FR2 + global LJ_64, LJ_GC64, LJ_FR2, PADDING # XXX Fragile: though connecting the callback looks like a crap but it # respects both Python 2 and Python 3 (see #4828). @@ -714,6 +714,8 @@ def init(commands): for name, command in commands.items(): command(name) + PADDING = ' ' * len(':' + hex((1 << (47 if LJ_GC64 else 32)) - 1)) + gdb.write('luajit-gdb.py is successfully loaded\n') def load(event=None): -- 2.32.0