(redisplay_window): Don't use last_point_x and last_point_y
[bpt/emacs.git] / src / .gdbinit
CommitLineData
7faa0236
RS
1# Force loading of symbols, enough to give us gdb_valbits etc.
2set main
3
39d10e52
RS
4# Find lwlib source files too.
5dir ../lwlib
6
056515d8
KH
7# Don't enter GDB when user types C-g to quit.
8# This has one unfortunate effect: you can't type C-c
9# at the GDB to stop Emacs, when using X.
10# However, C-z works just as well in that case.
11handle 2 noprint pass
12
13# Set up a mask to use.
b8d3c872
RS
14# This should be EMACS_INT, but in some cases that is a macro.
15# long ought to work in all cases right now.
16set $valmask = ((long)1 << gdb_valbits) - 1
b74f15c6
KH
17set $nonvalbits = gdb_emacs_intbits - gdb_valbits
18
a6ffc6a2
JB
19# Set up something to print out s-expressions.
20define pr
36fa5981 21set debug_print ($)
a6ffc6a2 22end
a6ffc6a2
JB
23document pr
24Print the emacs s-expression which is $.
25Works only when an inferior emacs is executing.
26end
27
28define xtype
b74f15c6 29output (enum Lisp_Type) (($ >> gdb_valbits) & 0x7)
3fe8bda5 30echo \n
b74f15c6 31output ((($ >> 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 32echo \n
a6ffc6a2 33end
e065a56e 34document xtype
ba1e23bf 35Print the type of $, assuming it is an Emacs Lisp value.
3fe8bda5
RS
36If the first type printed is Lisp_Vector or Lisp_Misc,
37the second line gives the more precise type.
38Otherwise the second line doesn't mean anything.
39end
40
41define xvectype
b74f15c6 42set $size = ((struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits))->size
3fe8bda5
RS
43output (enum pvec_type) (($size & PVEC_FLAG) ? $size & PVEC_TYPE_MASK : 0)
44echo \n
45end
46document xvectype
47Print the vector subtype of $, assuming it is a vector or pseudovector.
48end
49
50define xmisctype
b74f15c6 51output (enum Lisp_Misc_Type) (((struct Lisp_Free *) (($ & $valmask) | gdb_data_seg_bits))->type)
3fe8bda5
RS
52echo \n
53end
54document xmisctype
55Print the specific type of $, assuming it is some misc type.
e065a56e 56end
a6ffc6a2
JB
57
58define xint
b74f15c6 59print (($ & $valmask) << $nonvalbits) >> $nonvalbits
a6ffc6a2 60end
e065a56e 61document xint
ba1e23bf 62Print $, assuming it is an Emacs Lisp integer. This gets the sign right.
e065a56e 63end
a6ffc6a2
JB
64
65define xptr
b74f15c6 66print (void *) (($ & $valmask) | gdb_data_seg_bits)
a6ffc6a2 67end
e065a56e 68document xptr
ba1e23bf 69Print the pointer portion of $, assuming it is an Emacs Lisp value.
e065a56e 70end
a6ffc6a2
JB
71
72define xwindow
b74f15c6 73print (struct window *) (($ & $valmask) | gdb_data_seg_bits)
ef15f270 74printf "%dx%d+%d+%d\n", $->width, $->height, $->left, $->top
a6ffc6a2 75end
e065a56e 76document xwindow
ba1e23bf 77Print $ as a window pointer, assuming it is an Emacs Lisp window value.
ef15f270 78Print the window's position as "WIDTHxHEIGHT+LEFT+TOP".
e065a56e 79end
a6ffc6a2
JB
80
81define xmarker
b74f15c6 82print (struct Lisp_Marker *) (($ & $valmask) | gdb_data_seg_bits)
a6ffc6a2 83end
e065a56e 84document xmarker
ba1e23bf 85Print $ as a marker pointer, assuming it is an Emacs Lisp marker value.
e065a56e 86end
a6ffc6a2 87
a6a3acf0 88define xoverlay
b74f15c6 89print (struct Lisp_Overlay *) (($ & $valmask) | gdb_data_seg_bits)
a6a3acf0
KH
90end
91document xoverlay
92Print $ as a overlay pointer, assuming it is an Emacs Lisp overlay value.
93end
94
95define xmiscfree
b74f15c6 96print (struct Lisp_Free *) (($ & $valmask) | gdb_data_seg_bits)
a6a3acf0
KH
97end
98document xmiscfree
99Print $ as a misc free-cell pointer, assuming it is an Emacs Lisp Misc value.
100end
101
102define xintfwd
b74f15c6 103print (struct Lisp_Intfwd *) (($ & $valmask) | gdb_data_seg_bits)
a6a3acf0
KH
104end
105document xintfwd
106Print $ as an integer forwarding pointer, assuming it is an Emacs Lisp Misc value.
107end
108
109define xboolfwd
b74f15c6 110print (struct Lisp_Boolfwd *) (($ & $valmask) | gdb_data_seg_bits)
a6a3acf0
KH
111end
112document xboolfwd
113Print $ as a boolean forwarding pointer, assuming it is an Emacs Lisp Misc value.
114end
115
116define xobjfwd
b74f15c6 117print (struct Lisp_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
a6a3acf0
KH
118end
119document xobjfwd
120Print $ as an object forwarding pointer, assuming it is an Emacs Lisp Misc value.
121end
122
029c56f6 123define xbufobjfwd
b74f15c6 124print (struct Lisp_Buffer_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
a6a3acf0 125end
029c56f6 126document xbufobjfwd
a6a3acf0
KH
127Print $ as a buffer-local object forwarding pointer, assuming it is an Emacs Lisp Misc value.
128end
129
a0371857 130define xkbobjfwd
b74f15c6 131print (struct Lisp_Kboard_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
cd39e946 132end
a0371857
KH
133document xkbobjfwd
134Print $ as a kboard-local object forwarding pointer, assuming it is an Emacs Lisp Misc value.
cd39e946
KH
135end
136
029c56f6 137define xbuflocal
b74f15c6 138print (struct Lisp_Buffer_Local_Value *) (($ & $valmask) | gdb_data_seg_bits)
a6a3acf0 139end
029c56f6 140document xbuflocal
a6a3acf0
KH
141Print $ as a buffer-local-value pointer, assuming it is an Emacs Lisp Misc value.
142end
143
a6ffc6a2 144define xbuffer
b74f15c6
KH
145print (struct buffer *) (($ & $valmask) | gdb_data_seg_bits)
146output &((struct Lisp_String *) ((($->name) & $valmask) | gdb_data_seg_bits))->data
ef15f270 147echo \n
a6ffc6a2 148end
e065a56e 149document xbuffer
ba1e23bf 150Set $ as a buffer pointer, assuming it is an Emacs Lisp buffer value.
daa37602 151Print the name of the buffer.
e065a56e 152end
a6ffc6a2
JB
153
154define xsymbol
b74f15c6 155print (struct Lisp_Symbol *) ((((int) $) & $valmask) | gdb_data_seg_bits)
4a9ee005 156output (char*)&$->name->data
ef15f270 157echo \n
a6ffc6a2 158end
e065a56e
JB
159document xsymbol
160Print the name and address of the symbol $.
ba1e23bf 161This command assumes that $ is an Emacs Lisp symbol value.
e065a56e 162end
a6ffc6a2
JB
163
164define xstring
b74f15c6 165print (struct Lisp_String *) (($ & $valmask) | gdb_data_seg_bits)
79f6bf6a 166output ($->size > 1000) ? 0 : ($->data[0])@($->size_byte)
ef15f270 167echo \n
a6ffc6a2 168end
a6ffc6a2 169document xstring
e065a56e 170Print the contents and address of the string $.
ba1e23bf 171This command assumes that $ is an Emacs Lisp string value.
a6ffc6a2
JB
172end
173
174define xvector
b74f15c6 175print (struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits)
4ea0847a 176output ($->size > 50) ? 0 : ($->contents[0])@($->size)
ef15f270 177echo \n
a6ffc6a2 178end
a6ffc6a2 179document xvector
e065a56e 180Print the contents and address of the vector $.
ba1e23bf 181This command assumes that $ is an Emacs Lisp vector value.
a6ffc6a2
JB
182end
183
ec558adc 184define xframe
b74f15c6 185print (struct frame *) (($ & $valmask) | gdb_data_seg_bits)
a6ffc6a2 186end
ec558adc 187document xframe
ba1e23bf 188Print $ as a frame pointer, assuming it is an Emacs Lisp frame value.
e065a56e 189end
a6ffc6a2 190
029c56f6 191define xwinconfig
b74f15c6 192print (struct save_window_data *) (($ & $valmask) | gdb_data_seg_bits)
a6a3acf0 193end
029c56f6 194document xwinconfig
a6a3acf0
KH
195Print $ as a window configuration pointer, assuming it is an Emacs Lisp window configuration value.
196end
197
198define xcompiled
b74f15c6 199print (struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits)
a6a3acf0
KH
200output ($->contents[0])@($->size & 0xff)
201end
202document xcompiled
203Print $ as a compiled function pointer, assuming it is an Emacs Lisp compiled value.
204end
205
a6ffc6a2 206define xcons
b74f15c6 207print (struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits)
6f493884 208output/x *$
ef15f270 209echo \n
a6ffc6a2 210end
e065a56e 211document xcons
ba1e23bf 212Print the contents of $, assuming it is an Emacs Lisp cons.
e065a56e 213end
a6ffc6a2 214
6f493884
RS
215define nextcons
216p $.cdr
217xcons
218end
219document nextcons
220Print the contents of the next cell in a list.
221This assumes that the last thing you printed was a cons cell contents
222(type struct Lisp_Cons) or a pointer to one.
223end
a6ffc6a2 224define xcar
de2436ef 225print/x ((($ >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits))->car : 0)
a6ffc6a2 226end
e065a56e 227document xcar
ba1e23bf 228Print the car of $, assuming it is an Emacs Lisp pair.
e065a56e 229end
a6ffc6a2
JB
230
231define xcdr
de2436ef 232print/x ((($ >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits))->cdr : 0)
a6ffc6a2 233end
e065a56e 234document xcdr
ba1e23bf 235Print the cdr of $, assuming it is an Emacs Lisp pair.
e065a56e 236end
a6ffc6a2 237
ec558adc 238define xsubr
b74f15c6 239print (struct Lisp_Subr *) (($ & $valmask) | gdb_data_seg_bits)
ec558adc
JB
240output *$
241echo \n
242end
243document xsubr
244Print the address of the subr which the Lisp_Object $ points to.
245end
246
8dd926ca 247define xprocess
b74f15c6 248print (struct Lisp_Process *) (($ & $valmask) | gdb_data_seg_bits)
8dd926ca
JB
249output *$
250echo \n
251end
252document xprocess
253Print the address of the struct Lisp_process which the Lisp_Object $ points to.
254end
255
df86e57e 256define xfloat
b74f15c6 257print ((struct Lisp_Float *) (($ & $valmask) | gdb_data_seg_bits))->data
df86e57e
JB
258end
259document xfloat
260Print $ assuming it is a lisp floating-point number.
261end
262
b2367490 263define xscrollbar
b74f15c6 264print (struct scrollbar *) (($ & $valmask) | gdb_data_seg_bits)
b2367490
JB
265output *$
266echo \n
267end
dec5f4e3 268document xscrollbar
b2367490
JB
269Print $ as a scrollbar pointer.
270end
271
e065a56e 272set print pretty on
df86e57e 273set print sevenbit-strings
a6ffc6a2 274
e5d77022 275show environment DISPLAY
6f5d1a4f 276show environment TERM
6f5d1a4f 277set args -geometry 80x40+0+0
e5d77022 278
a6ffc6a2 279# Don't let abort actually run, as it will make
7f692070 280# stdio stop working and therefore the `pr' command above as well.
a6ffc6a2
JB
281break abort
282
283# If we are running in synchronous mode, we want a chance to look around
284# before Emacs exits. Perhaps we should put the break somewhere else
285# instead...
998ee976 286break x_error_quitter