1 # Set up a mask to use.
3 # Force loading of symbols, enough to give us gdb_valbits etc.
6 # This should be EMACS_INT, but in some cases that is a macro.
7 # long ought to work in all cases right now.
8 set $valmask = ((long)1 << gdb_valbits) - 1
9 set $nonvalbits = gdb_emacs_intbits - gdb_valbits
11 # Set up something to print out s-expressions.
16 Print the emacs s-expression which is $.
17 Works only when an inferior emacs is executing.
21 output (enum Lisp_Type) (($ >> gdb_valbits) & 0x7)
23 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)
27 Print the type of $, assuming it is an Emacs Lisp value.
28 If the first type printed is Lisp_Vector or Lisp_Misc,
29 the second line gives the more precise type.
30 Otherwise the second line doesn't mean anything.
34 set $size = ((struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits))->size
35 output (enum pvec_type) (($size & PVEC_FLAG) ? $size & PVEC_TYPE_MASK : 0)
39 Print the vector subtype of $, assuming it is a vector or pseudovector.
43 output (enum Lisp_Misc_Type) (((struct Lisp_Free *) (($ & $valmask) | gdb_data_seg_bits))->type)
47 Print the specific type of $, assuming it is some misc type.
51 print (($ & $valmask) << $nonvalbits) >> $nonvalbits
54 Print $, assuming it is an Emacs Lisp integer. This gets the sign right.
58 print (void *) (($ & $valmask) | gdb_data_seg_bits)
61 Print the pointer portion of $, assuming it is an Emacs Lisp value.
65 print (struct window *) (($ & $valmask) | gdb_data_seg_bits)
66 printf "%dx%d+%d+%d\n", $->width, $->height, $->left, $->top
69 Print $ as a window pointer, assuming it is an Emacs Lisp window value.
70 Print the window's position as "WIDTHxHEIGHT+LEFT+TOP".
74 print (struct Lisp_Marker *) (($ & $valmask) | gdb_data_seg_bits)
77 Print $ as a marker pointer, assuming it is an Emacs Lisp marker value.
81 print (struct Lisp_Overlay *) (($ & $valmask) | gdb_data_seg_bits)
84 Print $ as a overlay pointer, assuming it is an Emacs Lisp overlay value.
88 print (struct Lisp_Free *) (($ & $valmask) | gdb_data_seg_bits)
91 Print $ as a misc free-cell pointer, assuming it is an Emacs Lisp Misc value.
95 print (struct Lisp_Intfwd *) (($ & $valmask) | gdb_data_seg_bits)
98 Print $ as an integer forwarding pointer, assuming it is an Emacs Lisp Misc value.
102 print (struct Lisp_Boolfwd *) (($ & $valmask) | gdb_data_seg_bits)
105 Print $ as a boolean forwarding pointer, assuming it is an Emacs Lisp Misc value.
109 print (struct Lisp_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
112 Print $ as an object forwarding pointer, assuming it is an Emacs Lisp Misc value.
116 print (struct Lisp_Buffer_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
119 Print $ as a buffer-local object forwarding pointer, assuming it is an Emacs Lisp Misc value.
123 print (struct Lisp_Kboard_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
126 Print $ as a kboard-local object forwarding pointer, assuming it is an Emacs Lisp Misc value.
130 print (struct Lisp_Buffer_Local_Value *) (($ & $valmask) | gdb_data_seg_bits)
133 Print $ as a buffer-local-value pointer, assuming it is an Emacs Lisp Misc value.
137 print (struct buffer *) (($ & $valmask) | gdb_data_seg_bits)
138 output &((struct Lisp_String *) ((($->name) & $valmask) | gdb_data_seg_bits))->data
142 Set $ as a buffer pointer, assuming it is an Emacs Lisp buffer value.
143 Print the name of the buffer.
147 print (struct Lisp_Symbol *) ((((int) $) & $valmask) | gdb_data_seg_bits)
148 output (char*)&$->name->data
152 Print the name and address of the symbol $.
153 This command assumes that $ is an Emacs Lisp symbol value.
157 print (struct Lisp_String *) (($ & $valmask) | gdb_data_seg_bits)
158 output ($->size > 1000) ? 0 : ($->data[0])@($->size)
162 Print the contents and address of the string $.
163 This command assumes that $ is an Emacs Lisp string value.
167 print (struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits)
168 output ($->size > 50) ? 0 : ($->contents[0])@($->size)
172 Print the contents and address of the vector $.
173 This command assumes that $ is an Emacs Lisp vector value.
177 print (struct frame *) (($ & $valmask) | gdb_data_seg_bits)
180 Print $ as a frame pointer, assuming it is an Emacs Lisp frame value.
184 print (struct save_window_data *) (($ & $valmask) | gdb_data_seg_bits)
187 Print $ as a window configuration pointer, assuming it is an Emacs Lisp window configuration value.
191 print (struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits)
192 output ($->contents[0])@($->size & 0xff)
195 Print $ as a compiled function pointer, assuming it is an Emacs Lisp compiled value.
199 print (struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits)
204 Print the contents of $, assuming it is an Emacs Lisp cons.
208 print ((($ >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits))->car : 0)
211 Print the car of $, assuming it is an Emacs Lisp pair.
215 print ((($ >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits))->cdr : 0)
218 Print the cdr of $, assuming it is an Emacs Lisp pair.
222 print (struct Lisp_Subr *) (($ & $valmask) | gdb_data_seg_bits)
227 Print the address of the subr which the Lisp_Object $ points to.
231 print (struct Lisp_Process *) (($ & $valmask) | gdb_data_seg_bits)
236 Print the address of the struct Lisp_process which the Lisp_Object $ points to.
240 print ((struct Lisp_Float *) (($ & $valmask) | gdb_data_seg_bits))->data
243 Print $ assuming it is a lisp floating-point number.
247 print (struct scrollbar *) (($ & $valmask) | gdb_data_seg_bits)
252 Print $ as a scrollbar pointer.
256 set print sevenbit-strings
258 show environment DISPLAY
259 show environment TERM
260 set args -geometry 80x40+0+0
262 # Don't let abort actually run, as it will make
263 # stdio stop working and therefore the `pr' command above as well.
266 # If we are running in synchronous mode, we want a chance to look around
267 # before Emacs exits. Perhaps we should put the break somewhere else
269 break x_error_quitter