aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit79
1 files changed, 36 insertions, 43 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index 91df9cce2d7..fcc7de7b90f 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -1,3 +1,8 @@
1# Set up a mask to use.
2
3set $valmask = (1 << gdb_valbits) - 1
4set $nonvalbits = gdb_emacs_intbits - gdb_valbits
5
1# Set up something to print out s-expressions. 6# Set up something to print out s-expressions.
2define pr 7define pr
3set debug_print ($) 8set debug_print ($)
@@ -8,22 +13,10 @@ Print the emacs s-expression which is $.
8Works only when an inferior emacs is executing. 13Works only when an inferior emacs is executing.
9end 14end
10 15
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
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
23define xtype 16define xtype
24output (enum Lisp_Type) (($ >> 28) & 0x7) 17output (enum Lisp_Type) (($ >> gdb_valbits) & 0x7)
25echo \n 18echo \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) 19output ((($ >> 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)
27echo \n 20echo \n
28end 21end
29document xtype 22document xtype
@@ -34,7 +27,7 @@ Otherwise the second line doesn't mean anything.
34end 27end
35 28
36define xvectype 29define xvectype
37set $size = ((struct Lisp_Vector *) (($ & 0x0fffffff) | $data_seg_bits))->size 30set $size = ((struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits))->size
38output (enum pvec_type) (($size & PVEC_FLAG) ? $size & PVEC_TYPE_MASK : 0) 31output (enum pvec_type) (($size & PVEC_FLAG) ? $size & PVEC_TYPE_MASK : 0)
39echo \n 32echo \n
40end 33end
@@ -43,7 +36,7 @@ Print the vector subtype of $, assuming it is a vector or pseudovector.
43end 36end
44 37
45define xmisctype 38define xmisctype
46output (enum Lisp_Misc_Type) (((struct Lisp_Free *) (($ & 0x0fffffff) | $data_seg_bits))->type) 39output (enum Lisp_Misc_Type) (((struct Lisp_Free *) (($ & $valmask) | gdb_data_seg_bits))->type)
47echo \n 40echo \n
48end 41end
49document xmisctype 42document xmisctype
@@ -51,21 +44,21 @@ Print the specific type of $, assuming it is some misc type.
51end 44end
52 45
53define xint 46define xint
54print (($ & 0x0fffffff) << 4) >> 4 47print (($ & $valmask) << $nonvalbits) >> $nonvalbits
55end 48end
56document xint 49document xint
57Print $, assuming it is an Emacs Lisp integer. This gets the sign right. 50Print $, assuming it is an Emacs Lisp integer. This gets the sign right.
58end 51end
59 52
60define xptr 53define xptr
61print (void *) (($ & 0x0fffffff) | $data_seg_bits) 54print (void *) (($ & $valmask) | gdb_data_seg_bits)
62end 55end
63document xptr 56document xptr
64Print the pointer portion of $, assuming it is an Emacs Lisp value. 57Print the pointer portion of $, assuming it is an Emacs Lisp value.
65end 58end
66 59
67define xwindow 60define xwindow
68print (struct window *) (($ & 0x0fffffff) | $data_seg_bits) 61print (struct window *) (($ & $valmask) | gdb_data_seg_bits)
69printf "%dx%d+%d+%d\n", $->width, $->height, $->left, $->top 62printf "%dx%d+%d+%d\n", $->width, $->height, $->left, $->top
70end 63end
71document xwindow 64document xwindow
@@ -74,71 +67,71 @@ Print the window's position as "WIDTHxHEIGHT+LEFT+TOP".
74end 67end
75 68
76define xmarker 69define xmarker
77print (struct Lisp_Marker *) (($ & 0x0fffffff) | $data_seg_bits) 70print (struct Lisp_Marker *) (($ & $valmask) | gdb_data_seg_bits)
78end 71end
79document xmarker 72document xmarker
80Print $ as a marker pointer, assuming it is an Emacs Lisp marker value. 73Print $ as a marker pointer, assuming it is an Emacs Lisp marker value.
81end 74end
82 75
83define xoverlay 76define xoverlay
84print (struct Lisp_Overlay *) (($ & 0x0fffffff) | $data_seg_bits) 77print (struct Lisp_Overlay *) (($ & $valmask) | gdb_data_seg_bits)
85end 78end
86document xoverlay 79document xoverlay
87Print $ as a overlay pointer, assuming it is an Emacs Lisp overlay value. 80Print $ as a overlay pointer, assuming it is an Emacs Lisp overlay value.
88end 81end
89 82
90define xmiscfree 83define xmiscfree
91print (struct Lisp_Free *) (($ & 0x0fffffff) | $data_seg_bits) 84print (struct Lisp_Free *) (($ & $valmask) | gdb_data_seg_bits)
92end 85end
93document xmiscfree 86document xmiscfree
94Print $ as a misc free-cell pointer, assuming it is an Emacs Lisp Misc value. 87Print $ as a misc free-cell pointer, assuming it is an Emacs Lisp Misc value.
95end 88end
96 89
97define xintfwd 90define xintfwd
98print (struct Lisp_Intfwd *) (($ & 0x0fffffff) | $data_seg_bits) 91print (struct Lisp_Intfwd *) (($ & $valmask) | gdb_data_seg_bits)
99end 92end
100document xintfwd 93document xintfwd
101Print $ as an integer forwarding pointer, assuming it is an Emacs Lisp Misc value. 94Print $ as an integer forwarding pointer, assuming it is an Emacs Lisp Misc value.
102end 95end
103 96
104define xboolfwd 97define xboolfwd
105print (struct Lisp_Boolfwd *) (($ & 0x0fffffff) | $data_seg_bits) 98print (struct Lisp_Boolfwd *) (($ & $valmask) | gdb_data_seg_bits)
106end 99end
107document xboolfwd 100document xboolfwd
108Print $ as a boolean forwarding pointer, assuming it is an Emacs Lisp Misc value. 101Print $ as a boolean forwarding pointer, assuming it is an Emacs Lisp Misc value.
109end 102end
110 103
111define xobjfwd 104define xobjfwd
112print (struct Lisp_Objfwd *) (($ & 0x0fffffff) | $data_seg_bits) 105print (struct Lisp_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
113end 106end
114document xobjfwd 107document xobjfwd
115Print $ as an object forwarding pointer, assuming it is an Emacs Lisp Misc value. 108Print $ as an object forwarding pointer, assuming it is an Emacs Lisp Misc value.
116end 109end
117 110
118define xbufobjfwd 111define xbufobjfwd
119print (struct Lisp_Buffer_Objfwd *) (($ & 0x0fffffff) | $data_seg_bits) 112print (struct Lisp_Buffer_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
120end 113end
121document xbufobjfwd 114document xbufobjfwd
122Print $ as a buffer-local object forwarding pointer, assuming it is an Emacs Lisp Misc value. 115Print $ as a buffer-local object forwarding pointer, assuming it is an Emacs Lisp Misc value.
123end 116end
124 117
125define xkbobjfwd 118define xkbobjfwd
126print (struct Lisp_Kboard_Objfwd *) (($ & 0x0fffffff) | $data_seg_bits) 119print (struct Lisp_Kboard_Objfwd *) (($ & $valmask) | gdb_data_seg_bits)
127end 120end
128document xkbobjfwd 121document xkbobjfwd
129Print $ as a kboard-local object forwarding pointer, assuming it is an Emacs Lisp Misc value. 122Print $ as a kboard-local object forwarding pointer, assuming it is an Emacs Lisp Misc value.
130end 123end
131 124
132define xbuflocal 125define xbuflocal
133print (struct Lisp_Buffer_Local_Value *) (($ & 0x0fffffff) | $data_seg_bits) 126print (struct Lisp_Buffer_Local_Value *) (($ & $valmask) | gdb_data_seg_bits)
134end 127end
135document xbuflocal 128document xbuflocal
136Print $ as a buffer-local-value pointer, assuming it is an Emacs Lisp Misc value. 129Print $ as a buffer-local-value pointer, assuming it is an Emacs Lisp Misc value.
137end 130end
138 131
139define xbuffer 132define xbuffer
140print (struct buffer *) (($ & 0x0fffffff) | $data_seg_bits) 133print (struct buffer *) (($ & $valmask) | gdb_data_seg_bits)
141output &((struct Lisp_String *) ((($->name) & 0x0fffffff) | $data_seg_bits))->data 134output &((struct Lisp_String *) ((($->name) & $valmask) | gdb_data_seg_bits))->data
142echo \n 135echo \n
143end 136end
144document xbuffer 137document xbuffer
@@ -147,7 +140,7 @@ Print the name of the buffer.
147end 140end
148 141
149define xsymbol 142define xsymbol
150print (struct Lisp_Symbol *) ((((int) $) & 0x0fffffff) | $data_seg_bits) 143print (struct Lisp_Symbol *) ((((int) $) & $valmask) | gdb_data_seg_bits)
151output &$->name->data 144output &$->name->data
152echo \n 145echo \n
153end 146end
@@ -157,7 +150,7 @@ This command assumes that $ is an Emacs Lisp symbol value.
157end 150end
158 151
159define xstring 152define xstring
160print (struct Lisp_String *) (($ & 0x0fffffff) | $data_seg_bits) 153print (struct Lisp_String *) (($ & $valmask) | gdb_data_seg_bits)
161output ($->size > 1000) ? 0 : ($->data[0])@($->size) 154output ($->size > 1000) ? 0 : ($->data[0])@($->size)
162echo \n 155echo \n
163end 156end
@@ -167,7 +160,7 @@ This command assumes that $ is an Emacs Lisp string value.
167end 160end
168 161
169define xvector 162define xvector
170print (struct Lisp_Vector *) (($ & 0x0fffffff) | $data_seg_bits) 163print (struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits)
171output ($->size > 50) ? 0 : ($->contents[0])@($->size) 164output ($->size > 50) ? 0 : ($->contents[0])@($->size)
172echo \n 165echo \n
173end 166end
@@ -177,21 +170,21 @@ This command assumes that $ is an Emacs Lisp vector value.
177end 170end
178 171
179define xframe 172define xframe
180print (struct frame *) (($ & 0x0fffffff) | $data_seg_bits) 173print (struct frame *) (($ & $valmask) | gdb_data_seg_bits)
181end 174end
182document xframe 175document xframe
183Print $ as a frame pointer, assuming it is an Emacs Lisp frame value. 176Print $ as a frame pointer, assuming it is an Emacs Lisp frame value.
184end 177end
185 178
186define xwinconfig 179define xwinconfig
187print (struct save_window_data *) (($ & 0x0fffffff) | $data_seg_bits) 180print (struct save_window_data *) (($ & $valmask) | gdb_data_seg_bits)
188end 181end
189document xwinconfig 182document xwinconfig
190Print $ as a window configuration pointer, assuming it is an Emacs Lisp window configuration value. 183Print $ as a window configuration pointer, assuming it is an Emacs Lisp window configuration value.
191end 184end
192 185
193define xcompiled 186define xcompiled
194print (struct Lisp_Vector *) (($ & 0x0fffffff) | $data_seg_bits) 187print (struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits)
195output ($->contents[0])@($->size & 0xff) 188output ($->contents[0])@($->size & 0xff)
196end 189end
197document xcompiled 190document xcompiled
@@ -199,7 +192,7 @@ Print $ as a compiled function pointer, assuming it is an Emacs Lisp compiled va
199end 192end
200 193
201define xcons 194define xcons
202print (struct Lisp_Cons *) (($ & 0x0fffffff) | $data_seg_bits) 195print (struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits)
203output *$ 196output *$
204echo \n 197echo \n
205end 198end
@@ -208,21 +201,21 @@ Print the contents of $, assuming it is an Emacs Lisp cons.
208end 201end
209 202
210define xcar 203define xcar
211print ((($ >> 28) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & 0x0fffffff) | $data_seg_bits))->car : 0) 204print ((($ >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits))->car : 0)
212end 205end
213document xcar 206document xcar
214Print the car of $, assuming it is an Emacs Lisp pair. 207Print the car of $, assuming it is an Emacs Lisp pair.
215end 208end
216 209
217define xcdr 210define xcdr
218print ((($ >> 28) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & 0x0fffffff) | $data_seg_bits))->cdr : 0) 211print ((($ >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits))->cdr : 0)
219end 212end
220document xcdr 213document xcdr
221Print the cdr of $, assuming it is an Emacs Lisp pair. 214Print the cdr of $, assuming it is an Emacs Lisp pair.
222end 215end
223 216
224define xsubr 217define xsubr
225print (struct Lisp_Subr *) (($ & 0x0fffffff) | $data_seg_bits) 218print (struct Lisp_Subr *) (($ & $valmask) | gdb_data_seg_bits)
226output *$ 219output *$
227echo \n 220echo \n
228end 221end
@@ -231,7 +224,7 @@ Print the address of the subr which the Lisp_Object $ points to.
231end 224end
232 225
233define xprocess 226define xprocess
234print (struct Lisp_Process *) (($ & 0x0fffffff) | $data_seg_bits) 227print (struct Lisp_Process *) (($ & $valmask) | gdb_data_seg_bits)
235output *$ 228output *$
236echo \n 229echo \n
237end 230end
@@ -240,14 +233,14 @@ Print the address of the struct Lisp_process which the Lisp_Object $ points to.
240end 233end
241 234
242define xfloat 235define xfloat
243print ((struct Lisp_Float *) (($ & 0x0fffffff) | $data_seg_bits))->data 236print ((struct Lisp_Float *) (($ & $valmask) | gdb_data_seg_bits))->data
244end 237end
245document xfloat 238document xfloat
246Print $ assuming it is a lisp floating-point number. 239Print $ assuming it is a lisp floating-point number.
247end 240end
248 241
249define xscrollbar 242define xscrollbar
250print (struct scrollbar *) (($ & 0x0fffffff) | $data_seg_bits) 243print (struct scrollbar *) (($ & $valmask) | gdb_data_seg_bits)
251output *$ 244output *$
252echo \n 245echo \n
253end 246end