diff options
| author | Stefan Monnier | 2004-04-03 05:34:11 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2004-04-03 05:34:11 +0000 |
| commit | 329aa18857a1567b11952bc33cedbedefe8448b4 (patch) | |
| tree | 97aebfd309d1c7e2c177b8f8acdfcc18bde7e416 /src | |
| parent | 0dda8fd8d5c9c0cbf020ecedc64356a3570bb599 (diff) | |
| download | emacs-329aa18857a1567b11952bc33cedbedefe8448b4.tar.gz emacs-329aa18857a1567b11952bc33cedbedefe8448b4.zip | |
Make it work for USE_LSB_TAG and !NO_LISP_UNION.
(xgetptr, xgetint, xgettype): New funs. Use them everywhere.
($nonvalbits): Remove.
($valmask): Set it by calling xreload to avoid redundancy.
Diffstat (limited to 'src')
| -rw-r--r-- | src/.gdbinit | 208 |
1 files changed, 131 insertions, 77 deletions
diff --git a/src/.gdbinit b/src/.gdbinit index ccc36694da8..80ad1e249ad 100644 --- a/src/.gdbinit +++ b/src/.gdbinit | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001 | 1 | # Copyright (C) 1992, 93, 94, 95, 96, 97, 1998, 2000, 01, 2004 |
| 2 | # Free Software Foundation, Inc. | 2 | # Free Software Foundation, Inc. |
| 3 | # | 3 | # |
| 4 | # This file is part of GNU Emacs. | 4 | # This file is part of GNU Emacs. |
| @@ -38,12 +38,22 @@ handle SIGALRM ignore | |||
| 38 | # Set up a mask to use. | 38 | # Set up a mask to use. |
| 39 | # This should be EMACS_INT, but in some cases that is a macro. | 39 | # This should be EMACS_INT, but in some cases that is a macro. |
| 40 | # long ought to work in all cases right now. | 40 | # long ought to work in all cases right now. |
| 41 | set $valmask = ((long)1 << gdb_valbits) - 1 | 41 | |
| 42 | set $nonvalbits = gdb_emacs_intbits - gdb_valbits | 42 | define xgetptr |
| 43 | set $ptr = (gdb_use_union ? $arg0.u.val : $arg0 & $valmask) | gdb_data_seg_bits | ||
| 44 | end | ||
| 45 | |||
| 46 | define xgetint | ||
| 47 | set $int = gdb_use_union ? $arg0.s.val : (gdb_use_lsb ? $arg0 : $arg0 << gdb_gctypebits) >> gdb_gctypebits | ||
| 48 | end | ||
| 49 | |||
| 50 | define xgettype | ||
| 51 | set $type = gdb_use_union ? $arg0.s.type : (enum Lisp_Type) (gdb_use_lsb ? $arg0 & $tagmask : $arg0 >> gdb_valbits) | ||
| 52 | end | ||
| 43 | 53 | ||
| 44 | # Set up something to print out s-expressions. | 54 | # Set up something to print out s-expressions. |
| 45 | define pr | 55 | define pr |
| 46 | set debug_print ($) | 56 | set debug_print ($) |
| 47 | end | 57 | end |
| 48 | document pr | 58 | document pr |
| 49 | Print the emacs s-expression which is $. | 59 | Print the emacs s-expression which is $. |
| @@ -51,115 +61,135 @@ Works only when an inferior emacs is executing. | |||
| 51 | end | 61 | end |
| 52 | 62 | ||
| 53 | define xtype | 63 | define xtype |
| 54 | output (enum Lisp_Type) (($ >> gdb_valbits) & 0x7) | 64 | xgettype $ |
| 55 | echo \n | 65 | output $type |
| 56 | output ((($ >> gdb_valbits) & 0x7) == Lisp_Misc ? (enum Lisp_Misc_Type) (((struct Lisp_Free *) (($ & $valmask) | gdb_data_seg_bits))->type) : (($ >> gdb_valbits) & 0x7) == Lisp_Vectorlike ? ($size = ((struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits))->size, (enum pvec_type) (($size & PVEC_FLAG) ? $size & PVEC_TYPE_MASK : 0)) : 0) | 66 | echo \n |
| 57 | echo \n | 67 | if $type == Lisp_Misc |
| 68 | xmisctype | ||
| 69 | else | ||
| 70 | if $type == Lisp_Vectorlike | ||
| 71 | xvectype | ||
| 72 | end | ||
| 73 | end | ||
| 58 | end | 74 | end |
| 59 | document xtype | 75 | document xtype |
| 60 | Print the type of $, assuming it is an Emacs Lisp value. | 76 | Print the type of $, assuming it is an Emacs Lisp value. |
| 61 | If the first type printed is Lisp_Vector or Lisp_Misc, | 77 | If the first type printed is Lisp_Vector or Lisp_Misc, |
| 62 | the second line gives the more precise type. | 78 | a second line gives the more precise type. |
| 63 | Otherwise the second line doesn't mean anything. | ||
| 64 | end | 79 | end |
| 65 | 80 | ||
| 66 | define xvectype | 81 | define xvectype |
| 67 | set $size = ((struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits))->size | 82 | xgetptr $ |
| 68 | output (enum pvec_type) (($size & PVEC_FLAG) ? $size & PVEC_TYPE_MASK : 0) | 83 | set $size = ((struct Lisp_Vector *) $ptr)->size |
| 69 | echo \n | 84 | output ($size & PVEC_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size |
| 85 | echo \n | ||
| 70 | end | 86 | end |
| 71 | document xvectype | 87 | document xvectype |
| 72 | Print the vector subtype of $, assuming it is a vector or pseudovector. | 88 | Print the size or vector subtype of $, assuming it is a vector or pseudovector. |
| 73 | end | 89 | end |
| 74 | 90 | ||
| 75 | define xmisctype | 91 | define xmisctype |
| 76 | output (enum Lisp_Misc_Type) (((struct Lisp_Free *) (($ & $valmask) | gdb_data_seg_bits))->type) | 92 | xgetptr $ |
| 77 | echo \n | 93 | output (enum Lisp_Misc_Type) (((struct Lisp_Free *) $ptr)->type) |
| 94 | echo \n | ||
| 78 | end | 95 | end |
| 79 | document xmisctype | 96 | document xmisctype |
| 80 | Print the specific type of $, assuming it is some misc type. | 97 | Print the specific type of $, assuming it is some misc type. |
| 81 | end | 98 | end |
| 82 | 99 | ||
| 83 | define xint | 100 | define xint |
| 84 | print (($ & $valmask) << $nonvalbits) >> $nonvalbits | 101 | xgetint $ |
| 102 | print $int | ||
| 85 | end | 103 | end |
| 86 | document xint | 104 | document xint |
| 87 | Print $, assuming it is an Emacs Lisp integer. This gets the sign right. | 105 | Print $, assuming it is an Emacs Lisp integer. This gets the sign right. |
| 88 | end | 106 | end |
| 89 | 107 | ||
| 90 | define xptr | 108 | define xptr |
| 91 | print (void *) (($ & $valmask) | gdb_data_seg_bits) | 109 | xgetptr $ |
| 110 | print (void *) $ptr | ||
| 92 | end | 111 | end |
| 93 | document xptr | 112 | document xptr |
| 94 | Print the pointer portion of $, assuming it is an Emacs Lisp value. | 113 | Print the pointer portion of $, assuming it is an Emacs Lisp value. |
| 95 | end | 114 | end |
| 96 | 115 | ||
| 97 | define xmarker | 116 | define xmarker |
| 98 | print (struct Lisp_Marker *) (($ & $valmask) | gdb_data_seg_bits) | 117 | xgetptr $ |
| 118 | print (struct Lisp_Marker *) $ptr | ||
| 99 | end | 119 | end |
| 100 | document xmarker | 120 | document xmarker |
| 101 | Print $ as a marker pointer, assuming it is an Emacs Lisp marker value. | 121 | Print $ as a marker pointer, assuming it is an Emacs Lisp marker value. |
| 102 | end | 122 | end |
| 103 | 123 | ||
| 104 | define xoverlay | 124 | define xoverlay |
| 105 | print (struct Lisp_Overlay *) (($ & $valmask) | gdb_data_seg_bits) | 125 | xgetptr $ |
| 126 | print (struct Lisp_Overlay *) $ptr | ||
| 106 | end | 127 | end |
| 107 | document xoverlay | 128 | document xoverlay |
| 108 | Print $ as a overlay pointer, assuming it is an Emacs Lisp overlay value. | 129 | Print $ as a overlay pointer, assuming it is an Emacs Lisp overlay value. |
| 109 | end | 130 | end |
| 110 | 131 | ||
| 111 | define xmiscfree | 132 | define xmiscfree |
| 112 | print (struct Lisp_Free *) (($ & $valmask) | gdb_data_seg_bits) | 133 | xgetptr $ |
| 134 | print (struct Lisp_Free *) $ptr | ||
| 113 | end | 135 | end |
| 114 | document xmiscfree | 136 | document xmiscfree |
| 115 | Print $ as a misc free-cell pointer, assuming it is an Emacs Lisp Misc value. | 137 | Print $ as a misc free-cell pointer, assuming it is an Emacs Lisp Misc value. |
| 116 | end | 138 | end |
| 117 | 139 | ||
| 118 | define xintfwd | 140 | define xintfwd |
| 119 | print (struct Lisp_Intfwd *) (($ & $valmask) | gdb_data_seg_bits) | 141 | xgetptr $ |
| 142 | print (struct Lisp_Intfwd *) $ptr | ||
| 120 | end | 143 | end |
| 121 | document xintfwd | 144 | document xintfwd |
| 122 | Print $ as an integer forwarding pointer, assuming it is an Emacs Lisp Misc value. | 145 | Print $ as an integer forwarding pointer, assuming it is an Emacs Lisp Misc value. |
| 123 | end | 146 | end |
| 124 | 147 | ||
| 125 | define xboolfwd | 148 | define xboolfwd |
| 126 | print (struct Lisp_Boolfwd *) (($ & $valmask) | gdb_data_seg_bits) | 149 | xgetptr $ |
| 150 | print (struct Lisp_Boolfwd *) $ptr | ||
| 127 | end | 151 | end |
| 128 | document xboolfwd | 152 | document xboolfwd |
| 129 | Print $ as a boolean forwarding pointer, assuming it is an Emacs Lisp Misc value. | 153 | Print $ as a boolean forwarding pointer, assuming it is an Emacs Lisp Misc value. |
| 130 | end | 154 | end |
| 131 | 155 | ||
| 132 | define xobjfwd | 156 | define xobjfwd |
| 133 | print (struct Lisp_Objfwd *) (($ & $valmask) | gdb_data_seg_bits) | 157 | xgetptr $ |
| 158 | print (struct Lisp_Objfwd *) $ptr | ||
| 134 | end | 159 | end |
| 135 | document xobjfwd | 160 | document xobjfwd |
| 136 | Print $ as an object forwarding pointer, assuming it is an Emacs Lisp Misc value. | 161 | Print $ as an object forwarding pointer, assuming it is an Emacs Lisp Misc value. |
| 137 | end | 162 | end |
| 138 | 163 | ||
| 139 | define xbufobjfwd | 164 | define xbufobjfwd |
| 140 | print (struct Lisp_Buffer_Objfwd *) (($ & $valmask) | gdb_data_seg_bits) | 165 | xgetptr $ |
| 166 | print (struct Lisp_Buffer_Objfwd *) $ptr | ||
| 141 | end | 167 | end |
| 142 | document xbufobjfwd | 168 | document xbufobjfwd |
| 143 | Print $ as a buffer-local object forwarding pointer, assuming it is an Emacs Lisp Misc value. | 169 | Print $ as a buffer-local object forwarding pointer, assuming it is an Emacs Lisp Misc value. |
| 144 | end | 170 | end |
| 145 | 171 | ||
| 146 | define xkbobjfwd | 172 | define xkbobjfwd |
| 147 | print (struct Lisp_Kboard_Objfwd *) (($ & $valmask) | gdb_data_seg_bits) | 173 | xgetptr $ |
| 174 | print (struct Lisp_Kboard_Objfwd *) $ptr | ||
| 148 | end | 175 | end |
| 149 | document xkbobjfwd | 176 | document xkbobjfwd |
| 150 | Print $ as a kboard-local object forwarding pointer, assuming it is an Emacs Lisp Misc value. | 177 | Print $ as a kboard-local object forwarding pointer, assuming it is an Emacs Lisp Misc value. |
| 151 | end | 178 | end |
| 152 | 179 | ||
| 153 | define xbuflocal | 180 | define xbuflocal |
| 154 | print (struct Lisp_Buffer_Local_Value *) (($ & $valmask) | gdb_data_seg_bits) | 181 | xgetptr $ |
| 182 | print (struct Lisp_Buffer_Local_Value *) $ptr | ||
| 155 | end | 183 | end |
| 156 | document xbuflocal | 184 | document xbuflocal |
| 157 | Print $ as a buffer-local-value pointer, assuming it is an Emacs Lisp Misc value. | 185 | Print $ as a buffer-local-value pointer, assuming it is an Emacs Lisp Misc value. |
| 158 | end | 186 | end |
| 159 | 187 | ||
| 160 | define xsymbol | 188 | define xsymbol |
| 161 | print (struct Lisp_Symbol *) ((((int) $) & $valmask) | gdb_data_seg_bits) | 189 | xgetptr $ |
| 162 | xprintsym $ | 190 | print (struct Lisp_Symbol *) $ptr |
| 191 | xprintsym $ | ||
| 192 | echo \n | ||
| 163 | end | 193 | end |
| 164 | document xsymbol | 194 | document xsymbol |
| 165 | Print the name and address of the symbol $. | 195 | Print the name and address of the symbol $. |
| @@ -167,9 +197,10 @@ This command assumes that $ is an Emacs Lisp symbol value. | |||
| 167 | end | 197 | end |
| 168 | 198 | ||
| 169 | define xstring | 199 | define xstring |
| 170 | print (struct Lisp_String *) (($ & $valmask) | gdb_data_seg_bits) | 200 | xgetptr $ |
| 171 | output ($->size > 1000) ? 0 : ($->data[0])@($->size_byte < 0 ? $->size : $->size_byte) | 201 | print (struct Lisp_String *) $ptr |
| 172 | echo \n | 202 | output ($->size > 1000) ? 0 : ($->data[0])@($->size_byte < 0 ? $->size : $->size_byte) |
| 203 | echo \n | ||
| 173 | end | 204 | end |
| 174 | document xstring | 205 | document xstring |
| 175 | Print the contents and address of the string $. | 206 | Print the contents and address of the string $. |
| @@ -177,8 +208,9 @@ This command assumes that $ is an Emacs Lisp string value. | |||
| 177 | end | 208 | end |
| 178 | 209 | ||
| 179 | define xvector | 210 | define xvector |
| 180 | print (struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits) | 211 | xgetptr $ |
| 181 | output ($->size > 50) ? 0 : ($->contents[0])@($->size) | 212 | print (struct Lisp_Vector *) $ptr |
| 213 | output ($->size > 50) ? 0 : ($->contents[0])@($->size) | ||
| 182 | echo \n | 214 | echo \n |
| 183 | end | 215 | end |
| 184 | document xvector | 216 | document xvector |
| @@ -187,32 +219,36 @@ This command assumes that $ is an Emacs Lisp vector value. | |||
| 187 | end | 219 | end |
| 188 | 220 | ||
| 189 | define xprocess | 221 | define xprocess |
| 190 | print (struct Lisp_Process *) (($ & $valmask) | gdb_data_seg_bits) | 222 | xgetptr $ |
| 191 | output *$ | 223 | print (struct Lisp_Process *) $ptr |
| 192 | echo \n | 224 | output *$ |
| 225 | echo \n | ||
| 193 | end | 226 | end |
| 194 | document xprocess | 227 | document xprocess |
| 195 | Print the address of the struct Lisp_process which the Lisp_Object $ points to. | 228 | Print the address of the struct Lisp_process which the Lisp_Object $ points to. |
| 196 | end | 229 | end |
| 197 | 230 | ||
| 198 | define xframe | 231 | define xframe |
| 199 | print (struct frame *) (($ & $valmask) | gdb_data_seg_bits) | 232 | xgetptr $ |
| 233 | print (struct frame *) $ptr | ||
| 200 | end | 234 | end |
| 201 | document xframe | 235 | document xframe |
| 202 | Print $ as a frame pointer, assuming it is an Emacs Lisp frame value. | 236 | Print $ as a frame pointer, assuming it is an Emacs Lisp frame value. |
| 203 | end | 237 | end |
| 204 | 238 | ||
| 205 | define xcompiled | 239 | define xcompiled |
| 206 | print (struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits) | 240 | xgetptr $ |
| 207 | output ($->contents[0])@($->size & 0xff) | 241 | print (struct Lisp_Vector *) $ptr |
| 242 | output ($->contents[0])@($->size & 0xff) | ||
| 208 | end | 243 | end |
| 209 | document xcompiled | 244 | document xcompiled |
| 210 | Print $ as a compiled function pointer, assuming it is an Emacs Lisp compiled value. | 245 | Print $ as a compiled function pointer, assuming it is an Emacs Lisp compiled value. |
| 211 | end | 246 | end |
| 212 | 247 | ||
| 213 | define xwindow | 248 | define xwindow |
| 214 | print (struct window *) (($ & $valmask) | gdb_data_seg_bits) | 249 | xgetptr $ |
| 215 | printf "%dx%d+%d+%d\n", $->width, $->height, $->left, $->top | 250 | print (struct window *) $ptr |
| 251 | printf "%dx%d+%d+%d\n", $->width, $->height, $->left, $->top | ||
| 216 | end | 252 | end |
| 217 | document xwindow | 253 | document xwindow |
| 218 | Print $ as a window pointer, assuming it is an Emacs Lisp window value. | 254 | Print $ as a window pointer, assuming it is an Emacs Lisp window value. |
| @@ -220,27 +256,30 @@ Print the window's position as "WIDTHxHEIGHT+LEFT+TOP". | |||
| 220 | end | 256 | end |
| 221 | 257 | ||
| 222 | define xwinconfig | 258 | define xwinconfig |
| 223 | print (struct save_window_data *) (($ & $valmask) | gdb_data_seg_bits) | 259 | xgetptr $ |
| 260 | print (struct save_window_data *) $ptr | ||
| 224 | end | 261 | end |
| 225 | document xwinconfig | 262 | document xwinconfig |
| 226 | Print $ as a window configuration pointer, assuming it is an Emacs Lisp window configuration value. | 263 | Print $ as a window configuration pointer, assuming it is an Emacs Lisp window configuration value. |
| 227 | end | 264 | end |
| 228 | 265 | ||
| 229 | define xsubr | 266 | define xsubr |
| 230 | print (struct Lisp_Subr *) (($ & $valmask) | gdb_data_seg_bits) | 267 | xgetptr $ |
| 231 | output *$ | 268 | print (struct Lisp_Subr *) $ptr |
| 232 | echo \n | 269 | output *$ |
| 270 | echo \n | ||
| 233 | end | 271 | end |
| 234 | document xsubr | 272 | document xsubr |
| 235 | Print the address of the subr which the Lisp_Object $ points to. | 273 | Print the address of the subr which the Lisp_Object $ points to. |
| 236 | end | 274 | end |
| 237 | 275 | ||
| 238 | define xchartable | 276 | define xchartable |
| 239 | print (struct Lisp_Char_Table *) (($ & $valmask) | gdb_data_seg_bits) | 277 | xgetptr $ |
| 240 | printf "Purpose: " | 278 | print (struct Lisp_Char_Table *) $ptr |
| 241 | output (char*)&((struct Lisp_Symbol *) ((((int) $->purpose) & $valmask) | gdb_data_seg_bits))->name->data | 279 | printf "Purpose: " |
| 242 | printf " %d extra slots", ($->size & 0x1ff) - 388 | 280 | xprintsym $->purpose |
| 243 | echo \n | 281 | printf " %d extra slots", ($->size & 0x1ff) - 388 |
| 282 | echo \n | ||
| 244 | end | 283 | end |
| 245 | document xchartable | 284 | document xchartable |
| 246 | Print the address of the char-table $, and its purpose. | 285 | Print the address of the char-table $, and its purpose. |
| @@ -248,9 +287,10 @@ This command assumes that $ is an Emacs Lisp char-table value. | |||
| 248 | end | 287 | end |
| 249 | 288 | ||
| 250 | define xboolvector | 289 | define xboolvector |
| 251 | print (struct Lisp_Bool_Vector *) (($ & $valmask) | gdb_data_seg_bits) | 290 | xgetptr $ |
| 252 | output ($->size > 256) ? 0 : ($->data[0])@(($->size + 7)/ 8) | 291 | print (struct Lisp_Bool_Vector *) $ptr |
| 253 | echo \n | 292 | output ($->size > 256) ? 0 : ($->data[0])@(($->size + 7)/ 8) |
| 293 | echo \n | ||
| 254 | end | 294 | end |
| 255 | document xboolvector | 295 | document xboolvector |
| 256 | Print the contents and address of the bool-vector $. | 296 | Print the contents and address of the bool-vector $. |
| @@ -258,9 +298,11 @@ This command assumes that $ is an Emacs Lisp bool-vector value. | |||
| 258 | end | 298 | end |
| 259 | 299 | ||
| 260 | define xbuffer | 300 | define xbuffer |
| 261 | print (struct buffer *) (($ & $valmask) | gdb_data_seg_bits) | 301 | xgetptr $ |
| 262 | output ((struct Lisp_String *) ((($->name) & $valmask) | gdb_data_seg_bits))->data | 302 | print (struct buffer *) $ptr |
| 263 | echo \n | 303 | xgetptr $->name |
| 304 | output ((struct Lisp_String *) $ptr)->data | ||
| 305 | echo \n | ||
| 264 | end | 306 | end |
| 265 | document xbuffer | 307 | document xbuffer |
| 266 | Set $ as a buffer pointer, assuming it is an Emacs Lisp buffer value. | 308 | Set $ as a buffer pointer, assuming it is an Emacs Lisp buffer value. |
| @@ -268,24 +310,26 @@ Print the name of the buffer. | |||
| 268 | end | 310 | end |
| 269 | 311 | ||
| 270 | define xhashtable | 312 | define xhashtable |
| 271 | print (struct Lisp_Hash_Table *) (($ & $valmask) | gdb_data_seg_bits) | 313 | xgetptr $ |
| 314 | print (struct Lisp_Hash_Table *) $ptr | ||
| 272 | end | 315 | end |
| 273 | document xhashtable | 316 | document xhashtable |
| 274 | Set $ as a hash table pointer, assuming it is an Emacs Lisp hash table value. | 317 | Set $ as a hash table pointer, assuming it is an Emacs Lisp hash table value. |
| 275 | end | 318 | end |
| 276 | 319 | ||
| 277 | define xcons | 320 | define xcons |
| 278 | print (struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits) | 321 | xgetptr $ |
| 279 | output/x *$ | 322 | print (struct Lisp_Cons *) $ptr |
| 280 | echo \n | 323 | output/x *$ |
| 324 | echo \n | ||
| 281 | end | 325 | end |
| 282 | document xcons | 326 | document xcons |
| 283 | Print the contents of $, assuming it is an Emacs Lisp cons. | 327 | Print the contents of $, assuming it is an Emacs Lisp cons. |
| 284 | end | 328 | end |
| 285 | 329 | ||
| 286 | define nextcons | 330 | define nextcons |
| 287 | p $.cdr | 331 | p $.cdr |
| 288 | xcons | 332 | xcons |
| 289 | end | 333 | end |
| 290 | document nextcons | 334 | document nextcons |
| 291 | Print the contents of the next cell in a list. | 335 | Print the contents of the next cell in a list. |
| @@ -293,28 +337,34 @@ This assumes that the last thing you printed was a cons cell contents | |||
| 293 | (type struct Lisp_Cons) or a pointer to one. | 337 | (type struct Lisp_Cons) or a pointer to one. |
| 294 | end | 338 | end |
| 295 | define xcar | 339 | define xcar |
| 296 | print/x ((($ >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits))->car : 0) | 340 | xgetptr $ |
| 341 | xgettype $ | ||
| 342 | print/x ($type == Lisp_Cons ? ((struct Lisp_Cons *) $ptr)->car : 0) | ||
| 297 | end | 343 | end |
| 298 | document xcar | 344 | document xcar |
| 299 | Print the car of $, assuming it is an Emacs Lisp pair. | 345 | Print the car of $, assuming it is an Emacs Lisp pair. |
| 300 | end | 346 | end |
| 301 | 347 | ||
| 302 | define xcdr | 348 | define xcdr |
| 303 | print/x ((($ >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits))->cdr : 0) | 349 | xgetptr $ |
| 350 | xgettype $ | ||
| 351 | print/x ($type == Lisp_Cons ? ((struct Lisp_Cons *) $ptr)->cdr : 0) | ||
| 304 | end | 352 | end |
| 305 | document xcdr | 353 | document xcdr |
| 306 | Print the cdr of $, assuming it is an Emacs Lisp pair. | 354 | Print the cdr of $, assuming it is an Emacs Lisp pair. |
| 307 | end | 355 | end |
| 308 | 356 | ||
| 309 | define xfloat | 357 | define xfloat |
| 310 | print ((struct Lisp_Float *) (($ & $valmask) | gdb_data_seg_bits))->data | 358 | xgetptr $ |
| 359 | print ((struct Lisp_Float *) $ptr)->data | ||
| 311 | end | 360 | end |
| 312 | document xfloat | 361 | document xfloat |
| 313 | Print $ assuming it is a lisp floating-point number. | 362 | Print $ assuming it is a lisp floating-point number. |
| 314 | end | 363 | end |
| 315 | 364 | ||
| 316 | define xscrollbar | 365 | define xscrollbar |
| 317 | print (struct scrollbar *) (($ & $valmask) | gdb_data_seg_bits) | 366 | xgetptr $ |
| 367 | print (struct scrollbar *) $ptr | ||
| 318 | output *$ | 368 | output *$ |
| 319 | echo \n | 369 | echo \n |
| 320 | end | 370 | end |
| @@ -323,10 +373,11 @@ Print $ as a scrollbar pointer. | |||
| 323 | end | 373 | end |
| 324 | 374 | ||
| 325 | define xprintsym | 375 | define xprintsym |
| 326 | set $sym = (struct Lisp_Symbol *) ((((int) $arg0) & $valmask) | gdb_data_seg_bits) | 376 | xgetptr $arg0 |
| 327 | set $sym_name = ((struct Lisp_String *)(($sym->xname & $valmask) | gdb_data_seg_bits)) | 377 | set $sym = (struct Lisp_Symbol *) $ptr |
| 378 | xgetptr $sym->xname | ||
| 379 | set $sym_name = (struct Lisp_String *) $ptr | ||
| 328 | output ($sym_name->data[0])@($sym_name->size_byte < 0 ? $sym_name->size : $sym_name->size_byte) | 380 | output ($sym_name->data[0])@($sym_name->size_byte < 0 ? $sym_name->size : $sym_name->size_byte) |
| 329 | echo \n | ||
| 330 | end | 381 | end |
| 331 | document xprintsym | 382 | document xprintsym |
| 332 | Print argument as a symbol. | 383 | Print argument as a symbol. |
| @@ -335,14 +386,16 @@ end | |||
| 335 | define xbacktrace | 386 | define xbacktrace |
| 336 | set $bt = backtrace_list | 387 | set $bt = backtrace_list |
| 337 | while $bt | 388 | while $bt |
| 338 | set $type = (enum Lisp_Type) ((*$bt->function >> gdb_valbits) & 0x7) | 389 | xgettype (*$bt->function) |
| 339 | if $type == Lisp_Symbol | 390 | if $type == Lisp_Symbol |
| 340 | xprintsym *$bt->function | 391 | xprintsym (*$bt->function) |
| 392 | echo \n | ||
| 341 | else | 393 | else |
| 342 | printf "0x%x ", *$bt->function | 394 | printf "0x%x ", *$bt->function |
| 343 | if $type == Lisp_Vectorlike | 395 | if $type == Lisp_Vectorlike |
| 344 | set $size = ((struct Lisp_Vector *) ((*$bt->function & $valmask) | gdb_data_seg_bits))->size | 396 | xgetptr (*$bt->function) |
| 345 | output (enum pvec_type) (($size & PVEC_FLAG) ? $size & PVEC_TYPE_MASK : 0) | 397 | set $size = ((struct Lisp_Vector *) $ptr)->size |
| 398 | output ($size & PVEC_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size | ||
| 346 | else | 399 | else |
| 347 | printf "Lisp type %d", $type | 400 | printf "Lisp type %d", $type |
| 348 | end | 401 | end |
| @@ -358,16 +411,17 @@ document xbacktrace | |||
| 358 | end | 411 | end |
| 359 | 412 | ||
| 360 | define xreload | 413 | define xreload |
| 361 | set $valmask = ((long)1 << gdb_valbits) - 1 | 414 | set $tagmask = (((long)1 << gdb_gctypebits) - 1) |
| 362 | set $nonvalbits = gdb_emacs_intbits - gdb_valbits | 415 | set $valmask = gdb_use_lsb ? ~($tagmask) : ((long)1 << gdb_valbits) - 1 |
| 363 | end | 416 | end |
| 364 | document xreload | 417 | document xreload |
| 365 | When starting Emacs a second time in the same gdb session under | 418 | When starting Emacs a second time in the same gdb session under |
| 366 | FreeBSD 2.2.5, gdb 4.13, $valmask and $nonvalbits have lost | 419 | FreeBSD 2.2.5, gdb 4.13, $valmask have lost |
| 367 | their values. (The same happens on current (2000) versions of GNU/Linux | 420 | their values. (The same happens on current (2000) versions of GNU/Linux |
| 368 | with gdb 5.0.) | 421 | with gdb 5.0.) |
| 369 | This function reloads them. | 422 | This function reloads them. |
| 370 | end | 423 | end |
| 424 | xreload | ||
| 371 | 425 | ||
| 372 | define hook-run | 426 | define hook-run |
| 373 | xreload | 427 | xreload |