1 # Force loading of symbols, enough to give us gdb_valbits etc.
4 # Find lwlib source files too.
6 dir /gd/gnu/lesstif-0.89.9/lib/Xm
8 # Don't enter GDB when user types C-g to quit.
9 # This has one unfortunate effect: you can't type C-c
10 # at the GDB to stop Emacs, when using X.
11 # However, C-z works just as well in that case.
14 # Don't pass SIGALRM to Emacs. This makes problems when
18 # Set up a mask to use.
19 # This should be EMACS_INT, but in some cases that is a macro.
20 # long ought to work in all cases right now.
21 set $valmask = ((long)1 << gdb_valbits) - 1
22 set $nonvalbits = gdb_emacs_intbits - gdb_valbits
24 # Set up something to print out s-expressions.
29 Print the emacs s-expression which is $.
30 Works only when an inferior emacs is executing.
34 output (enum Lisp_Type) (($ >> gdb_valbits) & 0x7)
36 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)
40 Print the type of $, assuming it is an Emacs Lisp value.
41 If the first type printed is Lisp_Vector or Lisp_Misc,
42 the second line gives the more precise type.
43 Otherwise the second line doesn't mean anything.
47 set $size = ((struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits))->size
48 output (enum pvec_type) (($size & PVEC_FLAG) ? $size & PVEC_TYPE_MASK : 0)
52 Print the vector subtype of $, assuming it is a vector or pseudovector.
56 output (enum Lisp_Misc_Type) (((struct Lisp_Free *) (($ & $valmask) | gdb_data_seg_bits))->type)
60 Print the specific type of $, assuming it is some misc type.
64 print (($ & $valmask) << $nonvalbits) >> $nonvalbits
67 Print $, assuming it is an Emacs Lisp integer. This gets the sign right.
71 print (void *) (($ & $valmask) | gdb_data_seg_bits)
74 Print the pointer portion of $, assuming it is an Emacs Lisp value.
78 print (struct Lisp_Marker *) (($ & $valmask) | gdb_data_seg_bits)
81 Print $ as a marker pointer, assuming it is an Emacs Lisp marker value.
85 print (struct Lisp_Overlay *) (($ & $valmask) | gdb_data_seg_bits)
88 Print $ as a overlay pointer, assuming it is an Emacs Lisp overlay value.
92 print (struct Lisp_Free *) (($ & $valmask) | gdb_data_seg_bits)
95 Print $ as a misc free-cell pointer, assuming it is an Emacs Lisp Misc value.
99 print (struct Lisp_Intfwd *) (($ & $valmask) | gdb_data_seg_bits)
102 Print $ as an integer forwarding pointer, assuming it is an Emacs Lisp Misc value.
106 print (struct Lisp_Boolfwd *) (($ & $valmask) | gdb_data_seg_bits)
109 Print $ as a boolean forwarding pointer, assuming it is an Emacs Lisp Misc value.
113 print (struct Lisp_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
116 Print $ as an object forwarding pointer, assuming it is an Emacs Lisp Misc value.
120 print (struct Lisp_Buffer_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
123 Print $ as a buffer-local object forwarding pointer, assuming it is an Emacs Lisp Misc value.
127 print (struct Lisp_Kboard_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
130 Print $ as a kboard-local object forwarding pointer, assuming it is an Emacs Lisp Misc value.
134 print (struct Lisp_Buffer_Local_Value *) (($ & $valmask) | gdb_data_seg_bits)
137 Print $ as a buffer-local-value pointer, assuming it is an Emacs Lisp Misc value.
141 print (struct Lisp_Symbol *) ((((int) $) & $valmask) | gdb_data_seg_bits)
142 output (char*)$->name->data
146 Print the name and address of the symbol $.
147 This command assumes that $ is an Emacs Lisp symbol value.
151 print (struct Lisp_String *) (($ & $valmask) | gdb_data_seg_bits)
152 output ($->size > 1000) ? 0 : ($->data[0])@($->size_byte < 0 ? $->size : $->size_byte)
156 Print the contents and address of the string $.
157 This command assumes that $ is an Emacs Lisp string value.
161 print (struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits)
162 output ($->size > 50) ? 0 : ($->contents[0])@($->size)
166 Print the contents and address of the vector $.
167 This command assumes that $ is an Emacs Lisp vector value.
171 print (struct Lisp_Process *) (($ & $valmask) | gdb_data_seg_bits)
176 Print the address of the struct Lisp_process which the Lisp_Object $ points to.
180 print (struct frame *) (($ & $valmask) | gdb_data_seg_bits)
183 Print $ as a frame pointer, assuming it is an Emacs Lisp frame value.
187 print (struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits)
188 output ($->contents[0])@($->size & 0xff)
191 Print $ as a compiled function pointer, assuming it is an Emacs Lisp compiled value.
195 print (struct window *) (($ & $valmask) | gdb_data_seg_bits)
196 printf "%dx%d+%d+%d\n", $->width, $->height, $->left, $->top
199 Print $ as a window pointer, assuming it is an Emacs Lisp window value.
200 Print the window's position as "WIDTHxHEIGHT+LEFT+TOP".
204 print (struct save_window_data *) (($ & $valmask) | gdb_data_seg_bits)
207 Print $ as a window configuration pointer, assuming it is an Emacs Lisp window configuration value.
211 print (struct Lisp_Subr *) (($ & $valmask) | gdb_data_seg_bits)
216 Print the address of the subr which the Lisp_Object $ points to.
220 print (struct Lisp_Char_Table *) (($ & $valmask) | gdb_data_seg_bits)
222 output (char*)&((struct Lisp_Symbol *) ((((int) $->purpose) & $valmask) | gdb_data_seg_bits))->name->data
223 printf " %d extra slots", ($->size & 0x1ff) - 388
227 Print the address of the char-table $, and its purpose.
228 This command assumes that $ is an Emacs Lisp char-table value.
232 print (struct Lisp_Bool_Vector *) (($ & $valmask) | gdb_data_seg_bits)
233 output ($->size > 256) ? 0 : ($->data[0])@(($->size + 7)/ 8)
237 Print the contents and address of the bool-vector $.
238 This command assumes that $ is an Emacs Lisp bool-vector value.
242 print (struct buffer *) (($ & $valmask) | gdb_data_seg_bits)
243 output &((struct Lisp_String *) ((($->name) & $valmask) | gdb_data_seg_bits))->data
247 Set $ as a buffer pointer, assuming it is an Emacs Lisp buffer value.
248 Print the name of the buffer.
252 print (struct Lisp_Hash_Table *) (($ & $valmask) | gdb_data_seg_bits)
255 Set $ as a hash table pointer, assuming it is an Emacs Lisp hash table value.
259 print (struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits)
264 Print the contents of $, assuming it is an Emacs Lisp cons.
272 Print the contents of the next cell in a list.
273 This assumes that the last thing you printed was a cons cell contents
274 (type struct Lisp_Cons) or a pointer to one.
277 print/x ((($ >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits))->car : 0)
280 Print the car of $, assuming it is an Emacs Lisp pair.
284 print/x ((($ >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits))->cdr : 0)
287 Print the cdr of $, assuming it is an Emacs Lisp pair.
291 print ((struct Lisp_Float *) (($ & $valmask) | gdb_data_seg_bits))->data
294 Print $ assuming it is a lisp floating-point number.
298 print (struct scrollbar *) (($ & $valmask) | gdb_data_seg_bits)
303 Print $ as a scrollbar pointer.
307 set $sym = (struct Lisp_Symbol *) ((((int) $arg0) & $valmask) | gdb_data_seg_bits)
308 output (char*)$sym->name->data
312 Print argument as a symbol.
316 set $bt = backtrace_list
318 xprintsym *$bt->function
323 Print a backtrace of Lisp function calls from backtrace_list.
324 Set a breakpoint at Fsignal and call this to see from where
325 an error was signalled.
329 set $valmask = ((long)1 << gdb_valbits) - 1
330 set $nonvalbits = gdb_emacs_intbits - gdb_valbits
333 When starting Emacs a second time in the same gdb session under
334 FreeBSD 2.2.5, gdb 4.13, $valmask and $nonvalbits have lost
335 their values. (The same happens on GNU/Linux with gdb 5.0.)
336 This function reloads them.
340 set print sevenbit-strings
342 show environment DISPLAY
343 show environment TERM
344 set args -geometry 80x40+0+0
346 # Don't let abort actually run, as it will make
347 # stdio stop working and therefore the `pr' command above as well.
350 # If we are running in synchronous mode, we want a chance to look around
351 # before Emacs exits. Perhaps we should put the break somewhere else
353 break x_error_quitter