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 AEF246F867; Tue, 1 Feb 2022 00:37:58 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org AEF246F867 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1643665078; bh=cO2ij6kQwQ2to+y9VA3x6RSsqn3YwUxf91sff3inoVM=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=g+8/jx0dJpqadoNEroyBMyccKzw6+AIO0dzJvG4Yy7tsw+KUC5z/s/lBqw8YVfdxV wBwe4XdsRVYZXfslOisn1OarpI3OFN8ISgD3OTjmbRUpCPqydcK5fxBATl+OhWyfAR jjF7IhDgxQZ4GiVd11mo3vweH3rswYoEAyDkMna8= Received: from smtpng3.i.mail.ru (smtpng3.i.mail.ru [94.100.177.149]) (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 EE7626F868 for ; Tue, 1 Feb 2022 00:36:55 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org EE7626F868 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1nEeM3-0002SX-1l; Tue, 01 Feb 2022 00:36:55 +0300 To: Sergey Kaplun , Maxim Kokryashkin Date: Tue, 1 Feb 2022 00:33:55 +0300 Message-Id: <793426cc622083a73c9f8f2ff34779b7b82cb7f8.1643645066.git.imun@tarantool.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD99F281FB7F96F126D5C01C79F7F2485624D256791FCB2EE0000894C459B0CD1B98A42C750E7AFA4E2FAE3E5314372447187F19ABF61EF05D6599FBF3E6EA3F319 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE75644E22E05AA81AEB287FD4696A6DC2FA8DF7F3B2552694A4E2F5AFA99E116B42401471946AA11AFEE3A9D0FB4FE0F9920D3C300AFAD22438F08D7030A58E5AD1A62830130A00468AEEEE3FBA3A834EE7353EFBB55337566CED4562AEA10A75FD8B6A6FEEA42E48652A014AED7B4A795A471835C12D1D9774AD6D5ED66289B5278DA827A17800CE74601F13E4625331C9FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C30AA277257C6A5E3D117882F4460429728AD0CFFFB425014E868A13BD56FB6657E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637149D0840703ADBE5EFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-8FC586DF: 6EFBBC1D9D64D975 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975CCED4562AEA10A75FD8B6A6FEEA42E48652A014AED7B4A7959C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EF166FC1BB2721D293DC48ACC2A39D04F89CDFB48F4795C241BDAD6C7F3747799A X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34AF61ACC197BF517A510F8F40C06689DF8D08209EA21B3D55B60A21BAA66313842FD15297B21642041D7E09C32AA3244CA47F019E7FEFDDB6ED28BFDC11364D63250262A5EE9971B0927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojj6iw2H+lRYwtPJnBn+3eTA== X-Mailru-Sender: 689FA8AB762F739339CABD9B3CA9A7D6405785761574B5C402239758190B60E9A7C8D0F45F857DBFE9F1EFEE2F478337FB559BB5D741EB964C8C2C849690F8E70A04DAD6CC59E3365FEEDEB644C299C0ED14614B50AE0675 X-Mras: Ok Subject: [Tarantool-patches] [PATCH 2/2] gdb: add mmudata value to lj-gc output 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" As a result of this patch gc.mmudata> value representing the amount of GC object to be finalized is added to output. All auxiliary routines are also adjusted a bit since these GC objects are grouped in a ring-list. Signed-off-by: Igor Munkin --- src/luajit-gdb.py | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py index 758ba10c..baf66f66 100644 --- a/src/luajit-gdb.py +++ b/src/luajit-gdb.py @@ -179,6 +179,9 @@ def gcval(obj): return cast('GCobj *', obj['gcptr64'] & LJ_GCVMASK if LJ_GC64 else cast('uintptr_t', obj['gcptr32'])) +def gcnext(obj): + return gcref(obj)['gch']['nextgc'] + def L(L=None): # lookup a symbol for the main coroutine considering the host app # XXX Fragile: though the loop initialization looks like a crap but it @@ -272,13 +275,30 @@ def funcproto(func): return cast('GCproto *', mref('char *', func['pc']) - gdb.lookup_type('GCproto').sizeof) -def gclistlen(root): +def gclistlen(root, end=0x0): count = 0 - while(gcref(root)): + while(gcref(root) != end): count += 1 - root = gcref(root)['gch']['nextgc'] + root = gcnext(root) return count +def gcringlen(root): + if not gcref(root): + return 0 + elif gcref(root) == gcref(gcnext(root)): + return 1 + else: + return 1 + gclistlen(gcnext(root), gcref(root)) + +gclen = { + 'root': gclistlen, + 'gray': gclistlen, + 'grayagain': gclistlen, + 'weak': gclistlen, + # XXX: gc.mmudata is a ring-list. + 'mmudata': gcringlen, +} + # Dumpers {{{ def dump_lj_tnil(tv): @@ -482,11 +502,9 @@ def dump_gc(g): ) ] stats += [ '{key}: {number} objects'.format( - key = f, - number = gclistlen(gc[f]), - ) for f in ('root', 'gray', 'grayagain', 'weak') ] - - # TODO: mmudata + key = stat, + number = handler(gc[stat]) + ) for stat, handler in gclen.items() ] return '\n'.join(map(lambda s: '\t' + s, stats)) @@ -686,6 +704,7 @@ The command requires no args and dumps current GC stats: * gray: * grayagain: * weak: +* mmudata: ''' def invoke(self, arg, from_tty): -- 2.34.0