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 14DE970CB2; Mon, 11 Oct 2021 18:21:25 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 14DE970CB2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1633965685; bh=h2pNCjeCOENbefHYIUM9m41lVG7+KmEdlEaWcy5Xd3E=; 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=IiZ1Wg+n5+Bd+j9dQggAGHBp4Ha5ICp31fXLP2H5ymita+aib1cn+D4eT081wl7vt HKdFVN1RGpabXgOxq0Q9KevHVZGY+CbUFJcwJa2YUfXXz6Dxb4c9m5E6nsE47jMQaw zXJIn0yrOWCd4IbDgwfX5rERdCFNBYY3Xx162C04= Received: from smtpng1.i.mail.ru (smtpng1.i.mail.ru [94.100.181.251]) (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 DBA3770CB0 for ; Mon, 11 Oct 2021 18:21:23 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org DBA3770CB0 Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1mZx7D-0004Pa-5u; Mon, 11 Oct 2021 18:21:23 +0300 Date: Mon, 11 Oct 2021 18:19:42 +0300 To: Maxim Kokryashkin Message-ID: References: <20210924162716.101342-1-m.kokryashkin@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210924162716.101342-1-m.kokryashkin@tarantool.org> X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD922964B4BA091D9AC1F0C9337415C671720D63C9783D2B7AE182A05F5380850409C706ACE691440C08A38D6A665CFD404F39677AC29F721873256D1BE724A4D61 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE72F22E6DC541F75D9EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637D3A9DC970DD6E2F6EA1F7E6F0F101C6723150C8DA25C47586E58E00D9D99D84E1BDDB23E98D2D38BBCA57AF85F7723F233A847AB30CE889FA34712146AE9B9F0CC7F00164DA146DAFE8445B8C89999728AA50765F790063783E00425F71A4181389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC8D2DCF9CF1F528DBCF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA7E827F84554CEF5019E625A9149C048EE9ECD01F8117BC8BEE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8B851EDB9C5A93305EEFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-C1DE0DAB: 0D63561A33F958A547A0BF8FD09A986CF23F85A0DC226BF9A6CA2ADE94B60A1CD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA759D2A03B9C34326B3410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34C53D1911AD7E4199A838B029D684DCB98602AC53C7204F7A1952E364BAB7D41521F55D803C2B3B101D7E09C32AA3244C35603130D499964FAED70EBE185ADC1C8A6D4CC6FBFAC251927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioju/+AAevgYAXPNIac37fWlg== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5D3FED632380F57A51DA33712E10740CDE0FBE9A32752B8C9C2AA642CC12EC09F1FB559BB5D741EB962F61BD320559CF1EFD657A8799238ED567EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit] test: adapt tests checking debug line hook trace 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: Sergey Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Maxim! Thanks for the patch! Please consider my comments below. On 24.09.21, Maxim Kokryashkin wrote: > The LuaJIT's virtual machine interprets the bytecode > following the return from function (i.e. the one succeeding > the call made) and located on the line other than that return > bytecode, as a new line trigger for line hooks, unlike Lua > does. > Here is an example (it is joined in one line intend): > > debug.sethook(function(_, l) print("LINE: "..l) end, "l") loadstring("\n\ns=nil")() debug.sethook() > > This chunk prints for LuaJIT: > > LINE: 3 > LINE: 1 > > But for Lua 5.1 it is only "LINE: 3" in the output. > See also https://github.com/tarantool/tarantool/issues/5693. > Considering implementation-defined behaviour difference > (see also https://luajit.org/status.html) test is disabled for > LuaJIT. But the commit adapts the test. Please describe how. > > Closes tarantool/tarantool#5693 > Part of tarantool/tarantool#5845 > Part of tarantool/tarantool#4473 Looks like it should be 5870 instead 4473. Also, 5845 is already closed. > --- > Issue: https://github.com/tarantool/tarantool/issues/5693 > GitHub branch: https://github.com/tarantool/luajit/tree/fckxorg/gh-5693-PUC-Rio-debug-line-hook > > test/PUC-Rio-Lua-5.1-tests/db.lua | 54 ++++++++++++++++--------------- > 1 file changed, 28 insertions(+), 26 deletions(-) > > diff --git a/test/PUC-Rio-Lua-5.1-tests/db.lua b/test/PUC-Rio-Lua-5.1-tests/db.lua > index 56f59ea8..99efe8ef 100644 > --- a/test/PUC-Rio-Lua-5.1-tests/db.lua > +++ b/test/PUC-Rio-Lua-5.1-tests/db.lua > @@ -8,6 +8,26 @@ do > local a=1 > end > > +-- The LuaJIT's virtual machine interprets the bytecode > +-- following the return from function (i.e. the one succeeding > +-- the call made) and located on the line other than that return > +-- bytecode, as a new line trigger for line hooks, unlike Lua > +-- does. > +-- Here is an example (it is joined in one line intend): > +--[[ > +debug.sethook(function(_, l) print("LINE: "..l) end, "l") loadstring("\n\ns=nil")() debug.sethook() > +--]] > +-- This chunk prints for LuaJIT: > +--[[ > +LINE: 3 > +LINE: 1 > +--]] > +-- But for Lua 5.1 it is only "LINE: 3" in the output. > +-- See also https://github.com/tarantool/tarantool/issues/5693. > +-- Considering implementation-defined behaviour difference > +-- (see also https://luajit.org/status.html) test is disabled for > +-- LuaJIT. But it is not disabled after this commit. > +-- This function is modified to correspond with LuaJIT's line triggers. > function test (s, l, p) > collectgarbage() -- avoid gc during trace > local function f (event, line) > @@ -16,7 +36,7 @@ function test (s, l, p) > if p then print(l, line) end > assert(l == line, "wrong trace!!") > end > - debug.sethook(f,"l"); loadstring(s)(); debug.sethook() > + local cur_line = debug.getinfo(1).currentline; table.insert(l, 1, cur_line); table.insert(l, cur_line); debug.sethook(f,"l"); loadstring(s)(); debug.sethook() For what do we need additional insert? And why is it on the same line? > assert(table.getn(l) == 0) > end > > @@ -25,7 +45,7 @@ do > @@ -168,8 +170,8 @@ test([[for i,v in pairs{'a','b'} do > end > ]], {1,2,1,2,1,3}) > > -test([[for i=1,4 do a=1 end]], {1,1,1,1,1}) > ---]=] > +-- Test is adapted to the behaviour of LuaJIT. > +test([[for i=1,4 do a=1 end]], {1,1,1,1}) Why are there 4 entries instead 5? > > > print'+' > -- > 2.33.0 > -- Best regards, Sergey Kaplun