Initial revision
[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
7 document pr
8 Print the emacs s-expression which is $.
9 Works only when an inferior emacs is executing.
10 end
11
12 define xtype
13 print (enum Lisp_Type) (($ >> 24) & 0x7f)
14 p $$
15 end
16
17 define xint
18 print (($ & 0x00ffffff) << 8) >> 8
19 end
20
21 define xptr
22 print (void *) ($ & 0x00ffffff)
23 end
24
25 define xwindow
26 print (struct window *) ($ & 0x00ffffff)
27 end
28
29 define xmarker
30 print (struct Lisp_Marker *) ($ & 0x00ffffff)
31 end
32
33 define xbuffer
34 print (struct buffer *) ($ & 0x00ffffff)
35 end
36
37 define xsymbol
38 print (struct Lisp_Symbol *) ($ & 0x00ffffff)
39 print &$->name->data
40 print $$
41 end
42
43 define xstring
44 print (struct Lisp_String *) ($ & 0x00ffffff)
45 print ($->data[0])@($->size)
46 print $$
47 end
48
49 document xstring
50 Assume that $ is an Emacs Lisp string object, print the string's
51 contents, and set $ to a pointer to the string.
52 end
53
54 define xvector
55 set $temp = (struct Lisp_Vector *) ($ & 0x00ffffff)
56 print ($temp->contents[0])@($temp->size)
57 print $temp
58 end
59
60 document xvector
61 Assume that $ is an Emacs Lisp vector object, print the vector's
62 contents, and set $ to a pointer to the vector.
63 end
64
65 define xscreen
66 print (struct screen *) ($ & 0x00ffffff)
67 end
68
69 define xcons
70 print (struct Lisp_Cons *) ($ & 0x00ffffff)
71 print *$
72 end
73
74 define xcar
75 print ((($ >> 24) & 0x7f) == Lisp_Cons ? ((struct Lisp_Cons *) ($ & 0x00ffffff))->car : 0)
76 end
77
78 define xcdr
79 print ((($ >> 24) & 0x7f) == Lisp_Cons ? ((struct Lisp_Cons *) ($ & 0x00ffffff))->cdr : 0)
80 end
81
82 set prettyprint on
83
84 # Don't let abort actually run, as it will make
85 # stdio stop working and therefore the `pr' command below as well.
86 break abort
87
88 # If we are running in synchronous mode, we want a chance to look around
89 # before Emacs exits. Perhaps we should put the break somewhere else
90 # instead...
91 break _XPrintDefaultError
92
93 unset env TERMCAP
94 unset env TERM
95 set env DISPLAY :0.0
96 info env DISPLAY
97 set args -q