Adapt to new Lisp_Object format.
[bpt/emacs.git] / src / .gdbinit
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
10
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
14
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
22
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
35
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
44
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
52
53 define xint
54 print (($ & 0x00ffffff) << 4) >> 4
55 end
56 document xint
57 Print $, assuming it is an Emacs Lisp integer. This gets the sign right.
58 end
59
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
66
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
75
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
82
83 define xbuffer
84 print (struct buffer *) (($ & 0x0fffffff) | $data_seg_bits)
85 output &((struct Lisp_String *) ((($->name) & 0x0fffffff) | $data_seg_bits))->data
86 echo \n
87 end
88 document xbuffer
89 Set $ as a buffer pointer, assuming it is an Emacs Lisp buffer value.
90 Print the name of the buffer.
91 end
92
93 define xsymbol
94 print (struct Lisp_Symbol *) ((((int) $) & 0x0fffffff) | $data_seg_bits)
95 output &$->name->data
96 echo \n
97 end
98 document xsymbol
99 Print the name and address of the symbol $.
100 This command assumes that $ is an Emacs Lisp symbol value.
101 end
102
103 define xstring
104 print (struct Lisp_String *) (($ & 0x0fffffff) | $data_seg_bits)
105 output ($->size > 1000) ? 0 : ($->data[0])@($->size)
106 echo \n
107 end
108 document xstring
109 Print the contents and address of the string $.
110 This command assumes that $ is an Emacs Lisp string value.
111 end
112
113 define xvector
114 print (struct Lisp_Vector *) (($ & 0x0fffffff) | $data_seg_bits)
115 output ($->size > 50) ? 0 : ($->contents[0])@($->size)
116 echo \n
117 end
118 document xvector
119 Print the contents and address of the vector $.
120 This command assumes that $ is an Emacs Lisp vector value.
121 end
122
123 define xframe
124 print (struct frame *) (($ & 0x0fffffff) | $data_seg_bits)
125 end
126 document xframe
127 Print $ as a frame pointer, assuming it is an Emacs Lisp frame value.
128 end
129
130 define xcons
131 print (struct Lisp_Cons *) (($ & 0x0fffffff) | $data_seg_bits)
132 output *$
133 echo \n
134 end
135 document xcons
136 Print the contents of $, assuming it is an Emacs Lisp cons.
137 end
138
139 define xcar
140 print ((($ >> 24) & 0x7f) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & 0x0fffffff) | $data_seg_bits))->car : 0)
141 end
142 document xcar
143 Print the car of $, assuming it is an Emacs Lisp pair.
144 end
145
146 define xcdr
147 print ((($ >> 24) & 0x7f) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & 0x0fffffff) | $data_seg_bits))->cdr : 0)
148 end
149 document xcdr
150 Print the cdr of $, assuming it is an Emacs Lisp pair.
151 end
152
153 define xsubr
154 print (struct Lisp_Subr *) (($ & 0x0fffffff) | $data_seg_bits)
155 output *$
156 echo \n
157 end
158 document xsubr
159 Print the address of the subr which the Lisp_Object $ points to.
160 end
161
162 define xprocess
163 print (struct Lisp_Process *) (($ & 0x0fffffff) | $data_seg_bits)
164 output *$
165 echo \n
166 end
167 document xprocess
168 Print the address of the struct Lisp_process which the Lisp_Object $ points to.
169 end
170
171 define xfloat
172 print ((struct Lisp_Float *) (($ & 0x0fffffff) | $data_seg_bits))->data
173 end
174 document xfloat
175 Print $ assuming it is a lisp floating-point number.
176 end
177
178 define xscrollbar
179 print (struct scrollbar *) (($ & 0x0fffffff) | $data_seg_bits)
180 output *$
181 echo \n
182 end
183 document xscrollbar
184 Print $ as a scrollbar pointer.
185 end
186
187 set print pretty on
188 set print sevenbit-strings
189
190 show environment DISPLAY
191 show environment TERM
192 set args -geometry 80x40+0+0
193
194 # Don't let abort actually run, as it will make
195 # stdio stop working and therefore the `pr' command above as well.
196 break abort
197
198 # If we are running in synchronous mode, we want a chance to look around
199 # before Emacs exits. Perhaps we should put the break somewhere else
200 # instead...
201 break x_error_quitter
202
203