From 725a2a21a06a55748e22dcc3b934575c58baa9dd Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 10 Jun 2024 21:12:12 +0300 Subject: [PATCH] Allow to print treesit objects from GDB * src/.gdbinit (xtsparser, xtsnode, xtsquery): New functions. (xpr): Call them for treesit objects. (cherry picked from commit aca5de19b86c973bf303de936bdd06dbb86c023e) --- src/.gdbinit | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/.gdbinit b/src/.gdbinit index 7645d466a5e..0f55cc18699 100644 --- a/src/.gdbinit +++ b/src/.gdbinit @@ -926,6 +926,36 @@ Set $ as a hash table pointer. This command assumes that $ is an Emacs Lisp hash table value. end +define xtsparser + xgetptr $ + print (struct Lisp_TS_Parser *) $ptr + output *$ + echo \n +end +document xtsparser +Print the address of the treesit-parser which the Lisp_Object $ points to. +end + +define xtsnode + xgetptr $ + print (struct Lisp_TS_Node *) $ptr + output *$ + echo \n +end +document xtsnode +Print the address of the treesit-node which the Lisp_Object $ points to. +end + +define xtsquery + xgetptr $ + print (struct Lisp_TS_Query *) $ptr + output *$ + echo \n +end +document xtsquery +Print the address of the treesit-query which the Lisp_Object $ points to. +end + define xcons xgetptr $ print (struct Lisp_Cons *) $ptr @@ -1069,6 +1099,15 @@ define xpr if $vec == PVEC_HASH_TABLE xhashtable end + if $vec == PVEC_TS_PARSER + xtsparser + end + if $vec == PVEC_TS_NODE + xtsnode + end + if $vec == PVEC_TS_QUERY + xtsquery + end else xvector end -- 2.39.2