-# Set up a mask to use.
-
# Force loading of symbols, enough to give us gdb_valbits etc.
set main
+# Find lwlib source files too.
+dir ../lwlib
+
+# Don't enter GDB when user types C-g to quit.
+# This has one unfortunate effect: you can't type C-c
+# at the GDB to stop Emacs, when using X.
+# However, C-z works just as well in that case.
+handle 2 noprint pass
+
+# Set up a mask to use.
# This should be EMACS_INT, but in some cases that is a macro.
# long ought to work in all cases right now.
set $valmask = ((long)1 << gdb_valbits) - 1
# Set up something to print out s-expressions.
define pr
set debug_print ($)
-echo \n
end
document pr
Print the emacs s-expression which is $.
Print the pointer portion of $, assuming it is an Emacs Lisp value.
end
-define xwindow
-print (struct window *) (($ & $valmask) | gdb_data_seg_bits)
-printf "%dx%d+%d+%d\n", $->width, $->height, $->left, $->top
-end
-document xwindow
-Print $ as a window pointer, assuming it is an Emacs Lisp window value.
-Print the window's position as "WIDTHxHEIGHT+LEFT+TOP".
-end
-
define xmarker
print (struct Lisp_Marker *) (($ & $valmask) | gdb_data_seg_bits)
end
Print $ as a buffer-local-value pointer, assuming it is an Emacs Lisp Misc value.
end
-define xbuffer
-print (struct buffer *) (($ & $valmask) | gdb_data_seg_bits)
-output &((struct Lisp_String *) ((($->name) & $valmask) | gdb_data_seg_bits))->data
-echo \n
-end
-document xbuffer
-Set $ as a buffer pointer, assuming it is an Emacs Lisp buffer value.
-Print the name of the buffer.
-end
-
define xsymbol
print (struct Lisp_Symbol *) ((((int) $) & $valmask) | gdb_data_seg_bits)
-output &$->name->data
+output (char*)&$->name->data
echo \n
end
document xsymbol
define xstring
print (struct Lisp_String *) (($ & $valmask) | gdb_data_seg_bits)
-output ($->size > 1000) ? 0 : ($->data[0])@($->size)
+output ($->size > 1000) ? 0 : ($->data[0])@($->size_byte < 0 ? $->size : $->size_byte)
echo \n
end
document xstring
This command assumes that $ is an Emacs Lisp vector value.
end
+define xprocess
+print (struct Lisp_Process *) (($ & $valmask) | gdb_data_seg_bits)
+output *$
+echo \n
+end
+document xprocess
+Print the address of the struct Lisp_process which the Lisp_Object $ points to.
+end
+
define xframe
print (struct frame *) (($ & $valmask) | gdb_data_seg_bits)
end
Print $ as a frame pointer, assuming it is an Emacs Lisp frame value.
end
+define xcompiled
+print (struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits)
+output ($->contents[0])@($->size & 0xff)
+end
+document xcompiled
+Print $ as a compiled function pointer, assuming it is an Emacs Lisp compiled value.
+end
+
+define xwindow
+print (struct window *) (($ & $valmask) | gdb_data_seg_bits)
+printf "%dx%d+%d+%d\n", $->width, $->height, $->left, $->top
+end
+document xwindow
+Print $ as a window pointer, assuming it is an Emacs Lisp window value.
+Print the window's position as "WIDTHxHEIGHT+LEFT+TOP".
+end
+
define xwinconfig
print (struct save_window_data *) (($ & $valmask) | gdb_data_seg_bits)
end
Print $ as a window configuration pointer, assuming it is an Emacs Lisp window configuration value.
end
-define xcompiled
-print (struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits)
-output ($->contents[0])@($->size & 0xff)
+define xsubr
+print (struct Lisp_Subr *) (($ & $valmask) | gdb_data_seg_bits)
+output *$
+echo \n
end
-document xcompiled
-Print $ as a compiled function pointer, assuming it is an Emacs Lisp compiled value.
+document xsubr
+Print the address of the subr which the Lisp_Object $ points to.
+end
+
+define xchartable
+print (struct Lisp_Char_Table *) (($ & $valmask) | gdb_data_seg_bits)
+printf "Purpose: "
+output (char*)&((struct Lisp_Symbol *) ((((int) $->purpose) & $valmask) | gdb_data_seg_bits))->name->data
+printf " %d extra slots", ($->size & 0x1ff) - 388
+echo \n
+end
+document xchartable
+Print the address of the char-table $, and its purpose.
+This command assumes that $ is an Emacs Lisp char-table value.
+end
+
+define xboolvector
+print (struct Lisp_Bool_Vector *) (($ & $valmask) | gdb_data_seg_bits)
+output ($->size > 256) ? 0 : ($->data[0])@(($->size + 7)/ 8)
+echo \n
+end
+document xboolvector
+Print the contents and address of the bool-vector $.
+This command assumes that $ is an Emacs Lisp bool-vector value.
+end
+
+define xbuffer
+print (struct buffer *) (($ & $valmask) | gdb_data_seg_bits)
+output &((struct Lisp_String *) ((($->name) & $valmask) | gdb_data_seg_bits))->data
+echo \n
+end
+document xbuffer
+Set $ as a buffer pointer, assuming it is an Emacs Lisp buffer value.
+Print the name of the buffer.
end
define xcons
print (struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits)
-output *$
+output/x *$
echo \n
end
document xcons
Print the contents of $, assuming it is an Emacs Lisp cons.
end
+define nextcons
+p $.cdr
+xcons
+end
+document nextcons
+Print the contents of the next cell in a list.
+This assumes that the last thing you printed was a cons cell contents
+(type struct Lisp_Cons) or a pointer to one.
+end
define xcar
-print ((($ >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits))->car : 0)
+print/x ((($ >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits))->car : 0)
end
document xcar
Print the car of $, assuming it is an Emacs Lisp pair.
end
define xcdr
-print ((($ >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits))->cdr : 0)
+print/x ((($ >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits))->cdr : 0)
end
document xcdr
Print the cdr of $, assuming it is an Emacs Lisp pair.
end
-define xsubr
-print (struct Lisp_Subr *) (($ & $valmask) | gdb_data_seg_bits)
-output *$
-echo \n
-end
-document xsubr
-Print the address of the subr which the Lisp_Object $ points to.
-end
-
-define xprocess
-print (struct Lisp_Process *) (($ & $valmask) | gdb_data_seg_bits)
-output *$
-echo \n
-end
-document xprocess
-Print the address of the struct Lisp_process which the Lisp_Object $ points to.
-end
-
define xfloat
print ((struct Lisp_Float *) (($ & $valmask) | gdb_data_seg_bits))->data
end