annotate src/dbxrc @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents
children 3a7e78e1142d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
1 # -*- ksh -*-
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
2 # Copyright (C) 1998 Free Software Foundation, Inc.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
3
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
4 # This file is part of XEmacs.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
5
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
6 # XEmacs is free software; you can redistribute it and/or modify it
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
7 # under the terms of the GNU General Public License as published by the
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
8 # Free Software Foundation; either version 2, or (at your option) any
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
9 # later version.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
10
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
11 # XEmacs is distributed in the hope that it will be useful, but WITHOUT
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
14 # for more details.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
15
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
16 # You should have received a copy of the GNU General Public License
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
17 # along with XEmacs; see the file COPYING. If not, write to
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
18 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
19 # Boston, MA 02111-1307, USA.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
20
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
21 # Author: Martin Buchholz
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
22
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
23 # You can use this file to debug XEmacs using Sun WorkShop's dbx.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
24 # Add the contents of this file to $HOME/.dbxrc or
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
25 # Source the contents of this file with something like:
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
26 # if test -r ./dbxrc; then . ./dbxrc; fi
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
27
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
28 # Some functions defined here require a running process, but most
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
29 # don't. Considerable effort has been expended to this end.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
30
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
31 # See also the comments in gdbinit.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
32
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
33 # See also the question of the XEmacs FAQ, titled
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
34 # "How to Debug an XEmacs problem with a debugger".
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
35
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
36 ignore POLL
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
37 ignore IO
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
38
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
39 document lbt << 'end'
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
40 Usage: lbt
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
41 Print the current Lisp stack trace.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
42 Requires a running xemacs process.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
43 end
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
44
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
45 function lbt {
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
46 call debug_backtrace()
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
47 }
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
48
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
49 document ldp << 'end'
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
50 Usage: ldp lisp_object
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
51 Print a Lisp Object value using the Lisp printer.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
52 Requires a running xemacs process.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
53 end
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
54
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
55 function ldp {
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
56 call debug_print ($1);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
57 }
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
58
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
59 # A bug in dbx prevents string variables from having values beginning with `-'!!
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
60 function XEmacsInit {
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
61 function ToInt { eval "$1=\$[(int) $1]"; }
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
62 ToInt dbg_USE_UNION_TYPE
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
63 ToInt Lisp_Type_Int
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
64 ToInt Lisp_Type_Char
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
65 ToInt Lisp_Type_Cons
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
66 ToInt Lisp_Type_String
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
67 ToInt Lisp_Type_Vector
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
68 ToInt Lisp_Type_Symbol
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
69 ToInt Lisp_Type_Record
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
70 ToInt dbg_valbits
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
71 ToInt dbg_gctypebits
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
72 function ToLong { eval "$1=\$[(unsigned long) $1]"; }
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
73 ToLong dbg_valmask
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
74 ToLong dbg_typemask
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
75 xemacs_initted=yes
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
76 }
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
77
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
78 function printvar {
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
79 for i in $*; do eval "echo $i=\$$i"; done
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
80 }
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
81
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
82 document decode_object << 'end'
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
83 Usage: decode_object lisp_object
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
84 Extract implementation information from a Lisp Object.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
85 Defines variables $val, $type and $imp.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
86 end
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
87
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
88 # Various dbx bugs cause ugliness in following code
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
89 function decode_object {
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
90 if test -z "$xemacs_initted"; then XEmacsInit; fi;
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
91 if test $dbg_USE_UNION_TYPE = 1; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
92 # Repeat after me... dbx sux, dbx sux, dbx sux...
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
93 # Allow both `pobj Qnil' and `pobj 0x82746834' to work
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
94 case $(whatis $1) in
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
95 *Lisp_Object*) obj="$[(unsigned long)(($1).i)]";;
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
96 *) obj="$[(unsigned long)($1)]";;
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
97 esac
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
98 else
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
99 obj="$[(unsigned long)($1)]";
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
100 fi
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
101 if test $[(int)($obj & 1)] = 1; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
102 # It's an int
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
103 val=$[(long)(((unsigned long long)$obj) >> 1)]
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
104 type=$Lisp_Type_Int
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
105 else
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
106 type=$[(int)(((void*)$obj) & $dbg_typemask)]
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
107 if test $type = $Lisp_Type_Char; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
108 val=$[(void*)(long)(((unsigned long long)($obj & $dbg_valmask)) >> $dbg_gctypebits)]
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
109 else
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
110 # It's a record pointer
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
111 val=$[(void*)$obj]
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
112 if test "$val" = "(nil)"; then type=null_pointer; fi
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
113 fi
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
114 fi
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
115
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
116 if test $type = $Lisp_Type_Record; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
117 typeset lheader="((struct lrecord_header *) $val)"
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
118 imp=$[(void*)(lrecord_implementations_table[$lheader->type])]
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
119 else
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
120 imp="0xdeadbeef"
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
121 fi
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
122 # printvar obj val type imp
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
123 }
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
124
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
125 function xint {
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
126 decode_object "$*"
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
127 print (long) ($val)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
128 }
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
129
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
130 function xtype {
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
131 decode_object "$*"
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
132 if test $type = $Lisp_Type_Int; then echo "int"
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
133 elif test $type = $Lisp_Type_Char; then echo "char"
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
134 elif test $type = $Lisp_Type_Symbol; then echo "symbol"
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
135 elif test $type = $Lisp_Type_String; then echo "string"
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
136 elif test $type = $Lisp_Type_Vector; then echo "vector"
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
137 elif test $type = $Lisp_Type_Cons; then echo "cons"
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
138 elif test $type = null_pointer; then echo "null_pointer"
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
139 else
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
140 echo "record type with name: $[((struct lrecord_implementation *)$imp)->name]"
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
141 fi
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
142 }
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
143
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
144 function lisp-shadows {
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
145 run -batch -vanilla -f list-load-path-shadows
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
146 }
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
147
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
148 function environment-to-run-temacs {
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
149 unset EMACSLOADPATH
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
150 export EMACSBOOTSTRAPLOADPATH=../lisp/:..
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
151 export EMACSBOOTSTRAPMODULEPATH=../modules/:..
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
152 }
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
153
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
154 document run-temacs << 'end'
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
155 Usage: run-temacs
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
156 Run temacs interactively, like xemacs.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
157 Use this with debugging tools (like purify) that cannot deal with dumping,
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
158 or when temacs builds successfully, but xemacs does not.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
159 end
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
160
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
161 function run-temacs {
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
162 environment-to-run-temacs
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
163 run -batch -l ../lisp/loadup.el run-temacs -q
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
164 }
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
165
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
166 document update-elc << 'end'
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
167 Usage: update-elc
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
168 Run the core lisp byte compilation part of the build procedure.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
169 Use when debugging temacs, not xemacs!
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
170 Use this when temacs builds successfully, but xemacs does not.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
171 end
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
172
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
173 function update-elc {
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
174 environment-to-run-temacs
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
175 run -batch -l ../lisp/update-elc.el
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
176 }
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
177
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
178
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
179 function dump-temacs {
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
180 environment-to-run-temacs
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
181 run -batch -l ../lisp/loadup.el dump
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
182 }
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
183
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
184 document dump-temacs << 'end'
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
185 Usage: dump-temacs
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
186 Run the dumping part of the build procedure.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
187 Use when debugging temacs, not xemacs!
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
188 Use this when temacs builds successfully, but xemacs does not.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
189 end
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
190
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
191 function pstruct {
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
192 xstruct="((struct $1 *) $val)"
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
193 print $xstruct
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
194 print *$xstruct
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
195 }
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
196
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
197 function lrecord_type_p {
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
198 if eval test -z \"\$lrecord_$1\" && test $imp = $[(void*)(&lrecord_$1)]; then return 0; else return 1; fi
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
199 }
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
200
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
201 document pobj << 'end'
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
202 Usage: pobj lisp_object
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
203 Print the internal C structure of a underlying Lisp Object.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
204 end
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
205
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
206 function pobj {
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
207 decode_object $1
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
208 if test $type = $Lisp_Type_Int; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
209 print -f"Integer: %d" $val
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
210 elif test $type = $Lisp_Type_Char; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
211 if test $[$val > 32 && $val < 128] = 1; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
212 print -f"Char: %c" $val
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
213 else
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
214 print -f"Char: %d" $val
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
215 fi
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
216 elif test $type = $Lisp_Type_String || lrecord_type_p string; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
217 pstruct Lisp_String
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
218 elif test $type = $Lisp_Type_Cons || lrecord_type_p cons; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
219 pstruct Lisp_Cons
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
220 elif test $type = $Lisp_Type_Symbol || lrecord_type_p symbol; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
221 pstruct Lisp_Symbol
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
222 echo "Symbol name: $[(char *)($xstruct->name->data)]"
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
223 elif test $type = $Lisp_Type_Vector || lrecord_type_p vector; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
224 pstruct Lisp_Vector
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
225 echo "Vector of length $[$xstruct->size]"
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
226 elif lrecord_type_p bit_vector; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
227 pstruct Lisp_Bit_Vector
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
228 elif lrecord_type_p buffer; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
229 pstruct buffer
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
230 elif lrecord_type_p char_table; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
231 pstruct Lisp_Char_Table
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
232 elif lrecord_type_p char_table_entry; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
233 pstruct Lisp_Char_Table_Entry
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
234 elif lrecord_type_p charset; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
235 pstruct Lisp_Charset
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
236 elif lrecord_type_p coding_system; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
237 pstruct Lisp_Coding_System
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
238 elif lrecord_type_p color_instance; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
239 pstruct Lisp_Color_Instance
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
240 elif lrecord_type_p command_builder; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
241 pstruct command_builder
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
242 elif lrecord_type_p compiled_function; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
243 pstruct Lisp_Compiled_Function
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
244 elif lrecord_type_p console; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
245 pstruct console
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
246 elif lrecord_type_p database; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
247 pstruct Lisp_Database
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
248 elif lrecord_type_p device; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
249 pstruct device
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
250 elif lrecord_type_p event; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
251 pstruct Lisp_Event
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
252 elif lrecord_type_p extent; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
253 pstruct extent
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
254 elif lrecord_type_p extent_auxiliary; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
255 pstruct extent_auxiliary
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
256 elif lrecord_type_p extent_info; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
257 pstruct extent_info
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
258 elif lrecord_type_p face; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
259 pstruct Lisp_Face
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
260 elif lrecord_type_p float; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
261 pstruct Lisp_Float
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
262 elif lrecord_type_p font_instance; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
263 pstruct Lisp_Font_Instance
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
264 elif lrecord_type_p frame; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
265 pstruct frame
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
266 elif lrecord_type_p glyph; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
267 pstruct Lisp_Glyph
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
268 elif lrecord_type_p hash_table; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
269 pstruct Lisp_Hash_Table
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
270 elif lrecord_type_p image_instance; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
271 pstruct Lisp_Image_Instance
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
272 elif lrecord_type_p keymap; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
273 pstruct Lisp_Keymap
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
274 elif lrecord_type_p lcrecord_list; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
275 pstruct lcrecord_list
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
276 elif lrecord_type_p lstream; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
277 pstruct lstream
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
278 elif lrecord_type_p marker; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
279 pstruct Lisp_Marker
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
280 elif lrecord_type_p opaque; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
281 pstruct Lisp_Opaque
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
282 elif lrecord_type_p opaque_list; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
283 pstruct Lisp_Opaque_List
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
284 elif lrecord_type_p popup_data; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
285 pstruct popup_data
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
286 elif lrecord_type_p process; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
287 pstruct Lisp_Process
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
288 elif lrecord_type_p range_table; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
289 pstruct Lisp_Range_Table
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
290 elif lrecord_type_p specifier; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
291 pstruct Lisp_Specifier
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
292 elif lrecord_type_p subr; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
293 pstruct Lisp_Subr
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
294 elif lrecord_type_p symbol_value_buffer_local; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
295 pstruct symbol_value_buffer_local
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
296 elif lrecord_type_p symbol_value_forward; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
297 pstruct symbol_value_forward
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
298 elif lrecord_type_p symbol_value_lisp_magic; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
299 pstruct symbol_value_lisp_magic
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
300 elif lrecord_type_p symbol_value_varalias; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
301 pstruct symbol_value_varalias
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
302 elif lrecord_type_p toolbar_button; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
303 pstruct toolbar_button
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
304 elif lrecord_type_p tooltalk_message; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
305 pstruct Lisp_Tooltalk_Message
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
306 elif lrecord_type_p tooltalk_pattern; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
307 pstruct Lisp_Tooltalk_Pattern
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
308 elif lrecord_type_p weak_list; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
309 pstruct weak_list
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
310 elif lrecord_type_p window; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
311 pstruct window
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
312 elif lrecord_type_p window_configuration; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
313 pstruct window_config
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
314 elif test "$type" = "null_pointer"; then
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
315 echo "Lisp Object is a null pointer!!"
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
316 else
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
317 echo "Unknown Lisp Object type"
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
318 print $1
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
319 fi
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
320 }
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
321
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
322 function pproc {
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
323 print *(`process.c`struct Lisp_Process*)$1 ;
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
324 ldp "(`process.c`struct Lisp_Process*)$1->name" ;
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
325 ldp "(`process.c`struct Lisp_Process*)$1->command" ;
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
326 }
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
327
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
328 dbxenv suppress_startup_message 4.0
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
329 dbxenv mt_watchpoints on
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
330
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
331 function dp_core {
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
332 print ((struct x_frame *)(((struct frame*)(Fselected_frame(Qnil)&0x00FFFFFF))->frame_data))->widget->core
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
333 }
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
334
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
335 # Barf!
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
336 function print_shell {
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
337 print *(`frame-x.c`TopLevelShellRec*) (((struct `frame-x.c`x_frame*) (((struct `frame-x.c`frame*) (Fselected_frame(Qnil)&0x00FFFFFF))->frame_data))->widget)
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
338 }
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
339
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
340 # -------------------------------------------------------------
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
341 # functions to test the debugging support itself.
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
342 # If you change this file, make sure the following still work...
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
343 # -------------------------------------------------------------
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
344 function test_xtype {
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
345 function doit { echo -n "$1: "; xtype "$1"; }
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
346 test_various_objects
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
347 }
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
348
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
349 function test_pobj {
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
350 function doit { echo '==============================='; echo -n "$1: "; pobj "$1"; }
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
351 test_various_objects
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
352 }
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
353
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
354 function test_various_objects {
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
355 doit Vemacs_major_version
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
356 doit Vhelp_char
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
357 doit Qnil
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
358 doit Qunbound
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
359 doit Vobarray
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
360 doit Vall_weak_lists
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
361 doit Vxemacs_codename
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents:
diff changeset
362 }