1 # Set up a mask to use.
3 # This should be EMACS_INT, but in some cases that is a macro.
4 # long ought to work in all cases right now.
5 set $valmask = ((long)1 << gdb_valbits) - 1
6 set $nonvalbits = gdb_emacs_intbits - gdb_valbits
8 # Set up something to print out s-expressions.
14 Print the emacs s-expression which is $.
15 Works only when an inferior emacs is executing.
19 output (enum Lisp_Type) (($ >> gdb_valbits) & 0x7)
21 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)
25 Print the type of $, assuming it is an Emacs Lisp value.
26 If the first type printed is Lisp_Vector or Lisp_Misc,
27 the second line gives the more precise type.
28 Otherwise the second line doesn't mean anything.
32 set $size = ((struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits))->size
33 output (enum pvec_type) (($size & PVEC_FLAG) ? $size & PVEC_TYPE_MASK : 0)
37 Print the vector subtype of $, assuming it is a vector or pseudovector.
41 output (enum Lisp_Misc_Type) (((struct Lisp_Free *) (($ & $valmask) | gdb_data_seg_bits))->type)
45 Print the specific type of $, assuming it is some misc type.
49 print (($ & $valmask) << $nonvalbits) >> $nonvalbits
52 Print $, assuming it is an Emacs Lisp integer. This gets the sign right.
56 print (void *) (($ & $valmask) | gdb_data_seg_bits)
59 Print the pointer portion of $, assuming it is an Emacs Lisp value.
63 print (struct window *) (($ & $valmask) | gdb_data_seg_bits)
64 printf "%dx%d+%d+%d\n", $->width, $->height, $->left, $->top
67 Print $ as a window pointer, assuming it is an Emacs Lisp window value.
68 Print the window's position as "WIDTHxHEIGHT+LEFT+TOP".
72 print (struct Lisp_Marker *) (($ & $valmask) | gdb_data_seg_bits)
75 Print $ as a marker pointer, assuming it is an Emacs Lisp marker value.
79 print (struct Lisp_Overlay *) (($ & $valmask) | gdb_data_seg_bits)
82 Print $ as a overlay pointer, assuming it is an Emacs Lisp overlay value.
86 print (struct Lisp_Free *) (($ & $valmask) | gdb_data_seg_bits)
89 Print $ as a misc free-cell pointer, assuming it is an Emacs Lisp Misc value.
93 print (struct Lisp_Intfwd *) (($ & $valmask) | gdb_data_seg_bits)
96 Print $ as an integer forwarding pointer, assuming it is an Emacs Lisp Misc value.
100 print (struct Lisp_Boolfwd *) (($ & $valmask) | gdb_data_seg_bits)
103 Print $ as a boolean forwarding pointer, assuming it is an Emacs Lisp Misc value.
107 print (struct Lisp_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
110 Print $ as an object forwarding pointer, assuming it is an Emacs Lisp Misc value.
114 print (struct Lisp_Buffer_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
117 Print $ as a buffer-local object forwarding pointer, assuming it is an Emacs Lisp Misc value.
121 print (struct Lisp_Kboard_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
124 Print $ as a kboard-local object forwarding pointer, assuming it is an Emacs Lisp Misc value.
128 print (struct Lisp_Buffer_Local_Value *) (($ & $valmask) | gdb_data_seg_bits)
131 Print $ as a buffer-local-value pointer, assuming it is an Emacs Lisp Misc value.
135 print (struct buffer *) (($ & $valmask) | gdb_data_seg_bits)
136 output &((struct Lisp_String *) ((($->name) & $valmask) | gdb_data_seg_bits))->data
140 Set $ as a buffer pointer, assuming it is an Emacs Lisp buffer value.
141 Print the name of the buffer.
145 print (struct Lisp_Symbol *) ((((int) $) & $valmask) | gdb_data_seg_bits)
146 output &$->name->data
150 Print the name and address of the symbol $.
151 This command assumes that $ is an Emacs Lisp symbol value.
155 print (struct Lisp_String *) (($ & $valmask) | gdb_data_seg_bits)
156 output ($->size > 1000) ? 0 : ($->data[0])@($->size)
160 Print the contents and address of the string $.
161 This command assumes that $ is an Emacs Lisp string value.
165 print (struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits)
166 output ($->size > 50) ? 0 : ($->contents[0])@($->size)
170 Print the contents and address of the vector $.
171 This command assumes that $ is an Emacs Lisp vector value.
175 print (struct frame *) (($ & $valmask) | gdb_data_seg_bits)
178 Print $ as a frame pointer, assuming it is an Emacs Lisp frame value.
182 print (struct save_window_data *) (($ & $valmask) | gdb_data_seg_bits)
185 Print $ as a window configuration pointer, assuming it is an Emacs Lisp window configuration value.
189 print (struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits)
190 output ($->contents[0])@($->size & 0xff)
193 Print $ as a compiled function pointer, assuming it is an Emacs Lisp compiled value.
197 print (struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits)
202 Print the contents of $, assuming it is an Emacs Lisp cons.
206 print ((($ >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits))->car : 0)
209 Print the car of $, assuming it is an Emacs Lisp pair.
213 print ((($ >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits))->cdr : 0)
216 Print the cdr of $, assuming it is an Emacs Lisp pair.
220 print (struct Lisp_Subr *) (($ & $valmask) | gdb_data_seg_bits)
225 Print the address of the subr which the Lisp_Object $ points to.
229 print (struct Lisp_Process *) (($ & $valmask) | gdb_data_seg_bits)
234 Print the address of the struct Lisp_process which the Lisp_Object $ points to.
238 print ((struct Lisp_Float *) (($ & $valmask) | gdb_data_seg_bits))->data
241 Print $ assuming it is a lisp floating-point number.
245 print (struct scrollbar *) (($ & $valmask) | gdb_data_seg_bits)
250 Print $ as a scrollbar pointer.
254 set print sevenbit-strings
256 show environment DISPLAY
257 show environment TERM
258 set args -geometry 80x40+0+0
260 # Don't let abort actually run, as it will make
261 # stdio stop working and therefore the `pr' command above as well.
264 # If we are running in synchronous mode, we want a chance to look around
265 # before Emacs exits. Perhaps we should put the break somewhere else
267 break x_error_quitter