From: Igor Munkin via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: Sergey Kaplun <skaplun@tarantool.org>, Maxim Kokryashkin <m.kokryashkin@tarantool.org> Cc: tarantool-patches@dev.tarantool.org Subject: [Tarantool-patches] [PATCH 2/2] gdb: add mmudata value to lj-gc output Date: Tue, 1 Feb 2022 00:33:55 +0300 [thread overview] Message-ID: <793426cc622083a73c9f8f2ff34779b7b82cb7f8.1643645066.git.imun@tarantool.org> (raw) In-Reply-To: <cover.1643645066.git.imun@tarantool.org> As a result of this patch <g->gc.mmudata> value representing the amount of GC object to be finalized is added to <lj-gc> output. All auxiliary routines are also adjusted a bit since these GC objects are grouped in a ring-list. Signed-off-by: Igor Munkin <imun@tarantool.org> --- 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: <number of gray objects> * grayagain: <number of objects for atomic traversal> * weak: <number of weak tables (to be cleared)> +* mmudata: <number of udata|cdata to be finalized> ''' def invoke(self, arg, from_tty): -- 2.34.0
next prev parent reply other threads:[~2022-01-31 21:37 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-01-31 21:33 [Tarantool-patches] [PATCH 0/2] Minor enhancements in luajit-gdb.py Igor Munkin via Tarantool-patches 2022-01-31 21:33 ` [Tarantool-patches] [PATCH 1/2] gdb: unwind Lua stack top part Igor Munkin via Tarantool-patches 2022-02-09 10:14 ` Sergey Kaplun via Tarantool-patches 2022-02-09 18:02 ` Maxim Kokryashkin via Tarantool-patches 2022-02-11 19:11 ` Igor Munkin via Tarantool-patches 2022-02-11 19:11 ` Igor Munkin via Tarantool-patches 2022-01-31 21:33 ` Igor Munkin via Tarantool-patches [this message] 2022-02-09 10:29 ` [Tarantool-patches] [PATCH 2/2] gdb: add mmudata value to lj-gc output Sergey Kaplun via Tarantool-patches 2022-02-09 18:11 ` Maxim Kokryashkin via Tarantool-patches 2022-02-11 19:12 ` Igor Munkin via Tarantool-patches 2022-02-11 19:12 ` Igor Munkin via Tarantool-patches 2022-02-01 10:17 ` [Tarantool-patches] [PATCH 0/2] Minor enhancements in luajit-gdb.py Igor Munkin via Tarantool-patches 2022-02-11 20:42 ` Igor Munkin via Tarantool-patches
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=793426cc622083a73c9f8f2ff34779b7b82cb7f8.1643645066.git.imun@tarantool.org \ --to=tarantool-patches@dev.tarantool.org \ --cc=imun@tarantool.org \ --cc=m.kokryashkin@tarantool.org \ --cc=skaplun@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH 2/2] gdb: add mmudata value to lj-gc output' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox