1 # Force loading of symbols, enough to give us gdb_valbits etc.
4 # Find lwlib source files too.
7 # Don't enter GDB when user types C-g to quit.
8 # This has one unfortunate effect: you can't type C-c
9 # at the GDB to stop Emacs, when using X.
10 # However, C-z works just as well in that case.
13 # Set up a mask to use.
14 # This should be EMACS_INT, but in some cases that is a macro.
15 # long ought to work in all cases right now.
16 set $valmask = ((long)1 << gdb_valbits) - 1
17 set $nonvalbits = gdb_emacs_intbits - gdb_valbits
19 # Set up something to print out s-expressions.
24 Print the emacs s-expression which is $.
25 Works only when an inferior emacs is executing.
29 output (enum Lisp_Type) (($ >> gdb_valbits) & 0x7)
31 output ((($ >> gdb_valbits) & 0x7) == Lisp_Misc ? (enum Lisp_Misc_Type) (((struct Lisp_Free *) (($ & $valmask) | gdb_data_seg_bits))->type) : (($ >> gdb_valbits) & 0x7) == Lisp_Vectorlike ? ($size = ((struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits))->size, (enum pvec_type) (($size & PVEC_FLAG) ? $size & PVEC_TYPE_MASK : 0)) : 0)
35 Print the type of $, assuming it is an Emacs Lisp value.
36 If the first type printed is Lisp_Vector or Lisp_Misc,
37 the second line gives the more precise type.
38 Otherwise the second line doesn't mean anything.
42 set $size = ((struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits))->size
43 output (enum pvec_type) (($size & PVEC_FLAG) ? $size & PVEC_TYPE_MASK : 0)
47 Print the vector subtype of $, assuming it is a vector or pseudovector.
51 output (enum Lisp_Misc_Type) (((struct Lisp_Free *) (($ & $valmask) | gdb_data_seg_bits))->type)
55 Print the specific type of $, assuming it is some misc type.
59 print (($ & $valmask) << $nonvalbits) >> $nonvalbits
62 Print $, assuming it is an Emacs Lisp integer. This gets the sign right.
66 print (void *) (($ & $valmask) | gdb_data_seg_bits)
69 Print the pointer portion of $, assuming it is an Emacs Lisp value.
73 print (struct window *) (($ & $valmask) | gdb_data_seg_bits)
74 printf "%dx%d+%d+%d\n", $->width, $->height, $->left, $->top
77 Print $ as a window pointer, assuming it is an Emacs Lisp window value.
78 Print the window's position as "WIDTHxHEIGHT+LEFT+TOP".
82 print (struct Lisp_Marker *) (($ & $valmask) | gdb_data_seg_bits)
85 Print $ as a marker pointer, assuming it is an Emacs Lisp marker value.
89 print (struct Lisp_Overlay *) (($ & $valmask) | gdb_data_seg_bits)
92 Print $ as a overlay pointer, assuming it is an Emacs Lisp overlay value.
96 print (struct Lisp_Free *) (($ & $valmask) | gdb_data_seg_bits)
99 Print $ as a misc free-cell pointer, assuming it is an Emacs Lisp Misc value.
103 print (struct Lisp_Intfwd *) (($ & $valmask) | gdb_data_seg_bits)
106 Print $ as an integer forwarding pointer, assuming it is an Emacs Lisp Misc value.
110 print (struct Lisp_Boolfwd *) (($ & $valmask) | gdb_data_seg_bits)
113 Print $ as a boolean forwarding pointer, assuming it is an Emacs Lisp Misc value.
117 print (struct Lisp_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
120 Print $ as an object forwarding pointer, assuming it is an Emacs Lisp Misc value.
124 print (struct Lisp_Buffer_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
127 Print $ as a buffer-local object forwarding pointer, assuming it is an Emacs Lisp Misc value.
131 print (struct Lisp_Kboard_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
134 Print $ as a kboard-local object forwarding pointer, assuming it is an Emacs Lisp Misc value.
138 print (struct Lisp_Buffer_Local_Value *) (($ & $valmask) | gdb_data_seg_bits)
141 Print $ as a buffer-local-value pointer, assuming it is an Emacs Lisp Misc value.
145 print (struct buffer *) (($ & $valmask) | gdb_data_seg_bits)
146 output &((struct Lisp_String *) ((($->name) & $valmask) | gdb_data_seg_bits))->data
150 Set $ as a buffer pointer, assuming it is an Emacs Lisp buffer value.
151 Print the name of the buffer.
155 print (struct Lisp_Symbol *) ((((int) $) & $valmask) | gdb_data_seg_bits)
156 output (char*)&$->name->data
160 Print the name and address of the symbol $.
161 This command assumes that $ is an Emacs Lisp symbol value.
165 print (struct Lisp_String *) (($ & $valmask) | gdb_data_seg_bits)
166 output ($->size > 1000) ? 0 : ($->data[0])@($->size_byte)
170 Print the contents and address of the string $.
171 This command assumes that $ is an Emacs Lisp string value.
175 print (struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits)
176 output ($->size > 50) ? 0 : ($->contents[0])@($->size)
180 Print the contents and address of the vector $.
181 This command assumes that $ is an Emacs Lisp vector value.
185 print (struct frame *) (($ & $valmask) | gdb_data_seg_bits)
188 Print $ as a frame pointer, assuming it is an Emacs Lisp frame value.
192 print (struct save_window_data *) (($ & $valmask) | gdb_data_seg_bits)
195 Print $ as a window configuration pointer, assuming it is an Emacs Lisp window configuration value.
199 print (struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits)
200 output ($->contents[0])@($->size & 0xff)
203 Print $ as a compiled function pointer, assuming it is an Emacs Lisp compiled value.
207 print (struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits)
212 Print the contents of $, assuming it is an Emacs Lisp cons.
220 Print the contents of the next cell in a list.
221 This assumes that the last thing you printed was a cons cell contents
222 (type struct Lisp_Cons) or a pointer to one.
225 print/x ((($ >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits))->car : 0)
228 Print the car of $, assuming it is an Emacs Lisp pair.
232 print/x ((($ >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits))->cdr : 0)
235 Print the cdr of $, assuming it is an Emacs Lisp pair.
239 print (struct Lisp_Subr *) (($ & $valmask) | gdb_data_seg_bits)
244 Print the address of the subr which the Lisp_Object $ points to.
248 print (struct Lisp_Process *) (($ & $valmask) | gdb_data_seg_bits)
253 Print the address of the struct Lisp_process which the Lisp_Object $ points to.
257 print ((struct Lisp_Float *) (($ & $valmask) | gdb_data_seg_bits))->data
260 Print $ assuming it is a lisp floating-point number.
264 print (struct scrollbar *) (($ & $valmask) | gdb_data_seg_bits)
269 Print $ as a scrollbar pointer.
273 set print sevenbit-strings
275 show environment DISPLAY
276 show environment TERM
277 set args -geometry 80x40+0+0
279 # Don't let abort actually run, as it will make
280 # stdio stop working and therefore the `pr' command above as well.
283 # If we are running in synchronous mode, we want a chance to look around
284 # before Emacs exits. Perhaps we should put the break somewhere else
286 break x_error_quitter