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