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 E17A76EC55; Thu, 22 Jul 2021 15:11:57 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E17A76EC55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1626955918; bh=EnRroMe1NU2gYFH35iyy8WC/SwoyQ4iBVpiYIt/i8ZA=; 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=gLQs6HzjnQQHXEI6iSlpOfTnPxMwP/za4UC/t87jeeXOapM+EeSRna5ha3hmAUHO0 ONUo3JO45+yC3zZmYPZp47NIyowVvU1kpK/LRWTzmJwtc94j7Xw2Iw9MlFp/WtY2da sdrN55pnrMxBM6EyQR+rRp+e0P1GyL/xJxZH4Xgo= 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 62AAF6EC55 for ; Thu, 22 Jul 2021 15:11:57 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 62AAF6EC55 Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1m6XYS-0007qT-9y; Thu, 22 Jul 2021 15:11:56 +0300 Date: Thu, 22 Jul 2021 14:48:21 +0300 To: Sergey Ostanevich Message-ID: <20210722114821.GM11494@tarantool.org> References: <20210618062234.871-1-skaplun@tarantool.org> <20210720122952.GH11494@tarantool.org> <20210721085411.GJ11494@tarantool.org> <3E1848F9-799D-4A38-9E7C-CD218ADFDF54@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3E1848F9-799D-4A38-9E7C-CD218ADFDF54@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: 4F1203BC0FB41BD941C43E597735A9C3FDAB68B812060C77E621B90589399EB5182A05F5380850400A9059CC153F50F17130524E2DA2DCA736D6AF042F7552628E67F5CA5E844CBE X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE727FD6E7FC3A8F857EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063770398A047C76876C8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D85B5F6485CBAD46506C6D2A3B489647EA117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC8C7ADC89C2F0B2A5A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735201E561CDFBCA1751F618001F51B5FD3F9D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B67ECBC18655D52CDF089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 0D63561A33F958A560886AB3174B496978914CDA4356F611C2AAAA28CEBCA01DD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7501A9DF589746230F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3454E98140CCACB5B3AD44F785A74268E08BEAB14BFFFE721545E7B768D702D755293F18AF2E468C2C1D7E09C32AA3244C6842B5F1FE4691120E923364078E7DB0D08D48398F32B4A6927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojaAaPr+N/4d005MIZVvf6gQ== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5D5902C795B2A9CCCD351DEC2DD62495C7A7C8D0F45F857DBFE9F1EFEE2F478337FB559BB5D741EB964C8C2C849690F8E70A04DAD6CC59E33667EA787935ED9F1B 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" Sergos, Thanks for your review! TL;DR: I would rather leave the patch with no changes, but please consider my comments regarding your alternative approach for iterating through the guest stack. On 22.07.21, Sergey Ostanevich wrote: > Hi! > > Thanks for the patch! > > I would rather remove all mentions of ‘bottom loop’ as we named it at > Intel. I'm not a big pro in python, still the ‘for’ loop works fine > for me: > > If we can unwind to the next frame - dump it (and further) > > >>> s=[1] > >>> for i in s: > ... if (i==1): > ... s.append(2) > ... continue > ... print(i) > ... > 2 > > If it is the only one (dummy): > > >>> s=[3] > >>> for i in s: > ... if (i==1): > ... s.append(2) > ... continue > ... print(i) > ... > 3 > > Does it make sense in this case? Let's see what would we get for our case with guest stack unwinding. The algorithm is described by Sergey in the comment near the loop. But imagine, we are iterating (backwards) through [L->stack, L-top] segment via for loop (as you suggest above). There is one condition to check whether we have reached the bottom of the frame (dump framelink slot and continue the same way you showed above). However, we need one more condition to skip the second slot for the framelink in LJ_FR2 mode. As a result we have a loop that iterates through the stack with at least two conditions to skip some slots or dump them in other way. Furthermore, your proposal leads to much more complex change in the extension, comparing to those made by Sergey. As I've already said, postcondition loop is the classic way for this case. Moreover, I googled "how to emulate a do-while loop in Python?" and the second option is unrolling the first iteration[1]. If one wonders what is the first option -- use "while-true" loop with the conditional break at the end. I equally hate both, so I'm OK with the one chosen by Sergey. If you prefer "while-true", I believe Sergey can rewrite this part, but considering your LGTM below, I guess you're OK also with the current solution. So, I'll push the patch in a jiffy. > > Anyways, it’s too much of nitpicking - LGTM in its current version. > > Regards, > Sergos > > > [1]: https://stackoverflow.com/a/743186 -- Best regards, IM