(xboolfwd, xbuffer_local_value, xbuffer_objfwd, xcompiled, xintfwd, xmiscfree,
[emacs.git] / src / .gdbinit
blob2b5d9bade63d58c01f208df486d4e71027b4d569
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
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
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
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
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
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
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
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
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
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
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
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
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.
104 define xboolfwd
105 print (struct Lisp_Boolfwd *) (($ & 0x0fffffff) | $data_seg_bits)
107 document xboolfwd
108 Print $ as a boolean forwarding pointer, assuming it is an Emacs Lisp Misc value.
111 define xobjfwd
112 print (struct Lisp_Objfwd *) (($ & 0x0fffffff) | $data_seg_bits)
114 document xobjfwd
115 Print $ as an object forwarding pointer, assuming it is an Emacs Lisp Misc value.
118 define xbuffer_objfwd
119 print (struct Lisp_Buffer_Objfwd *) (($ & 0x0fffffff) | $data_seg_bits)
121 document xbuffer_objfwd
122 Print $ as a buffer-local object forwarding pointer, assuming it is an Emacs Lisp Misc value.
125 define xbuffer_local_value
126 print (struct Lisp_Buffer_Local_Value *) (($ & 0x0fffffff) | $data_seg_bits)
128 document xbuffer_local_value
129 Print $ as a buffer-local-value pointer, assuming it is an Emacs Lisp Misc value.
132 define xbuffer
133 print (struct buffer *) (($ & 0x0fffffff) | $data_seg_bits)
134 output &((struct Lisp_String *) ((($->name) & 0x0fffffff) | $data_seg_bits))->data
135 echo \n
137 document xbuffer
138 Set $ as a buffer pointer, assuming it is an Emacs Lisp buffer value.
139 Print the name of the buffer.
142 define xsymbol
143 print (struct Lisp_Symbol *) ((((int) $) & 0x0fffffff) | $data_seg_bits)
144 output &$->name->data
145 echo \n
147 document xsymbol
148 Print the name and address of the symbol $.
149 This command assumes that $ is an Emacs Lisp symbol value.
152 define xstring
153 print (struct Lisp_String *) (($ & 0x0fffffff) | $data_seg_bits)
154 output ($->size > 1000) ? 0 : ($->data[0])@($->size)
155 echo \n
157 document xstring
158 Print the contents and address of the string $.
159 This command assumes that $ is an Emacs Lisp string value.
162 define xvector
163 print (struct Lisp_Vector *) (($ & 0x0fffffff) | $data_seg_bits)
164 output ($->size > 50) ? 0 : ($->contents[0])@($->size)
165 echo \n
167 document xvector
168 Print the contents and address of the vector $.
169 This command assumes that $ is an Emacs Lisp vector value.
172 define xframe
173 print (struct frame *) (($ & 0x0fffffff) | $data_seg_bits)
175 document xframe
176 Print $ as a frame pointer, assuming it is an Emacs Lisp frame value.
179 define xwindow_configuration
180 print (struct save_window_data *) (($ & 0x0fffffff) | $data_seg_bits)
182 document xwindow_configuration
183 Print $ as a window configuration pointer, assuming it is an Emacs Lisp window configuration value.
186 define xcompiled
187 print (struct Lisp_Vector *) (($ & 0x0fffffff) | $data_seg_bits)
188 output ($->contents[0])@($->size & 0xff)
190 document xcompiled
191 Print $ as a compiled function pointer, assuming it is an Emacs Lisp compiled value.
194 define xcons
195 print (struct Lisp_Cons *) (($ & 0x0fffffff) | $data_seg_bits)
196 output *$
197 echo \n
199 document xcons
200 Print the contents of $, assuming it is an Emacs Lisp cons.
203 define xcar
204 print ((($ >> 28) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & 0x0fffffff) | $data_seg_bits))->car : 0)
206 document xcar
207 Print the car of $, assuming it is an Emacs Lisp pair.
210 define xcdr
211 print ((($ >> 28) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & 0x0fffffff) | $data_seg_bits))->cdr : 0)
213 document xcdr
214 Print the cdr of $, assuming it is an Emacs Lisp pair.
217 define xsubr
218 print (struct Lisp_Subr *) (($ & 0x0fffffff) | $data_seg_bits)
219 output *$
220 echo \n
222 document xsubr
223 Print the address of the subr which the Lisp_Object $ points to.
226 define xprocess
227 print (struct Lisp_Process *) (($ & 0x0fffffff) | $data_seg_bits)
228 output *$
229 echo \n
231 document xprocess
232 Print the address of the struct Lisp_process which the Lisp_Object $ points to.
235 define xfloat
236 print ((struct Lisp_Float *) (($ & 0x0fffffff) | $data_seg_bits))->data
238 document xfloat
239 Print $ assuming it is a lisp floating-point number.
242 define xscrollbar
243 print (struct scrollbar *) (($ & 0x0fffffff) | $data_seg_bits)
244 output *$
245 echo \n
247 document xscrollbar
248 Print $ as a scrollbar pointer.
251 set print pretty on
252 set print sevenbit-strings
254 show environment DISPLAY
255 show environment TERM
256 set args -geometry 80x40+0+0
258 # Don't let abort actually run, as it will make
259 # stdio stop working and therefore the `pr' command above as well.
260 break abort
262 # If we are running in synchronous mode, we want a chance to look around
263 # before Emacs exits.  Perhaps we should put the break somewhere else
264 # instead...
265 break x_error_quitter