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 7237F6EC55; Thu, 22 Jul 2021 16:58:02 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 7237F6EC55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1626962282; bh=q1kv8oXMTobJr5QV05WBw9nqqkQuMRS11OvjaBim7M4=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=etcUAD91x0lVX65FmSi6yquNn2tk72ZLuFJ3n3ZsFspWhmrcrNxBtlPWZR7jYAG88 AmTBhvFJrU5xxhyPz9x44X0CC+wRUuSzBmlQhdUoD9xH0XuJ7AcZfI9/v7Ryy4lT6Q qMigt/mP0oHdUk43406TBVjOfmYWqSPzZXijHJls= Received: from smtpng2.i.mail.ru (smtpng2.i.mail.ru [94.100.179.3]) (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 5DE226EC55 for ; Thu, 22 Jul 2021 16:58:00 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5DE226EC55 Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1m6ZD5-00010v-C7; Thu, 22 Jul 2021 16:57:59 +0300 Date: Thu, 22 Jul 2021 16:34:24 +0300 To: Sergey Kaplun Message-ID: <20210722133424.GN11494@tarantool.org> References: <20210618062234.871-1-skaplun@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210618062234.871-1-skaplun@tarantool.org> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.10.1 (2018-07-13) X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD941C43E597735A9C30288BCF456A452EC92BAB6D044D5CCDE182A05F538085040ACE1DDEC92961B5DE9B457D540FE3230E788F6E388883862265DE1EC4FBE4FEC X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7E1F5C7CA1DBFB751EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637E8D1333770DC60CDEA1F7E6F0F101C6723150C8DA25C47586E58E00D9D99D84E1BDDB23E98D2D38BBCA57AF85F7723F2F7905A01F9DFCE2BDA67D780D3880CB1CC7F00164DA146DAFE8445B8C89999728AA50765F7900637F6B57BC7E64490618DEB871D839B7333395957E7521B51C2DFABB839C843B9C08941B15DA834481F8AA50765F7900637F6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA7E827F84554CEF5019E625A9149C048EE9ECD01F8117BC8BEE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8B779389CF6F126FEC75ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A514A8777E379B03DD3D83C1D5D3786A36F2981E32E5155F37D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7501A9DF589746230F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3473457D764E1CDE775524016599E183937753F5CDC4B907038EF6915BBEE254022E84674B57C045D31D7E09C32AA3244CCB4A0AE2F0092246C91641ABBA6BAD1EF94338140B71B8EE927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojaAaPr+N/4d0/S1lFwJVSKQ== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5D02A2B0A683D298BBF6B9C2DB598E9CF7A7C8D0F45F857DBFE9F1EFEE2F478337FB559BB5D741EB964C8C2C849690F8E70A04DAD6CC59E33667EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit v1] tools: fix luajit-gdb stack dump 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: Igor Munkin via Tarantool-patches Reply-To: Igor Munkin Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Sergey, I've checked the patch into all long-term branches in tarantool/luajit and bumped a new version in 1.10, 2.7, 2.8 and master. On 18.06.21, Sergey Kaplun wrote: > When there is only one frame (so-called dummy frame) with a dummy thread > on stack bottom at L->base - 1 - LJ_FR2, stack dump does not show stack > slots from bottom to top, because the frame link is already pointed to > stack bottom (dummy thread mentioned above). Its output looks like the > following: > > | 0x7fb512ac40:0x7fb512ac70 [ ] 7 slots: Red zone > | 0x7fb512ac38 [ M] > | 0x7fb512ab28:0x7fb512ac30 [ ] 34 slots: Free stack slots > | 0x7fb512ab20 [ T ] > | 0x7fb512ab08:0x7fb512ab10 [S ] FRAME: dummy L > > This patch unrolled first loop iteration. Stack dump first inspect all > fields for the top frame and then continue if there are other frames. > After patch the output looks like the following: > > | 0x7fb512ac40:0x7fb512ac70 [ ] 7 slots: Red zone > | 0x7fb512ac38 [ M] > | 0x7fb512ab28:0x7fb512ac30 [ ] 34 slots: Free stack slots > | 0x7fb512ab20 [ T ] > | 0x7fb512ab18 [ ] VALUE: string 0 "/tmp/net_box.lua:6: err in ser" @ 0x7fb512ade8 > | 0x7fb512ab10 [ B ] VALUE: table @ 0x7fb512ac80 (asize: 0, hmask: 0x0) > | 0x7fb512ab00:0x7fb512ab08 [S ] FRAME: dummy L > --- > > Branch: https://github.com/tarantool/luajit/tree/skaplun/fix-luajit-gdb > > Steps to test behaviour: > 0) Clone branch > 1) Build tarantool with GC64 or not (I've tested both cases) > 2) Run the following script by Tarantool via gdb. > > | $ cat /tmp/netbox.lua > | box.cfg{log_level = 50, listen = "127.0.0.1:3802"} > | box.schema.user.grant('guest','read,write,execute','universe', nil, {if_not_exists=true}) > | local net_box = require"net.box" > | local cn = net_box:connect("127.0.0.1:3802") > | local function f() > | return setmetatable({}, {__serialize = function() error[[err in ser]] end}) > | end > | _G.f = f > | local r, st = cn:call("f") > | print(r,st) > > | $ gdb --args ./tarantool /tmp/netbox.lua > | ... > | (gdb) source ~/builds_workspace/luajit/fix-luajit-gdb/src/luajit-gdb.py > | ... > > 3) Set breakpoint to ./src/lua/msgpack.c:234, and run > > | (gdb) b ./src/lua/msgpack.c:234 > > I'm not sure about your sources version, so you can just set breakpoin to > mp_encode(), run and continue (need two entries). We are interested in > the line #234: > > | 233|.......if (luaL_tofield(L, cfg, opts, lua_gettop(L), &field) < 0) > | 234|.......|.......return luaT_error(L); > > And dump the stack: > > | (gdb) lj-stack L > | 0x7fb512ac40:0x7fb512ac70 [ ] 7 slots: Red zone > | 0x7fb512ac38 [ M] > | 0x7fb512ab28:0x7fb512ac30 [ ] 34 slots: Free stack slots > | 0x7fb512ab20 [ T ] > | 0x7fb512ab18 [ ] VALUE: string 0 "/tmp/net_box.lua:6: err in ser" @ 0x7fb512ade8 > | 0x7fb512ab10 [ B ] VALUE: table @ 0x7fb512ac80 (asize: 0, hmask: 0x0) > | 0x7fb512ab00:0x7fb512ab08 [S ] FRAME: dummy L > > src/luajit-gdb.py | 16 +++++++++++++--- > 1 file changed, 13 insertions(+), 3 deletions(-) > > -- > 2.31.0 > -- Best regards, IM