From: Igor Munkin <imun@tarantool.org> To: tarantool-patches@dev.tarantool.org Subject: [Tarantool-patches] [PATCH luajit 0/4] Introduce gdb extension for LuaJIT Date: Mon, 27 Jan 2020 23:41:04 +0300 [thread overview] Message-ID: <cover.1580157324.git.imun@tarantool.org> (raw) The series provides a gdb extension with commands for inspecting LuaJIT internals. The following set of commands is implemented now: ### lj-arch The command requires no args and dumps values of LJ_64 and LJ_GC64 compile-time flags. These values define the sizes of host and GC pointers respectively. NB: Compile-time defines are checked when script is being loaded: * When LJ_64 is enabled IRT_PTR is an IRT_P64 alias and an IRT_P32 one otherwise * When LJ_64 is enabled IRT_PGC is an IRT_P64 alias and an IRT_P32 one otherwise ### lj-tv The command recieves a <tv address> (TValue address) and dumps the type and some info related to it. * LJ_TNIL: nil * LJ_TFALSE: false * LJ_TTRUE: true * LJ_TLIGHTUD: light userdata @ <gcr> * LJ_TSTR: string <string payload> @ <gcr> * LJ_TUPVAL: upvalue @ <gcr> * LJ_TTHREAD: thread @ <gcr> * LJ_TPROTO: proto @ <gcr> * LJ_TFUNC: <LFUNC|CFUNC|FFUNC> - <LFUNC>: Lua function @ <gcr>, <nupvals> upvalues, <chunk:line> - <CFUNC>: C function <mcode address> - <FFUNC>: fast function #<ffid> * LJ_TTRACE: trace <traceno> @ <gcr> * LJ_TCDATA: cdata @ <gcr> * LJ_TTAB: table @ <gcr> (asize: <asize>, hmask: <hmask>) * LJ_TUDATA: userdata @ <gcr> * LJ_TNUMX: number <numeric payload> Whether the type of the given address differs from the listed above, then error message occurs. ### lj-str The command recieves a <gcr> of the corresponding GCstr object and dumps the payload, size in bytes and hash. *Caveat*: Since Python 2 provides no native Unicode support, the payload is replaced with the corresponding error when decoding fails. ### lj-tab The command recieves a GCtab address and dumps the table contents: * Metatable address whether the one is set * Array part <asize> slots: <aslot ptr>: [<index>]: <tv> * Hash part <hsize> nodes: <hnode ptr>: { <tv> } => { <tv> }; next = <next hnode ptr> ### lj-stack The command recieves a lua_State address and dumps the given Lua coroutine guest stack: <slot ptr> [<slot attributes>] <VALUE|FRAME> * <slot ptr>: guest stack slot address * <slot attributes>: - S: Bottom of the stack (the slot L->stack points to) - B: Base of the current guest frame (the slot L->base points to) - T: Top of the current guest frame (the slot L->top points to) - M: Last slot of the stack (the slot L->maxstack points to) * <VALUE>: see help lj-tv for more info * <FRAME>: framelink slot differs from the value slot: it contains info related to the function being executed within this guest frame, its type and link to the parent guest frame [<frame type>] delta=<slots in frame>, <lj-tv for LJ_TFUNC slot> - <frame type>: + L: VM performs a call as a result of bytecode execution + C: VM performs a call as a result of lj_vm_call + M: VM performs a call to a metamethod as a result of bytecode execution + V: Variable-length frame for storing arguments of a variadic function + CP: Protected C frame + PP: VM performs a call as a result of executinig pcall or xpcall If L is ommited the main coroutine is used. ### lj-state The command requires no args and dumps current VM and GC states * VM state: <INTERP|C|GC|EXIT|RECORD|OPT|ASM|TRACE> * GC state: <PAUSE|PROPAGATE|ATOMIC|SWEEPSTRING|SWEEP|FINALIZE|LAST> * JIT state: <IDLE|ACTIVE|RECORD|START|END|ASM|ERR> ### lj-gc The command requires no args and dumps current GC stats: * total: <total number of allocated bytes in GC area> * threshold: <limit when gc step is triggered> * debt: <how much GC is behind schedule> * estimate: <estimate of memory actually in use> * stepmul: <incremental GC step granularity> * pause: <pause between successive GC cycles> * sweepstr: <sweep position in string table> * root: <number of all collectable objects> * gray: <number of gray objects> * grayagain: <number of objects for atomic traversal> * weak: <number of weak tables (to be cleared)> Signed-off-by: Igor Munkin <imun@tarantool.org> --- Branch: https://github.com/tarantool/luajit/tree/imun/luajit-gdb Igor Munkin (4): gdb: introduce luajit-gdb extension gdb: make existing commands more verbose gdb: make several enhancements gdb: adjust extension to be used with Python 2 src/luajit-gdb.py | 699 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 699 insertions(+) create mode 100644 src/luajit-gdb.py -- 2.24.0
next reply other threads:[~2020-01-27 20:43 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-01-27 20:41 Igor Munkin [this message] 2020-01-27 20:41 ` [Tarantool-patches] [PATCH luajit 1/4] gdb: introduce luajit-gdb extension Igor Munkin 2020-01-27 20:41 ` [Tarantool-patches] [PATCH luajit 2/4] gdb: make existing commands more verbose Igor Munkin 2020-01-27 20:41 ` [Tarantool-patches] [PATCH luajit 3/4] gdb: make several enhancements Igor Munkin 2020-01-27 20:41 ` [Tarantool-patches] [PATCH luajit 4/4] gdb: adjust extension to be used with Python 2 Igor Munkin 2020-02-03 13:48 ` [Tarantool-patches] [PATCH luajit 0/4] Introduce gdb extension for LuaJIT Sergey Ostanevich
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=cover.1580157324.git.imun@tarantool.org \ --to=imun@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH luajit 0/4] Introduce gdb extension for LuaJIT' \ /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