Formatting change
[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
ef15f270
JB
12output (enum Lisp_Type) (($ >> 24) & 0x7f)
13echo \n
a6ffc6a2 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)
ef15f270 35printf "%dx%d+%d+%d\n", $->width, $->height, $->left, $->top
a6ffc6a2 36end
e065a56e
JB
37document xwindow
38Print $ as a window pointer, assuming it is an Elisp window value.
ef15f270 39Print the window's position as "WIDTHxHEIGHT+LEFT+TOP".
e065a56e 40end
a6ffc6a2
JB
41
42define xmarker
43print (struct Lisp_Marker *) ($ & 0x00ffffff)
44end
e065a56e
JB
45document xmarker
46Print $ as a marker pointer, assuming it is an Elisp marker value.
47end
a6ffc6a2
JB
48
49define xbuffer
50print (struct buffer *) ($ & 0x00ffffff)
ef15f270
JB
51output &((struct Lisp_String *) (($->name) & 0x00ffffff))->data
52echo \n
a6ffc6a2 53end
e065a56e 54document xbuffer
daa37602
JB
55Set $ as a buffer pointer, assuming it is an Elisp buffer value.
56Print the name of the buffer.
e065a56e 57end
a6ffc6a2
JB
58
59define xsymbol
60print (struct Lisp_Symbol *) ($ & 0x00ffffff)
ef15f270
JB
61output &$->name->data
62echo \n
a6ffc6a2 63end
e065a56e
JB
64document xsymbol
65Print the name and address of the symbol $.
66This command assumes that $ is an Elisp symbol value.
67end
a6ffc6a2
JB
68
69define xstring
70print (struct Lisp_String *) ($ & 0x00ffffff)
ef15f270
JB
71output ($->size > 10000) ? "big string" : ($->data[0])@($->size)
72echo \n
a6ffc6a2 73end
a6ffc6a2 74document xstring
e065a56e
JB
75Print the contents and address of the string $.
76This command assumes that $ is an Elisp string value.
a6ffc6a2
JB
77end
78
79define xvector
ef15f270
JB
80print (struct Lisp_Vector *) ($ & 0x00ffffff)
81output ($->size > 1000) ? "big vector" : ($->contents[0])@($->size)
82echo \n
a6ffc6a2 83end
a6ffc6a2 84document xvector
e065a56e
JB
85Print the contents and address of the vector $.
86This command assumes that $ is an Elisp vector value.
a6ffc6a2
JB
87end
88
89define xscreen
90print (struct screen *) ($ & 0x00ffffff)
91end
e065a56e
JB
92document xwindow
93Print $ as a screen pointer, assuming it is an Elisp screen value.
94end
a6ffc6a2
JB
95
96define xcons
97print (struct Lisp_Cons *) ($ & 0x00ffffff)
bd307392 98output *(struct Lisp_Cons *) ($ & 0x00ffffff)
ef15f270 99echo \n
a6ffc6a2 100end
e065a56e
JB
101document xcons
102Print the contents of $, assuming it is an Elisp cons.
103end
a6ffc6a2
JB
104
105define xcar
106print ((($ >> 24) & 0x7f) == Lisp_Cons ? ((struct Lisp_Cons *) ($ & 0x00ffffff))->car : 0)
107end
e065a56e
JB
108document xcar
109Print the car of $, assuming it is an Elisp pair.
110end
a6ffc6a2
JB
111
112define xcdr
113print ((($ >> 24) & 0x7f) == Lisp_Cons ? ((struct Lisp_Cons *) ($ & 0x00ffffff))->cdr : 0)
114end
e065a56e
JB
115document xcdr
116Print the cdr of $, assuming it is an Elisp pair.
117end
a6ffc6a2 118
e065a56e 119set print pretty on
a6ffc6a2 120
e5d77022
JB
121unset environment TERMCAP
122unset environment TERM
ef15f270 123echo TERMCAP and TERM environment variables unset.\n
e5d77022
JB
124show environment DISPLAY
125set args -q
126
a6ffc6a2
JB
127# Don't let abort actually run, as it will make
128# stdio stop working and therefore the `pr' command below as well.
129break abort
130
131# If we are running in synchronous mode, we want a chance to look around
132# before Emacs exits. Perhaps we should put the break somewhere else
133# instead...
134break _XPrintDefaultError
135