comparison etc/gdbinit.in @ 4643:e9ccbc62f7e7

Don't rely on GDB understanding the Lisp_Type_{Record,Char} enums, gdbinit.in 2009-06-14 Aidan Kehoe <kehoea@parhasard.net> * gdbinit.in: Supply variables for the Lisp_Type_Record, Lisp_Type_Char type information, for the sake of various versions of GDB that can't take them from the enum vals in the executable. Use those variables instead of the enums.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 14 Jun 2009 16:08:22 +0100
parents 8453b9b6286f
children 7ef913bf3c9a
comparison
equal deleted inserted replaced
4642:48b45a606961 4643:e9ccbc62f7e7
69 #ifdef VDB_POSIX 69 #ifdef VDB_POSIX
70 handle SIGSEGV SIGBUS nostop noprint 70 handle SIGSEGV SIGBUS nostop noprint
71 #endif 71 #endif
72 72
73 set $Lisp_Type_Int = -2 73 set $Lisp_Type_Int = -2
74 set $Lisp_Type_Record = 0
75 set $Lisp_Type_Char = 2
74 76
75 define decode_object 77 define decode_object
76 set $obj = (unsigned long) $arg0 78 set $obj = (unsigned long) $arg0
77 if $obj & 1 79 if $obj & 1
78 ## It's an int 80 ## It's an int
79 set $val = $obj >> 1 81 set $val = $obj >> 1
80 set $type = $Lisp_Type_Int 82 set $type = $Lisp_Type_Int
81 else 83 else
82 set $type = $obj & dbg_typemask 84 set $type = $obj & dbg_typemask
83 if $type == Lisp_Type_Char 85 if $type == $Lisp_Type_Char
84 set $val = ($obj & dbg_valmask) >> dbg_gctypebits 86 set $val = ($obj & dbg_valmask) >> dbg_gctypebits
85 else 87 else
86 ## It's a record pointer 88 ## It's a record pointer
87 set $val = $obj 89 set $val = $obj
88 end 90 end
89 end 91 end
90 92
91 if $type == Lisp_Type_Record 93 if $type == $Lisp_Type_Record
92 set $lheader = ((struct lrecord_header *) $val) 94 set $lheader = ((struct lrecord_header *) $val)
93 set $lrecord_type = ($lheader->type) 95 set $lrecord_type = ($lheader->type)
94 set $imp = ((struct lrecord_implementation *) lrecord_implementations_table[(int) $lrecord_type]) 96 set $imp = ((struct lrecord_implementation *) lrecord_implementations_table[(int) $lrecord_type])
95 else 97 else
96 set $lrecord_type = -1 98 set $lrecord_type = -1
113 define xtype 115 define xtype
114 decode_object $arg0 116 decode_object $arg0
115 if $type == $Lisp_Type_Int 117 if $type == $Lisp_Type_Int
116 echo int\n 118 echo int\n
117 else 119 else
118 if $type == Lisp_Type_Char 120 if $type == $Lisp_Type_Char
119 echo char\n 121 echo char\n
120 else 122 else
121 printf "record type: %s\n", $imp->name 123 printf "record type: %s\n", $imp->name
122 end 124 end
123 end 125 end
262 define pobj 264 define pobj
263 decode_object $arg0 265 decode_object $arg0
264 if $type == $Lisp_Type_Int 266 if $type == $Lisp_Type_Int
265 printf "Integer: %d\n", $val 267 printf "Integer: %d\n", $val
266 else 268 else
267 if $type == Lisp_Type_Char 269 if $type == $Lisp_Type_Char
268 if $val > 32 && $val < 128 270 if $val > 32 && $val < 128
269 printf "Char: %c\n", $val 271 printf "Char: %c\n", $val
270 else 272 else
271 printf "Char: %d\n", $val 273 printf "Char: %d\n", $val
272 end 274 end