comparison src/gdbinit @ 337:fbbf69b4e8a7 r21-0-66

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