comparison src/gdbinit @ 371:cc15677e0335 r21-2b1

Import from CVS: tag r21-2b1
author cvs
date Mon, 13 Aug 2007 11:03:08 +0200
parents 30d2cfa1092a
children 8626e4521993
comparison
equal deleted inserted replaced
370:bd866891f083 371:cc15677e0335
51 set $obj = (unsigned long) $arg0 51 set $obj = (unsigned long) $arg0
52 if dbg_USE_MINIMAL_TAGBITS 52 if dbg_USE_MINIMAL_TAGBITS
53 if $obj & 1 53 if $obj & 1
54 # It's an int 54 # It's an int
55 set $val = $obj >> 1 55 set $val = $obj >> 1
56 set $type = Lisp_Type_Int 56 set $type = dbg_Lisp_Type_Int
57 else 57 else
58 set $type = $obj & dbg_typemask 58 set $type = $obj & dbg_typemask
59 if $type == Lisp_Type_Char 59 if $type == dbg_Lisp_Type_Char
60 set $val = ($obj & dbg_valmask) >> dbg_gctypebits 60 set $val = ($obj & dbg_valmask) >> dbg_gctypebits
61 else 61 else
62 # It's a record pointer 62 # It's a record pointer
63 set $val = $obj 63 set $val = $obj
64 end 64 end
67 # not dbg_USE_MINIMAL_TAGBITS 67 # not dbg_USE_MINIMAL_TAGBITS
68 set $val = $obj & dbg_valmask 68 set $val = $obj & dbg_valmask
69 set $type = ($obj & dbg_typemask) >> (dbg_valbits + 1) 69 set $type = ($obj & dbg_typemask) >> (dbg_valbits + 1)
70 end 70 end
71 71
72 if $type == Lisp_Type_Record 72 if $type == dbg_Lisp_Type_Record
73 set $lheader = (struct lrecord_header *) $val 73 set $lheader = (struct lrecord_header *) $val
74 if dbg_USE_INDEXED_LRECORD_IMPLEMENTATION 74 if dbg_USE_INDEXED_LRECORD_IMPLEMENTATION
75 set $imp = lrecord_implementations_table[$lheader->type] 75 set $imp = lrecord_implementations_table[$lheader->type]
76 else 76 else
77 set $imp = $lheader->implementation 77 set $imp = $lheader->implementation
78 if $imp->finalizer == this_marks_a_marked_record
79 set $imp = $imp -1
80 printf "marked lrecord:\n"
81 end
82 end 78 end
83 else 79 else
84 set $imp = -1 80 set $imp = -1
85 end 81 end
86 end 82 end
96 print ((long) $val) 92 print ((long) $val)
97 end 93 end
98 94
99 define xtype 95 define xtype
100 decode_object $arg0 96 decode_object $arg0
101 if $type == Lisp_Type_Int 97 if $type == dbg_Lisp_Type_Int
102 echo int\n 98 echo int\n
103 else 99 else
104 if $type == Lisp_Type_Char 100 if $type == dbg_Lisp_Type_Char
105 echo char\n 101 echo char\n
106 else 102 else
107 if $type == Lisp_Type_Symbol 103 if $type == dbg_Lisp_Type_Symbol
108 echo symbol\n 104 echo symbol\n
109 else 105 else
110 if $type == Lisp_Type_String 106 if $type == dbg_Lisp_Type_String
111 echo string\n 107 echo string\n
112 else 108 else
113 if $type == Lisp_Type_Vector 109 if $type == dbg_Lisp_Type_Vector
114 echo vector\n 110 echo vector\n
115 else 111 else
116 if $type == Lisp_Type_Cons 112 if $type == dbg_Lisp_Type_Cons
117 echo cons\n 113 echo cons\n
118 else 114 else
119 printf "record type: %s\n", $imp->name 115 printf "record type: %s\n", $imp->name
120 # barf 116 # barf
121 end 117 end
124 end 120 end
125 end 121 end
126 end 122 end
127 end 123 end
128 124
129 define lisp-shadows 125 define run-temacs
130 run -batch -vanilla -f list-load-path-shadows
131 end
132
133 document lisp-shadows
134 Usage: lisp-shadows
135 Run xemacs to check for lisp shadows
136 end
137
138 define environment-to-run-temacs
139 unset env EMACSLOADPATH 126 unset env EMACSLOADPATH
140 set env EMACSBOOTSTRAPLOADPATH=../lisp/:.. 127 set env EMACSBOOTSTRAPLOADPATH ../lisp/:..
141 set env EMACSBOOTSTRAPMODULEPATH=../modules/:..
142 end
143
144 define run-temacs
145 environment-to-run-temacs
146 run -batch -l ../lisp/loadup.el run-temacs -q 128 run -batch -l ../lisp/loadup.el run-temacs -q
147 end 129 end
148 130
149 document run-temacs 131 document run-temacs
150 Usage: run-temacs 132 Usage: run-temacs
152 Use this with debugging tools (like purify) that cannot deal with dumping, 134 Use this with debugging tools (like purify) that cannot deal with dumping,
153 or when temacs builds successfully, but xemacs does not. 135 or when temacs builds successfully, but xemacs does not.
154 end 136 end
155 137
156 define update-elc 138 define update-elc
157 environment-to-run-temacs 139 unset env EMACSLOADPATH
140 set env EMACSBOOTSTRAPLOADPATH ../lisp/:..
158 run -batch -l ../lisp/update-elc.el 141 run -batch -l ../lisp/update-elc.el
159 end 142 end
160 143
161 document update-elc 144 document update-elc
162 Usage: update-elc 145 Usage: update-elc
164 Use when debugging temacs, not xemacs! 147 Use when debugging temacs, not xemacs!
165 Use this when temacs builds successfully, but xemacs does not. 148 Use this when temacs builds successfully, but xemacs does not.
166 end 149 end
167 150
168 define dump-temacs 151 define dump-temacs
169 environment-to-run-temacs 152 unset env EMACSLOADPATH
153 set env EMACSBOOTSTRAPLOADPATH ../lisp/:..
170 run -batch -l ../lisp/loadup.el dump 154 run -batch -l ../lisp/loadup.el dump
171 end 155 end
172 156
173 document dump-temacs 157 document dump-temacs
174 Usage: dump-temacs 158 Usage: dump-temacs
199 Usage: lbt 183 Usage: lbt
200 Print the current Lisp stack trace. 184 Print the current Lisp stack trace.
201 Requires a running xemacs process. 185 Requires a running xemacs process.
202 end 186 end
203 187
204
205 define leval
206 ldp Feval(Fcar(Fread_from_string(build_string($arg0),Qnil,Qnil)))
207 end
208
209 document leval
210 Usage: leval "SEXP"
211 Eval a lisp expression.
212 Requires a running xemacs process.
213
214 Example:
215 (gdb) leval "(+ 1 2)"
216 Lisp ==> 3
217 end
218
219
220 define wtype 188 define wtype
221 print $arg0->core.widget_class->core_class.class_name 189 print $arg0->core.widget_class->core_class.class_name
222 end 190 end
223 191
224 define xtname 192 define xtname
233 print *$xstruct 201 print *$xstruct
234 end 202 end
235 203
236 define pobj 204 define pobj
237 decode_object $arg0 205 decode_object $arg0
238 if $type == Lisp_Type_Int 206 if $type == dbg_Lisp_Type_Int
239 printf "Integer: %d\n", $val 207 printf "Integer: %d\n", $val
240 else 208 else
241 if $type == Lisp_Type_Char 209 if $type == dbg_Lisp_Type_Char
242 if $val > 32 && $val < 128 210 if $val < 128
243 printf "Char: %c\n", $val 211 printf "Char: %c\n", $val
244 else 212 else
245 printf "Char: %d\n", $val 213 printf "Char: %d\n", $val
246 end 214 end
247 else 215 else
248 if $type == Lisp_Type_String || $imp == lrecord_string 216 if $type == dbg_Lisp_Type_String || $imp == lrecord_string
249 pstruct Lisp_String 217 pstruct Lisp_String
250 else 218 else
251 if $type == Lisp_Type_Cons || $imp == lrecord_cons 219 if $type == dbg_Lisp_Type_Cons || $imp == lrecord_cons
252 pstruct Lisp_Cons 220 pstruct Lisp_Cons
253 else 221 else
254 if $type == Lisp_Type_Symbol || $imp == lrecord_symbol 222 if $type == dbg_Lisp_Type_Symbol || $imp == lrecord_symbol
255 pstruct Lisp_Symbol 223 pstruct Lisp_Symbol
256 printf "Symbol name: %s\n", $xstruct->name->_data 224 printf "Symbol name: %s\n", $xstruct->name->_data
257 else 225 else
258 if $type == Lisp_Type_Vector || $imp == lrecord_vector 226 if $type == dbg_Lisp_Type_Vector || $imp == lrecord_vector
259 pstruct Lisp_Vector 227 pstruct Lisp_Vector
260 printf "Vector of length %d\n", $xstruct->size 228 printf "Vector of length %d\n", $xstruct->size
261 #print *($xstruct->_data) @ $xstruct->size 229 #print *($xstruct->_data) @ $xstruct->size
262 else 230 else
263 if $imp == lrecord_bit_vector 231 if $imp == lrecord_bit_vector
289 else 257 else
290 if $imp == lrecord_console 258 if $imp == lrecord_console
291 pstruct console 259 pstruct console
292 else 260 else
293 if $imp == lrecord_database 261 if $imp == lrecord_database
294 pstruct Lisp_Database 262 pstruct database
295 else 263 else
296 if $imp == lrecord_device 264 if $imp == lrecord_device
297 pstruct device 265 pstruct device
298 else 266 else
299 if $imp == lrecord_event 267 if $imp == lrecord_event
328 else 296 else
329 if $imp == lrecord_image_instance 297 if $imp == lrecord_image_instance
330 pstruct Lisp_Image_Instance 298 pstruct Lisp_Image_Instance
331 else 299 else
332 if $imp == lrecord_keymap 300 if $imp == lrecord_keymap
333 pstruct Lisp_Keymap 301 pstruct keymap
334 else 302 else
335 if $imp == lrecord_lcrecord_list 303 if $imp == lrecord_lcrecord_list
336 pstruct lcrecord_list 304 pstruct lcrecord_list
337 else 305 else
338 if $imp == lrecord_lstream 306 if $imp == lrecord_lstream
408 end 376 end
409 end 377 end
410 end 378 end
411 end 379 end
412 end 380 end
413 # Repeat after me... gdb sux, gdb sux, gdb sux... 381 end
414 end 382 end
415 end 383 end
416 end 384 end
417 end 385 end
418 end 386 end
419 end 387 end
420 end 388 end
421 end 389 end
422 end 390 end
423 end 391 end
424 end 392 end
425 end 393 end
426 end 394 end
427 end 395 end
428 end 396 end
429 end 397 end
430 end 398 end
431 end
432 # Are we having fun yet??
433 end 399 end
434 end 400 end
435 end 401 end
436 end 402 end
437 end 403 end
451 417
452 document pobj 418 document pobj
453 Usage: pobj lisp_object 419 Usage: pobj lisp_object
454 Print the internal C structure of a underlying Lisp Object. 420 Print the internal C structure of a underlying Lisp Object.
455 end 421 end
456
457 # -------------------------------------------------------------
458 # functions to test the debugging support itself.
459 # If you change this file, make sure the following still work...
460 # -------------------------------------------------------------
461 define test_xtype
462 printf "Vemacs_major_version: "
463 xtype Vemacs_major_version
464 printf "Vhelp_char: "
465 xtype Vhelp_char
466 printf "Qnil: "
467 xtype Qnil
468 printf "Qunbound: "
469 xtype Qunbound
470 printf "Vobarray: "
471 xtype Vobarray
472 printf "Vall_weak_lists: "
473 xtype Vall_weak_lists
474 printf "Vxemacs_codename: "
475 xtype Vxemacs_codename
476 end
477
478 define test_pobj
479 printf "Vemacs_major_version: "
480 pobj Vemacs_major_version
481 printf "Vhelp_char: "
482 pobj Vhelp_char
483 printf "Qnil: "
484 pobj Qnil
485 printf "Qunbound: "
486 pobj Qunbound
487 printf "Vobarray: "
488 pobj Vobarray
489 printf "Vall_weak_lists: "
490 pobj Vall_weak_lists
491 printf "Vall_weak_hashtables: "
492 pobj Vall_weak_hashtables
493 printf "Vxemacs_codename: "
494 pobj Vxemacs_codename
495 end
496