(array-mode): Add autoload cookie.
[emacs.git] / src / .gdbinit
blob9bfc9ddf2e707fec6a8fdb8abcb6de9d1c4dc71d
1 # Force loading of symbols, enough to give us gdb_valbits etc.
2 set main
4 # Find lwlib source files too.
5 dir ../lwlib
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.
11 handle 2 noprint pass
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.
20 define pr
21 set debug_print ($)
22 end
23 document pr
24 Print the emacs s-expression which is $.
25 Works only when an inferior emacs is executing.
26 end
28 define xtype
29 output (enum Lisp_Type) (($ >> gdb_valbits) & 0x7)
30 echo \n
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)
32 echo \n
33 end
34 document xtype
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.
39 end
41 define xvectype
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)
44 echo \n
45 end
46 document xvectype
47 Print the vector subtype of $, assuming it is a vector or pseudovector.
48 end
50 define xmisctype
51 output (enum Lisp_Misc_Type) (((struct Lisp_Free *) (($ & $valmask) | gdb_data_seg_bits))->type)
52 echo \n
53 end
54 document xmisctype
55 Print the specific type of $, assuming it is some misc type.
56 end
58 define xint
59 print (($ & $valmask) << $nonvalbits) >> $nonvalbits
60 end
61 document xint
62 Print $, assuming it is an Emacs Lisp integer.  This gets the sign right.
63 end
65 define xptr
66 print (void *) (($ & $valmask) | gdb_data_seg_bits)
67 end
68 document xptr
69 Print the pointer portion of $, assuming it is an Emacs Lisp value.
70 end
72 define xwindow
73 print (struct window *) (($ & $valmask) | gdb_data_seg_bits)
74 printf "%dx%d+%d+%d\n", $->width, $->height, $->left, $->top
75 end
76 document xwindow
77 Print $ as a window pointer, assuming it is an Emacs Lisp window value.
78 Print the window's position as "WIDTHxHEIGHT+LEFT+TOP".
79 end
81 define xmarker
82 print (struct Lisp_Marker *) (($ & $valmask) | gdb_data_seg_bits)
83 end
84 document xmarker
85 Print $ as a marker pointer, assuming it is an Emacs Lisp marker value.
86 end
88 define xoverlay
89 print (struct Lisp_Overlay *) (($ & $valmask) | gdb_data_seg_bits)
90 end
91 document xoverlay
92 Print $ as a overlay pointer, assuming it is an Emacs Lisp overlay value.
93 end
95 define xmiscfree
96 print (struct Lisp_Free *) (($ & $valmask) | gdb_data_seg_bits)
97 end
98 document xmiscfree
99 Print $ as a misc free-cell pointer, assuming it is an Emacs Lisp Misc value.
102 define xintfwd
103 print (struct Lisp_Intfwd *) (($ & $valmask) | gdb_data_seg_bits)
105 document xintfwd
106 Print $ as an integer forwarding pointer, assuming it is an Emacs Lisp Misc value.
109 define xboolfwd
110 print (struct Lisp_Boolfwd *) (($ & $valmask) | gdb_data_seg_bits)
112 document xboolfwd
113 Print $ as a boolean forwarding pointer, assuming it is an Emacs Lisp Misc value.
116 define xobjfwd
117 print (struct Lisp_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
119 document xobjfwd
120 Print $ as an object forwarding pointer, assuming it is an Emacs Lisp Misc value.
123 define xbufobjfwd
124 print (struct Lisp_Buffer_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
126 document xbufobjfwd
127 Print $ as a buffer-local object forwarding pointer, assuming it is an Emacs Lisp Misc value.
130 define xkbobjfwd
131 print (struct Lisp_Kboard_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
133 document xkbobjfwd
134 Print $ as a kboard-local object forwarding pointer, assuming it is an Emacs Lisp Misc value.
137 define xbuflocal
138 print (struct Lisp_Buffer_Local_Value *) (($ & $valmask) | gdb_data_seg_bits)
140 document xbuflocal
141 Print $ as a buffer-local-value pointer, assuming it is an Emacs Lisp Misc value.
144 define xbuffer
145 print (struct buffer *) (($ & $valmask) | gdb_data_seg_bits)
146 output &((struct Lisp_String *) ((($->name) & $valmask) | gdb_data_seg_bits))->data
147 echo \n
149 document xbuffer
150 Set $ as a buffer pointer, assuming it is an Emacs Lisp buffer value.
151 Print the name of the buffer.
154 define xsymbol
155 print (struct Lisp_Symbol *) ((((int) $) & $valmask) | gdb_data_seg_bits)
156 output (char*)&$->name->data
157 echo \n
159 document xsymbol
160 Print the name and address of the symbol $.
161 This command assumes that $ is an Emacs Lisp symbol value.
164 define xstring
165 print (struct Lisp_String *) (($ & $valmask) | gdb_data_seg_bits)
166 output ($->size > 1000) ? 0 : ($->data[0])@($->size_byte)
167 echo \n
169 document xstring
170 Print the contents and address of the string $.
171 This command assumes that $ is an Emacs Lisp string value.
174 define xvector
175 print (struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits)
176 output ($->size > 50) ? 0 : ($->contents[0])@($->size)
177 echo \n
179 document xvector
180 Print the contents and address of the vector $.
181 This command assumes that $ is an Emacs Lisp vector value.
184 define xframe
185 print (struct frame *) (($ & $valmask) | gdb_data_seg_bits)
187 document xframe
188 Print $ as a frame pointer, assuming it is an Emacs Lisp frame value.
191 define xwinconfig
192 print (struct save_window_data *) (($ & $valmask) | gdb_data_seg_bits)
194 document xwinconfig
195 Print $ as a window configuration pointer, assuming it is an Emacs Lisp window configuration value.
198 define xcompiled
199 print (struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits)
200 output ($->contents[0])@($->size & 0xff)
202 document xcompiled
203 Print $ as a compiled function pointer, assuming it is an Emacs Lisp compiled value.
206 define xcons
207 print (struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits)
208 output/x *$
209 echo \n
211 document xcons
212 Print the contents of $, assuming it is an Emacs Lisp cons.
215 define nextcons
216 p $.cdr
217 xcons
219 document nextcons
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.
224 define xcar
225 print/x ((($ >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits))->car : 0)
227 document xcar
228 Print the car of $, assuming it is an Emacs Lisp pair.
231 define xcdr
232 print/x ((($ >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits))->cdr : 0)
234 document xcdr
235 Print the cdr of $, assuming it is an Emacs Lisp pair.
238 define xsubr
239 print (struct Lisp_Subr *) (($ & $valmask) | gdb_data_seg_bits)
240 output *$
241 echo \n
243 document xsubr
244 Print the address of the subr which the Lisp_Object $ points to.
247 define xprocess
248 print (struct Lisp_Process *) (($ & $valmask) | gdb_data_seg_bits)
249 output *$
250 echo \n
252 document xprocess
253 Print the address of the struct Lisp_process which the Lisp_Object $ points to.
256 define xfloat
257 print ((struct Lisp_Float *) (($ & $valmask) | gdb_data_seg_bits))->data
259 document xfloat
260 Print $ assuming it is a lisp floating-point number.
263 define xscrollbar
264 print (struct scrollbar *) (($ & $valmask) | gdb_data_seg_bits)
265 output *$
266 echo \n
268 document xscrollbar
269 Print $ as a scrollbar pointer.
272 set print pretty on
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.
281 break abort
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
285 # instead...
286 break x_error_quitter