1 # Set up a mask to use.
3 # Force loading of symbols, enough to give us gdb_valbits etc.
6 # Find lwlib source files too.
9 # This should be EMACS_INT, but in some cases that is a macro.
10 # long ought to work in all cases right now.
11 set $valmask = ((long)1 << gdb_valbits) - 1
12 set $nonvalbits = gdb_emacs_intbits - gdb_valbits
14 # Set up something to print out s-expressions.
19 Print the emacs s-expression which is $.
20 Works only when an inferior emacs is executing.
24 output (enum Lisp_Type) (($ >> gdb_valbits) & 0x7)
26 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)
30 Print the type of $, assuming it is an Emacs Lisp value.
31 If the first type printed is Lisp_Vector or Lisp_Misc,
32 the second line gives the more precise type.
33 Otherwise the second line doesn't mean anything.
37 set $size = ((struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits))->size
38 output (enum pvec_type) (($size & PVEC_FLAG) ? $size & PVEC_TYPE_MASK : 0)
42 Print the vector subtype of $, assuming it is a vector or pseudovector.
46 output (enum Lisp_Misc_Type) (((struct Lisp_Free *) (($ & $valmask) | gdb_data_seg_bits))->type)
50 Print the specific type of $, assuming it is some misc type.
54 print (($ & $valmask) << $nonvalbits) >> $nonvalbits
57 Print $, assuming it is an Emacs Lisp integer. This gets the sign right.
61 print (void *) (($ & $valmask) | gdb_data_seg_bits)
64 Print the pointer portion of $, assuming it is an Emacs Lisp value.
68 print (struct window *) (($ & $valmask) | gdb_data_seg_bits)
69 printf "%dx%d+%d+%d\n", $->width, $->height, $->left, $->top
72 Print $ as a window pointer, assuming it is an Emacs Lisp window value.
73 Print the window's position as "WIDTHxHEIGHT+LEFT+TOP".
77 print (struct Lisp_Marker *) (($ & $valmask) | gdb_data_seg_bits)
80 Print $ as a marker pointer, assuming it is an Emacs Lisp marker value.
84 print (struct Lisp_Overlay *) (($ & $valmask) | gdb_data_seg_bits)
87 Print $ as a overlay pointer, assuming it is an Emacs Lisp overlay value.
91 print (struct Lisp_Free *) (($ & $valmask) | gdb_data_seg_bits)
94 Print $ as a misc free-cell pointer, assuming it is an Emacs Lisp Misc value.
98 print (struct Lisp_Intfwd *) (($ & $valmask) | gdb_data_seg_bits)
101 Print $ as an integer forwarding pointer, assuming it is an Emacs Lisp Misc value.
105 print (struct Lisp_Boolfwd *) (($ & $valmask) | gdb_data_seg_bits)
108 Print $ as a boolean forwarding pointer, assuming it is an Emacs Lisp Misc value.
112 print (struct Lisp_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
115 Print $ as an object forwarding pointer, assuming it is an Emacs Lisp Misc value.
119 print (struct Lisp_Buffer_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
122 Print $ as a buffer-local object forwarding pointer, assuming it is an Emacs Lisp Misc value.
126 print (struct Lisp_Kboard_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
129 Print $ as a kboard-local object forwarding pointer, assuming it is an Emacs Lisp Misc value.
133 print (struct Lisp_Buffer_Local_Value *) (($ & $valmask) | gdb_data_seg_bits)
136 Print $ as a buffer-local-value pointer, assuming it is an Emacs Lisp Misc value.
140 print (struct buffer *) (($ & $valmask) | gdb_data_seg_bits)
141 output &((struct Lisp_String *) ((($->name) & $valmask) | gdb_data_seg_bits))->data
145 Set $ as a buffer pointer, assuming it is an Emacs Lisp buffer value.
146 Print the name of the buffer.
150 print (struct Lisp_Symbol *) ((((int) $) & $valmask) | gdb_data_seg_bits)
151 output (char*)&$->name->data
155 Print the name and address of the symbol $.
156 This command assumes that $ is an Emacs Lisp symbol value.
160 print (struct Lisp_String *) (($ & $valmask) | gdb_data_seg_bits)
161 output ($->size > 1000) ? 0 : ($->data[0])@($->size)
165 Print the contents and address of the string $.
166 This command assumes that $ is an Emacs Lisp string value.
170 print (struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits)
171 output ($->size > 50) ? 0 : ($->contents[0])@($->size)
175 Print the contents and address of the vector $.
176 This command assumes that $ is an Emacs Lisp vector value.
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 save_window_data *) (($ & $valmask) | gdb_data_seg_bits)
190 Print $ as a window configuration pointer, assuming it is an Emacs Lisp window configuration value.
194 print (struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits)
195 output ($->contents[0])@($->size & 0xff)
198 Print $ as a compiled function pointer, assuming it is an Emacs Lisp compiled value.
202 print (struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits)
207 Print the contents of $, assuming it is an Emacs Lisp cons.
211 print ((($ >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits))->car : 0)
214 Print the car of $, assuming it is an Emacs Lisp pair.
218 print ((($ >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits))->cdr : 0)
221 Print the cdr of $, assuming it is an Emacs Lisp pair.
225 print (struct Lisp_Subr *) (($ & $valmask) | gdb_data_seg_bits)
230 Print the address of the subr which the Lisp_Object $ points to.
234 print (struct Lisp_Process *) (($ & $valmask) | gdb_data_seg_bits)
239 Print the address of the struct Lisp_process which the Lisp_Object $ points to.
243 print ((struct Lisp_Float *) (($ & $valmask) | gdb_data_seg_bits))->data
246 Print $ assuming it is a lisp floating-point number.
250 print (struct scrollbar *) (($ & $valmask) | gdb_data_seg_bits)
255 Print $ as a scrollbar pointer.
259 set print sevenbit-strings
261 show environment DISPLAY
262 show environment TERM
263 set args -geometry 80x40+0+0
265 # Don't let abort actually run, as it will make
266 # stdio stop working and therefore the `pr' command above as well.
269 # If we are running in synchronous mode, we want a chance to look around
270 # before Emacs exits. Perhaps we should put the break somewhere else
272 break x_error_quitter