(unrmail): Total rewrite.
[bpt/emacs.git] / src / .gdbinit
... / ...
CommitLineData
1# Set up something to print out s-expressions.
2define pr
3set Fprin1 ($, Qexternal_debugging_output)
4echo \n
5end
6document pr
7Print the emacs s-expression which is $.
8Works only when an inferior emacs is executing.
9end
10
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
24output (enum Lisp_Type) (($ >> 24) & 0x7f)
25echo \n
26end
27document xtype
28Print the type of $, assuming it is an Elisp value.
29end
30
31define xint
32print (($ & 0x00ffffff) << 8) >> 8
33end
34document xint
35Print $, assuming it is an Elisp integer. This gets the sign right.
36end
37
38define xptr
39print (void *) (($ & 0x00ffffff) | $data_seg_bits)
40end
41document xptr
42Print the pointer portion of $, assuming it is an Elisp value.
43end
44
45define xwindow
46print (struct window *) (($ & 0x00ffffff) | $data_seg_bits)
47printf "%dx%d+%d+%d\n", $->width, $->height, $->left, $->top
48end
49document xwindow
50Print $ as a window pointer, assuming it is an Elisp window value.
51Print the window's position as "WIDTHxHEIGHT+LEFT+TOP".
52end
53
54define xmarker
55print (struct Lisp_Marker *) (($ & 0x00ffffff) | $data_seg_bits)
56end
57document xmarker
58Print $ as a marker pointer, assuming it is an Elisp marker value.
59end
60
61define xbuffer
62print (struct buffer *) (($ & 0x00ffffff) | $data_seg_bits)
63output &((struct Lisp_String *) ((($->name) & 0x00ffffff) | $data_seg_bits))->data
64echo \n
65end
66document xbuffer
67Set $ as a buffer pointer, assuming it is an Elisp buffer value.
68Print the name of the buffer.
69end
70
71define xsymbol
72print (struct Lisp_Symbol *) (($ & 0x00ffffff) | $data_seg_bits)
73output &$->name->data
74echo \n
75end
76document xsymbol
77Print the name and address of the symbol $.
78This command assumes that $ is an Elisp symbol value.
79end
80
81define xstring
82print (struct Lisp_String *) (($ & 0x00ffffff) | $data_seg_bits)
83output ($->size > 10000) ? "big string" : ($->data[0])@($->size)
84echo \n
85end
86document xstring
87Print the contents and address of the string $.
88This command assumes that $ is an Elisp string value.
89end
90
91define xvector
92print (struct Lisp_Vector *) (($ & 0x00ffffff) | $data_seg_bits)
93output ($->size > 1000) ? "big vector" : ($->contents[0])@($->size)
94echo \n
95end
96document xvector
97Print the contents and address of the vector $.
98This command assumes that $ is an Elisp vector value.
99end
100
101define xframe
102print (struct frame *) (($ & 0x00ffffff) | $data_seg_bits)
103end
104document xframe
105Print $ as a frame pointer, assuming it is an Elisp frame value.
106end
107
108define xcons
109print (struct Lisp_Cons *) (($ & 0x00ffffff) | $data_seg_bits)
110output *$
111echo \n
112end
113document xcons
114Print the contents of $, assuming it is an Elisp cons.
115end
116
117define xcar
118print ((($ >> 24) & 0x7f) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & 0x00ffffff) | $data_seg_bits))->car : 0)
119end
120document xcar
121Print the car of $, assuming it is an Elisp pair.
122end
123
124define xcdr
125print ((($ >> 24) & 0x7f) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & 0x00ffffff) | $data_seg_bits))->cdr : 0)
126end
127document xcdr
128Print the cdr of $, assuming it is an Elisp pair.
129end
130
131define xsubr
132print (struct Lisp_Subr *) (($ & 0x00ffffff) | $data_seg_bits)
133output *$
134echo \n
135end
136document xsubr
137Print the address of the subr which the Lisp_Object $ points to.
138end
139
140define xprocess
141print (struct Lisp_Process *) (($ & 0x00ffffff) | $data_seg_bits)
142output *$
143echo \n
144end
145document xprocess
146Print the address of the struct Lisp_process which the Lisp_Object $ points to.
147end
148
149define xscrollbar
150print (struct scrollbar *) (($ & 0x00ffffff) | $data_seg_bits)
151output *$
152echo \n
153end
154document xsubr
155Print $ as a scrollbar pointer.
156end
157
158set print pretty on
159
160unset environment TERMCAP
161unset environment TERM
162echo TERMCAP and TERM environment variables unset.\n
163show environment DISPLAY
164set args -q -geometry +0+0
165
166# Don't let abort actually run, as it will make
167# stdio stop working and therefore the `pr' command above as well.
168break abort
169
170# If we are running in synchronous mode, we want a chance to look around
171# before Emacs exits. Perhaps we should put the break somewhere else
172# instead...
173break _XPrintDefaultError
174