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