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