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 EAAB6142A59; Fri, 2 Dec 2022 13:30:55 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org EAAB6142A59 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1669977056; bh=ESsndL+ZfN7+De0DFTm3UmE2uCsgbaxT2M2opQPIi30=; 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=qWMO9Szzt5WFpDiIBiHAwAWRgiIfAwQIo0hZMmULVi/KAS8N/3zxR92cLMl4WQobh mpcLzt62npaFKGlQXlUK0CJrMTHFBEJgSs4ed+nqEnXy3owjlPY731hwdnCrKgGODQ ZvvW5FQffxa+QdXeuwvpvD9Qf07D/bu4OfTwNO1s= 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 510D4141D45 for ; Fri, 2 Dec 2022 13:30:55 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 510D4141D45 Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1p13Jm-0002TC-G9; Fri, 02 Dec 2022 13:30:54 +0300 Date: Fri, 2 Dec 2022 13:16:59 +0300 To: Maxim Kokryashkin Message-ID: References: <20221201211500.44362-1-m.kokryashkin@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20221201211500.44362-1-m.kokryashkin@tarantool.org> X-Clacks-Overhead: GNU Terry Pratchett X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD908190A22B884CF14ED37B92A3B9588C6C18087BAA9678AAF182A05F5380850405471E32716EB6FAF314CED9200D6158F7157672731DDEC97698E2941C33DF17D X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE70A10A23A3B64B805EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006376CE4E8B6A85920B98638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D87D65B3509CDFF8F13F3044E3A56E731F117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCF1175FABE1C0F9B6A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735204B6963042765DA4B2CC0D3CB04F14752D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B67393CE827C55B5F775ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D348F9E8EBB46231487EC0325733574EBB63A18E6A9ACA5A0B1E70E154FE8A359BF62B6401CA2891D131D7E09C32AA3244CD0492E0A4895FE64A760D0AC3076BF665595C85A795C7BAE83B48618A63566E0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojdH6LJGuFcaqIVaseR6Gs3A== X-DA7885C5: D0EB814F72F96CFE4C6B33BB76B3706182E7B16ED52C875E4373646C610535AA262E2D401490A4A0DB037EFA58388B346E8BC1A9835FDE71 X-Mailru-Sender: 689FA8AB762F73933AF1F914F131DBF59550FAF0AF7456AF8F0BFC400A890700A7C8D0F45F857DBFE9F1EFEE2F478337FB559BB5D741EB964C8C2C849690F8E70A04DAD6CC59E3365FEEDEB644C299C0ED14614B50AE0675 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH] gdb: support full-range 64-bit lightuserdata 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" Max, Thanks for the fixes, but the patch doesn't work now. See my comments below. On 02.12.22, Maxim Kokryashkin wrote: > Following up the introduction of full-range 64-bit lightuserdata > support in commit 2cacfa8e7ffefb715abf55dc5b0c708c63251868 ('Add > support for full-range 64 bit lightuserdata.'), this patch > modifies the corresponding dumper behavior for LJ_64 platforms > in the luajit-gdb extension. > > Resolves tarantool/tarantool#6481 > --- > src/luajit-gdb.py | 20 +++++++++++++++++++- > 1 file changed, 19 insertions(+), 1 deletion(-) > > diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py > index 6480d014..e5c94000 100644 > --- a/src/luajit-gdb.py > +++ b/src/luajit-gdb.py > @@ -166,6 +166,12 @@ LJ_GCVMASK = ((1 << 47) - 1) > LJ_TISNUM = None > PADDING = None > > +# These constants are meaningful only for 'LJ_64' mode. > +LJ_LIGHTUD_BITS_SEG = 8 > +LJ_LIGHTUD_BITS_LO = 47 - LJ_LIGHTUD_BITS_SEG > +LIGHTUD_SEG_MASK = (1 << LJ_LIGHTUD_BITS_SEG) - 1 > +LIGHTUD_LO_MASK = (1 << LJ_LIGHTUD_BITS_LO) - 1 > + > # }}} > > def itype(o): > @@ -315,6 +321,18 @@ def frames(L): > break > framelink = frame_prev(framelink) > This variable is always false at the moment of declaration, so the hack doesn't work... > +if LJ_64: > + def lightudV(tv): > + u = int(tv['u64']) > + # lightudseg macro expanded. > + seg = (u >> LJ_LIGHTUD_BITS_LO) & LIGHTUD_SEG_MASK > + segmap = mref('uint32_t *', G(L(None))['gc']['lightudseg']) > + # lightudlo macro expanded. > + return (int(segmap[seg]) << 32) | (u & LIGHTUD_LO_MASK) > +else: > + def lightudV(tv): > + return gcval(tv['gcr']) > + In my previous review I meant something similar to the following: | import random | | LJ_64 = None | | def lightudV_segmented(): | print(LJ_64, "Segmented lightuserdata is used") | | def lightudV_raw(): | print(LJ_64, "Raw lightuserdata is used") | | def init(): | global lightudV, LJ_64 | LJ_64 = random.randint(0, 1) | lightudV = lightudV_segmented if LJ_64 else lightudV_raw | | init() | lightudV() In other words, you have to choose the implementation of lightudV on extension initilalization step (when LJ_64 is resolved), not on script load phase. > # Dumpers {{{ > > def dump_lj_tnil(tv): > @@ -327,7 +345,7 @@ def dump_lj_ttrue(tv): > return 'true' > > def dump_lj_tlightud(tv): > - return 'light userdata @ {}'.format(strx64(gcval(tv['gcr']))) > + return 'light userdata @ {}'.format(strx64(lightudV(tv))) > > def dump_lj_tstr(tv): > return 'string {body} @ {address}'.format( > -- > 2.38.1 > -- Best regards, IM