From 28c1e1cac4e08aa5dc31ff628e67fe1f90bec3a0 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Fri, 5 May 2006 23:56:35 +0000 Subject: [PATCH] (xframe): Print frame name. (xlist): New command to print a list (max 10 elements). (xpr): Print lisp object of any type. (pitx): Print it->pixel_width. --- src/.gdbinit | 155 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 154 insertions(+), 1 deletion(-) diff --git a/src/.gdbinit b/src/.gdbinit index 5b2b358a22f..04581efcbb1 100644 --- a/src/.gdbinit +++ b/src/.gdbinit @@ -211,6 +211,7 @@ define pitx printf "vpos=%d hpos=%d", $it->vpos, $it->hpos, printf " y=%d lvy=%d", $it->current_y, $it->last_visible_y printf " x=%d vx=%d-%d", $it->current_x, $it->first_visible_x, $it->last_visible_x + printf " w=%d", $it->pixel_width printf " a+d=%d+%d=%d", $it->ascent, $it->descent, $it->ascent+$it->descent printf " max=%d+%d=%d", $it->max_ascent, $it->max_descent, $it->max_ascent+$it->max_descent printf "\n" @@ -544,6 +545,10 @@ end define xframe xgetptr $ print (struct frame *) $ptr + xgetptr $->name + set $ptr = (struct Lisp_String *) $ptr + xprintstr $ptr + echo \n end document xframe Print $ as a frame pointer, assuming it is an Emacs Lisp frame value. @@ -676,6 +681,31 @@ document xcdr Print the cdr of $, assuming it is an Emacs Lisp pair. end +define xlist + xgetptr $ + set $cons = (struct Lisp_Cons *) $ptr + xgetptr Qnil + set $nil = $ptr + set $i = 0 + while $cons != $nil && $i < 10 + p/x $cons->car + xpr + xgetptr $cons->u.cdr + set $cons = (struct Lisp_Cons *) $ptr + set $i = $i + 1 + printf "---\n" + end + if $cons == $nil + printf "nil\n" + else + printf "...\n" + p $ptr + end +end +document xlist +Print $ assuming it is a list. +end + define xfloat xgetptr $ print ((struct Lisp_Float *) $ptr)->u.data @@ -694,6 +724,108 @@ document xscrollbar Print $ as a scrollbar pointer. end +define xpr + xtype + if $type == Lisp_Int + xint + end + if $type == Lisp_Symbol + xsymbol + end + if $type == Lisp_String + xstring + end + if $type == Lisp_Cons + xcons + end + if $type == Lisp_Float + xfloat + end + if $type == Lisp_Misc + set $misc = (enum Lisp_Misc_Type) (((struct Lisp_Free *) $ptr)->type) + if $misc == Lisp_Misc_Free + xmiscfree + end + if $misc == Lisp_Misc_Boolfwd + xboolfwd + end + if $misc == Lisp_Misc_Marker + xmarker + end + if $misc == Lisp_Misc_Intfwd + xintfwd + end + if $misc == Lisp_Misc_Boolfwd + xboolfwd + end + if $misc == Lisp_Misc_Objfwd + xobjfwd + end + if $misc == Lisp_Misc_Buffer_Objfwd + xbufobjfwd + end + if $misc == Lisp_Misc_Buffer_Local_Value + xbuflocal + end +# if $misc == Lisp_Misc_Some_Buffer_Local_Value +# xvalue +# end + if $misc == Lisp_Misc_Overlay + xoverlay + end + if $misc == Lisp_Misc_Kboard_Objfwd + xkbobjfwd + end +# if $misc == Lisp_Misc_Save_Value +# xsavevalue +# end + end + if $type == Lisp_Vectorlike + set $size = ((struct Lisp_Vector *) $ptr)->size + if ($size & PVEC_FLAG) + set $vec = (enum pvec_type) ($size & PVEC_TYPE_MASK) + if $vec == PVEC_NORMAL_VECTOR + xvector + end + if $vec == PVEC_PROCESS + xprocess + end + if $vec == PVEC_FRAME + xframe + end + if $vec == PVEC_COMPILED + xcompiled + end + if $vec == PVEC_WINDOW + xwindow + end + if $vec == PVEC_WINDOW_CONFIGURATION + xwinconfig + end + if $vec == PVEC_SUBR + xsubr + end + if $vec == PVEC_CHAR_TABLE + xchartable + end + if $vec == PVEC_BOOL_VECTOR + xboolvector + end + if $vec == PVEC_BUFFER + xbuffer + end + if $vec == PVEC_HASH_TABLE + xhashtable + end + else + xvector + end + end +end +document xpr +Print $ as a lisp object of any type. +end + define xprintstr set $data = $arg0->data output ($arg0->size > 1000) ? 0 : ($data[0])@($arg0->size_byte < 0 ? $arg0->size & ~gdb_array_mark_flag : $arg0->size_byte) @@ -716,7 +848,7 @@ define xbacktrace xgettype (*$bt->function) if $type == Lisp_Symbol xprintsym (*$bt->function) - echo \n + printf " (0x%x)\n", *$bt->args else printf "0x%x ", *$bt->function if $type == Lisp_Vectorlike @@ -737,6 +869,27 @@ document xbacktrace an error was signaled. end +define which + set debug_print (which_symbols ($arg0)) +end +document which + Print symbols which references a given lisp object, + either as its symbol value or symbol function. +end + +define xbytecode + set $bt = byte_stack_list + while $bt + xgettype ($bt->byte_string) + printf "0x%x => ", $bt->byte_string + which $bt->byte_string + set $bt = $bt->next + end +end +document xbytecode + Print a backtrace of the byte code stack. +end + # Show Lisp backtrace after normal backtrace. define hookpost-backtrace set $bt = backtrace_list