]> code.delx.au - gnu-emacs/blob - src/.gdbinit
(echo_area_display): Use selected frame's minibuf window
[gnu-emacs] / src / .gdbinit
1 # Set up a mask to use.
2
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
7
8 # Set up something to print out s-expressions.
9 define pr
10 set debug_print ($)
11 echo \n
12 end
13 document pr
14 Print the emacs s-expression which is $.
15 Works only when an inferior emacs is executing.
16 end
17
18 define xtype
19 output (enum Lisp_Type) (($ >> gdb_valbits) & 0x7)
20 echo \n
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)
22 echo \n
23 end
24 document xtype
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.
29 end
30
31 define xvectype
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)
34 echo \n
35 end
36 document xvectype
37 Print the vector subtype of $, assuming it is a vector or pseudovector.
38 end
39
40 define xmisctype
41 output (enum Lisp_Misc_Type) (((struct Lisp_Free *) (($ & $valmask) | gdb_data_seg_bits))->type)
42 echo \n
43 end
44 document xmisctype
45 Print the specific type of $, assuming it is some misc type.
46 end
47
48 define xint
49 print (($ & $valmask) << $nonvalbits) >> $nonvalbits
50 end
51 document xint
52 Print $, assuming it is an Emacs Lisp integer. This gets the sign right.
53 end
54
55 define xptr
56 print (void *) (($ & $valmask) | gdb_data_seg_bits)
57 end
58 document xptr
59 Print the pointer portion of $, assuming it is an Emacs Lisp value.
60 end
61
62 define xwindow
63 print (struct window *) (($ & $valmask) | gdb_data_seg_bits)
64 printf "%dx%d+%d+%d\n", $->width, $->height, $->left, $->top
65 end
66 document xwindow
67 Print $ as a window pointer, assuming it is an Emacs Lisp window value.
68 Print the window's position as "WIDTHxHEIGHT+LEFT+TOP".
69 end
70
71 define xmarker
72 print (struct Lisp_Marker *) (($ & $valmask) | gdb_data_seg_bits)
73 end
74 document xmarker
75 Print $ as a marker pointer, assuming it is an Emacs Lisp marker value.
76 end
77
78 define xoverlay
79 print (struct Lisp_Overlay *) (($ & $valmask) | gdb_data_seg_bits)
80 end
81 document xoverlay
82 Print $ as a overlay pointer, assuming it is an Emacs Lisp overlay value.
83 end
84
85 define xmiscfree
86 print (struct Lisp_Free *) (($ & $valmask) | gdb_data_seg_bits)
87 end
88 document xmiscfree
89 Print $ as a misc free-cell pointer, assuming it is an Emacs Lisp Misc value.
90 end
91
92 define xintfwd
93 print (struct Lisp_Intfwd *) (($ & $valmask) | gdb_data_seg_bits)
94 end
95 document xintfwd
96 Print $ as an integer forwarding pointer, assuming it is an Emacs Lisp Misc value.
97 end
98
99 define xboolfwd
100 print (struct Lisp_Boolfwd *) (($ & $valmask) | gdb_data_seg_bits)
101 end
102 document xboolfwd
103 Print $ as a boolean forwarding pointer, assuming it is an Emacs Lisp Misc value.
104 end
105
106 define xobjfwd
107 print (struct Lisp_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
108 end
109 document xobjfwd
110 Print $ as an object forwarding pointer, assuming it is an Emacs Lisp Misc value.
111 end
112
113 define xbufobjfwd
114 print (struct Lisp_Buffer_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
115 end
116 document xbufobjfwd
117 Print $ as a buffer-local object forwarding pointer, assuming it is an Emacs Lisp Misc value.
118 end
119
120 define xkbobjfwd
121 print (struct Lisp_Kboard_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
122 end
123 document xkbobjfwd
124 Print $ as a kboard-local object forwarding pointer, assuming it is an Emacs Lisp Misc value.
125 end
126
127 define xbuflocal
128 print (struct Lisp_Buffer_Local_Value *) (($ & $valmask) | gdb_data_seg_bits)
129 end
130 document xbuflocal
131 Print $ as a buffer-local-value pointer, assuming it is an Emacs Lisp Misc value.
132 end
133
134 define xbuffer
135 print (struct buffer *) (($ & $valmask) | gdb_data_seg_bits)
136 output &((struct Lisp_String *) ((($->name) & $valmask) | gdb_data_seg_bits))->data
137 echo \n
138 end
139 document xbuffer
140 Set $ as a buffer pointer, assuming it is an Emacs Lisp buffer value.
141 Print the name of the buffer.
142 end
143
144 define xsymbol
145 print (struct Lisp_Symbol *) ((((int) $) & $valmask) | gdb_data_seg_bits)
146 output &$->name->data
147 echo \n
148 end
149 document xsymbol
150 Print the name and address of the symbol $.
151 This command assumes that $ is an Emacs Lisp symbol value.
152 end
153
154 define xstring
155 print (struct Lisp_String *) (($ & $valmask) | gdb_data_seg_bits)
156 output ($->size > 1000) ? 0 : ($->data[0])@($->size)
157 echo \n
158 end
159 document xstring
160 Print the contents and address of the string $.
161 This command assumes that $ is an Emacs Lisp string value.
162 end
163
164 define xvector
165 print (struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits)
166 output ($->size > 50) ? 0 : ($->contents[0])@($->size)
167 echo \n
168 end
169 document xvector
170 Print the contents and address of the vector $.
171 This command assumes that $ is an Emacs Lisp vector value.
172 end
173
174 define xframe
175 print (struct frame *) (($ & $valmask) | gdb_data_seg_bits)
176 end
177 document xframe
178 Print $ as a frame pointer, assuming it is an Emacs Lisp frame value.
179 end
180
181 define xwinconfig
182 print (struct save_window_data *) (($ & $valmask) | gdb_data_seg_bits)
183 end
184 document xwinconfig
185 Print $ as a window configuration pointer, assuming it is an Emacs Lisp window configuration value.
186 end
187
188 define xcompiled
189 print (struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits)
190 output ($->contents[0])@($->size & 0xff)
191 end
192 document xcompiled
193 Print $ as a compiled function pointer, assuming it is an Emacs Lisp compiled value.
194 end
195
196 define xcons
197 print (struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits)
198 output *$
199 echo \n
200 end
201 document xcons
202 Print the contents of $, assuming it is an Emacs Lisp cons.
203 end
204
205 define xcar
206 print ((($ >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits))->car : 0)
207 end
208 document xcar
209 Print the car of $, assuming it is an Emacs Lisp pair.
210 end
211
212 define xcdr
213 print ((($ >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits))->cdr : 0)
214 end
215 document xcdr
216 Print the cdr of $, assuming it is an Emacs Lisp pair.
217 end
218
219 define xsubr
220 print (struct Lisp_Subr *) (($ & $valmask) | gdb_data_seg_bits)
221 output *$
222 echo \n
223 end
224 document xsubr
225 Print the address of the subr which the Lisp_Object $ points to.
226 end
227
228 define xprocess
229 print (struct Lisp_Process *) (($ & $valmask) | gdb_data_seg_bits)
230 output *$
231 echo \n
232 end
233 document xprocess
234 Print the address of the struct Lisp_process which the Lisp_Object $ points to.
235 end
236
237 define xfloat
238 print ((struct Lisp_Float *) (($ & $valmask) | gdb_data_seg_bits))->data
239 end
240 document xfloat
241 Print $ assuming it is a lisp floating-point number.
242 end
243
244 define xscrollbar
245 print (struct scrollbar *) (($ & $valmask) | gdb_data_seg_bits)
246 output *$
247 echo \n
248 end
249 document xscrollbar
250 Print $ as a scrollbar pointer.
251 end
252
253 set print pretty on
254 set print sevenbit-strings
255
256 show environment DISPLAY
257 show environment TERM
258 set args -geometry 80x40+0+0
259
260 # Don't let abort actually run, as it will make
261 # stdio stop working and therefore the `pr' command above as well.
262 break abort
263
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
266 # instead...
267 break x_error_quitter