*** empty log message ***
[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
11define xtype
12print (enum Lisp_Type) (($ >> 24) & 0x7f)
13p $$
14end
e065a56e
JB
15document xtype
16Print the type of $, assuming it is an Elisp value.
17end
a6ffc6a2
JB
18
19define xint
20print (($ & 0x00ffffff) << 8) >> 8
21end
e065a56e
JB
22document xint
23Print $, assuming it is an Elisp integer. This gets the sign right.
24end
a6ffc6a2
JB
25
26define xptr
27print (void *) ($ & 0x00ffffff)
28end
e065a56e
JB
29document xptr
30Print the pointer portion of $, assuming it is an Elisp value.
31end
a6ffc6a2
JB
32
33define xwindow
34print (struct window *) ($ & 0x00ffffff)
35end
e065a56e
JB
36document xwindow
37Print $ as a window pointer, assuming it is an Elisp window value.
38end
a6ffc6a2
JB
39
40define xmarker
41print (struct Lisp_Marker *) ($ & 0x00ffffff)
42end
e065a56e
JB
43document xmarker
44Print $ as a marker pointer, assuming it is an Elisp marker value.
45end
a6ffc6a2
JB
46
47define xbuffer
48print (struct buffer *) ($ & 0x00ffffff)
49end
e065a56e
JB
50document xbuffer
51Print $ as a buffer pointer, assuming it is an Elisp buffer value.
52end
a6ffc6a2
JB
53
54define xsymbol
55print (struct Lisp_Symbol *) ($ & 0x00ffffff)
56print &$->name->data
57print $$
58end
e065a56e
JB
59document xsymbol
60Print the name and address of the symbol $.
61This command assumes that $ is an Elisp symbol value.
62end
a6ffc6a2
JB
63
64define xstring
65print (struct Lisp_String *) ($ & 0x00ffffff)
e065a56e 66print ($->size > 10000) ? "big string" : ($->data[0])@($->size)
a6ffc6a2
JB
67print $$
68end
a6ffc6a2 69document xstring
e065a56e
JB
70Print the contents and address of the string $.
71This command assumes that $ is an Elisp string value.
a6ffc6a2
JB
72end
73
74define xvector
75set $temp = (struct Lisp_Vector *) ($ & 0x00ffffff)
e065a56e 76print ($temp->size > 10000) ? "big vector" : ($temp->contents[0])@($temp->size)
a6ffc6a2
JB
77print $temp
78end
a6ffc6a2 79document xvector
e065a56e
JB
80Print the contents and address of the vector $.
81This command assumes that $ is an Elisp vector value.
a6ffc6a2
JB
82end
83
84define xscreen
85print (struct screen *) ($ & 0x00ffffff)
86end
e065a56e
JB
87document xwindow
88Print $ as a screen pointer, assuming it is an Elisp screen value.
89end
a6ffc6a2
JB
90
91define xcons
92print (struct Lisp_Cons *) ($ & 0x00ffffff)
93print *$
ffd56f97 94print $$
a6ffc6a2 95end
e065a56e
JB
96document xcons
97Print the contents of $, assuming it is an Elisp cons.
98end
a6ffc6a2
JB
99
100define xcar
101print ((($ >> 24) & 0x7f) == Lisp_Cons ? ((struct Lisp_Cons *) ($ & 0x00ffffff))->car : 0)
102end
e065a56e
JB
103document xcar
104Print the car of $, assuming it is an Elisp pair.
105end
a6ffc6a2
JB
106
107define xcdr
108print ((($ >> 24) & 0x7f) == Lisp_Cons ? ((struct Lisp_Cons *) ($ & 0x00ffffff))->cdr : 0)
109end
e065a56e
JB
110document xcdr
111Print the cdr of $, assuming it is an Elisp pair.
112end
a6ffc6a2 113
e065a56e 114set print pretty on
a6ffc6a2
JB
115
116# Don't let abort actually run, as it will make
117# stdio stop working and therefore the `pr' command below as well.
118break abort
119
120# If we are running in synchronous mode, we want a chance to look around
121# before Emacs exits. Perhaps we should put the break somewhere else
122# instead...
123break _XPrintDefaultError
124
e065a56e
JB
125unset environment TERMCAP
126unset environment TERM
127set environment DISPLAY :0.0
128show environment DISPLAY
a6ffc6a2 129set args -q