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