(decode_mode_spec_coding): Fix typo; use `val' instead of `coding-system'.
[bpt/emacs.git] / src / .gdbinit
CommitLineData
b74f15c6
KH
1# Set up a mask to use.
2
7faa0236
RS
3# Force loading of symbols, enough to give us gdb_valbits etc.
4set main
5
39d10e52
RS
6# Find lwlib source files too.
7dir ../lwlib
8
b8d3c872
RS
9# This should be EMACS_INT, but in some cases that is a macro.
10# long ought to work in all cases right now.
11set $valmask = ((long)1 << gdb_valbits) - 1
b74f15c6
KH
12set $nonvalbits = gdb_emacs_intbits - gdb_valbits
13
a6ffc6a2
JB
14# Set up something to print out s-expressions.
15define pr
36fa5981 16set debug_print ($)
a6ffc6a2 17end
a6ffc6a2
JB
18document pr
19Print the emacs s-expression which is $.
20Works only when an inferior emacs is executing.
21end
22
23define xtype
b74f15c6 24output (enum Lisp_Type) (($ >> gdb_valbits) & 0x7)
3fe8bda5 25echo \n
b74f15c6 26output ((($ >> 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)
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
b74f15c6 37set $size = ((struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits))->size
3fe8bda5
RS
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
b74f15c6 46output (enum Lisp_Misc_Type) (((struct Lisp_Free *) (($ & $valmask) | gdb_data_seg_bits))->type)
3fe8bda5
RS
47echo \n
48end
49document xmisctype
50Print the specific type of $, assuming it is some misc type.
e065a56e 51end
a6ffc6a2
JB
52
53define xint
b74f15c6 54print (($ & $valmask) << $nonvalbits) >> $nonvalbits
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
b74f15c6 61print (void *) (($ & $valmask) | gdb_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
b74f15c6 68print (struct window *) (($ & $valmask) | gdb_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
b74f15c6 77print (struct Lisp_Marker *) (($ & $valmask) | gdb_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 83define xoverlay
b74f15c6 84print (struct Lisp_Overlay *) (($ & $valmask) | gdb_data_seg_bits)
a6a3acf0
KH
85end
86document xoverlay
87Print $ as a overlay pointer, assuming it is an Emacs Lisp overlay value.
88end
89
90define xmiscfree
b74f15c6 91print (struct Lisp_Free *) (($ & $valmask) | gdb_data_seg_bits)
a6a3acf0
KH
92end
93document xmiscfree
94Print $ as a misc free-cell pointer, assuming it is an Emacs Lisp Misc value.
95end
96
97define xintfwd
b74f15c6 98print (struct Lisp_Intfwd *) (($ & $valmask) | gdb_data_seg_bits)
a6a3acf0
KH
99end
100document xintfwd
101Print $ as an integer forwarding pointer, assuming it is an Emacs Lisp Misc value.
102end
103
104define xboolfwd
b74f15c6 105print (struct Lisp_Boolfwd *) (($ & $valmask) | gdb_data_seg_bits)
a6a3acf0
KH
106end
107document xboolfwd
108Print $ as a boolean forwarding pointer, assuming it is an Emacs Lisp Misc value.
109end
110
111define xobjfwd
b74f15c6 112print (struct Lisp_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
a6a3acf0
KH
113end
114document xobjfwd
115Print $ as an object forwarding pointer, assuming it is an Emacs Lisp Misc value.
116end
117
029c56f6 118define xbufobjfwd
b74f15c6 119print (struct Lisp_Buffer_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
a6a3acf0 120end
029c56f6 121document xbufobjfwd
a6a3acf0
KH
122Print $ as a buffer-local object forwarding pointer, assuming it is an Emacs Lisp Misc value.
123end
124
a0371857 125define xkbobjfwd
b74f15c6 126print (struct Lisp_Kboard_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
cd39e946 127end
a0371857
KH
128document xkbobjfwd
129Print $ as a kboard-local object forwarding pointer, assuming it is an Emacs Lisp Misc value.
cd39e946
KH
130end
131
029c56f6 132define xbuflocal
b74f15c6 133print (struct Lisp_Buffer_Local_Value *) (($ & $valmask) | gdb_data_seg_bits)
a6a3acf0 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
b74f15c6
KH
140print (struct buffer *) (($ & $valmask) | gdb_data_seg_bits)
141output &((struct Lisp_String *) ((($->name) & $valmask) | gdb_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
b74f15c6 150print (struct Lisp_Symbol *) ((((int) $) & $valmask) | gdb_data_seg_bits)
4a9ee005 151output (char*)&$->name->data
ef15f270 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
b74f15c6 160print (struct Lisp_String *) (($ & $valmask) | gdb_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
b74f15c6 170print (struct Lisp_Vector *) (($ & $valmask) | gdb_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
b74f15c6 180print (struct frame *) (($ & $valmask) | gdb_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
b74f15c6 187print (struct save_window_data *) (($ & $valmask) | gdb_data_seg_bits)
a6a3acf0 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
b74f15c6 194print (struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits)
a6a3acf0
KH
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
b74f15c6 202print (struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits)
6f493884 203output/x *$
ef15f270 204echo \n
a6ffc6a2 205end
e065a56e 206document xcons
ba1e23bf 207Print the contents of $, assuming it is an Emacs Lisp cons.
e065a56e 208end
a6ffc6a2 209
6f493884
RS
210define nextcons
211p $.cdr
212xcons
213end
214document nextcons
215Print the contents of the next cell in a list.
216This assumes that the last thing you printed was a cons cell contents
217(type struct Lisp_Cons) or a pointer to one.
218end
a6ffc6a2 219define xcar
b74f15c6 220print ((($ >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits))->car : 0)
a6ffc6a2 221end
e065a56e 222document xcar
ba1e23bf 223Print the car of $, assuming it is an Emacs Lisp pair.
e065a56e 224end
a6ffc6a2
JB
225
226define xcdr
b74f15c6 227print ((($ >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits))->cdr : 0)
a6ffc6a2 228end
e065a56e 229document xcdr
ba1e23bf 230Print the cdr of $, assuming it is an Emacs Lisp pair.
e065a56e 231end
a6ffc6a2 232
ec558adc 233define xsubr
b74f15c6 234print (struct Lisp_Subr *) (($ & $valmask) | gdb_data_seg_bits)
ec558adc
JB
235output *$
236echo \n
237end
238document xsubr
239Print the address of the subr which the Lisp_Object $ points to.
240end
241
8dd926ca 242define xprocess
b74f15c6 243print (struct Lisp_Process *) (($ & $valmask) | gdb_data_seg_bits)
8dd926ca
JB
244output *$
245echo \n
246end
247document xprocess
248Print the address of the struct Lisp_process which the Lisp_Object $ points to.
249end
250
df86e57e 251define xfloat
b74f15c6 252print ((struct Lisp_Float *) (($ & $valmask) | gdb_data_seg_bits))->data
df86e57e
JB
253end
254document xfloat
255Print $ assuming it is a lisp floating-point number.
256end
257
b2367490 258define xscrollbar
b74f15c6 259print (struct scrollbar *) (($ & $valmask) | gdb_data_seg_bits)
b2367490
JB
260output *$
261echo \n
262end
dec5f4e3 263document xscrollbar
b2367490
JB
264Print $ as a scrollbar pointer.
265end
266
e065a56e 267set print pretty on
df86e57e 268set print sevenbit-strings
a6ffc6a2 269
e5d77022 270show environment DISPLAY
6f5d1a4f 271show environment TERM
6f5d1a4f 272set args -geometry 80x40+0+0
e5d77022 273
a6ffc6a2 274# Don't let abort actually run, as it will make
7f692070 275# stdio stop working and therefore the `pr' command above as well.
a6ffc6a2
JB
276break abort
277
278# If we are running in synchronous mode, we want a chance to look around
279# before Emacs exits. Perhaps we should put the break somewhere else
280# instead...
998ee976 281break x_error_quitter