comparison src/.gdbinit @ 400:a86b2b5e0111 r21-2-30

Import from CVS: tag r21-2-30
author cvs
date Mon, 13 Aug 2007 11:14:34 +0200
parents 74fd4e045ea6
children 3d3049ae1304
comparison
equal deleted inserted replaced
399:376370fb5946 400:a86b2b5e0111
46 # defined in this file to work correctly. 46 # defined in this file to work correctly.
47 47
48 set print union off 48 set print union off
49 set print pretty off 49 set print pretty off
50 50
51 set $Lisp_Type_Int = -2
52
51 define decode_object 53 define decode_object
52 set $obj = (unsigned long) $arg0 54 set $obj = (unsigned long) $arg0
53 if $obj & 1 55 if $obj & 1
54 # It's an int 56 # It's an int
55 set $val = $obj >> 1 57 set $val = $obj >> 1
56 set $type = Lisp_Type_Int 58 set $type = $Lisp_Type_Int
57 else 59 else
58 set $type = $obj & dbg_typemask 60 set $type = $obj & dbg_typemask
59 if $type == Lisp_Type_Char 61 if $type == Lisp_Type_Char
60 set $val = ($obj & dbg_valmask) >> dbg_gctypebits 62 set $val = ($obj & dbg_valmask) >> dbg_gctypebits
61 else 63 else
63 set $val = $obj 65 set $val = $obj
64 end 66 end
65 end 67 end
66 68
67 if $type == Lisp_Type_Record 69 if $type == Lisp_Type_Record
68 set $lheader = (struct lrecord_header *) $val 70 set $lheader = ((struct lrecord_header *) $val)
69 set $imp = lrecord_implementations_table[$lheader->type] 71 set $lrecord_type = ($lheader->type)
70 else 72 set $imp = lrecord_implementations_table[$lrecord_type]
73 else
74 set $lrecord_type = -1
75 set $lheader = -1
71 set $imp = -1 76 set $imp = -1
72 end 77 end
73 end 78 end
74 79
75 document decode_object 80 document decode_object
83 print ((long) $val) 88 print ((long) $val)
84 end 89 end
85 90
86 define xtype 91 define xtype
87 decode_object $arg0 92 decode_object $arg0
88 if $type == Lisp_Type_Int 93 if $type == $Lisp_Type_Int
89 echo int\n 94 echo int\n
90 else 95 else
91 if $type == Lisp_Type_Char 96 if $type == Lisp_Type_Char
92 echo char\n 97 echo char\n
93 else 98 else
94 if $type == Lisp_Type_Symbol
95 echo symbol\n
96 else
97 if $type == Lisp_Type_String
98 echo string\n
99 else
100 if $type == Lisp_Type_Vector
101 echo vector\n
102 else
103 if $type == Lisp_Type_Cons
104 echo cons\n
105 else
106 printf "record type: %s\n", $imp->name 99 printf "record type: %s\n", $imp->name
107 # barf
108 end
109 end
110 end
111 end
112 end 100 end
113 end 101 end
114 end 102 end
115 103
116 document xtype 104 document xtype
238 print XrmQuarkToString(((Object)($arg0))->object.xrm_name) 226 print XrmQuarkToString(((Object)($arg0))->object.xrm_name)
239 end 227 end
240 228
241 # GDB's command language makes you want to ... 229 # GDB's command language makes you want to ...
242 230
243 define pstruct 231 define ptype
244 set $xstruct = (struct $arg0 *) $val 232 set $type_ptr = ($arg0 *) $val
245 print $xstruct 233 print $type_ptr
246 print *$xstruct 234 print *$type_ptr
235 end
236
237 define pstructtype
238 set $type_ptr = (struct $arg0 *) $val
239 print $type_ptr
240 print *$type_ptr
247 end 241 end
248 242
249 define pobj 243 define pobj
250 decode_object $arg0 244 decode_object $arg0
251 if $type == Lisp_Type_Int 245 if $type == $Lisp_Type_Int
252 printf "Integer: %d\n", $val 246 printf "Integer: %d\n", $val
253 else 247 else
254 if $type == Lisp_Type_Char 248 if $type == Lisp_Type_Char
255 if $val > 32 && $val < 128 249 if $val > 32 && $val < 128
256 printf "Char: %c\n", $val 250 printf "Char: %c\n", $val
257 else 251 else
258 printf "Char: %d\n", $val 252 printf "Char: %d\n", $val
259 end 253 end
260 else 254 else
261 if $type == Lisp_Type_String || $imp == &lrecord_string 255 if $lrecord_type == lrecord_type_string
262 pstruct Lisp_String 256 ptype Lisp_String
263 else 257 else
264 if $type == Lisp_Type_Cons || $imp == &lrecord_cons 258 if $lrecord_type == lrecord_type_cons
265 pstruct Lisp_Cons 259 ptype Lisp_Cons
266 else 260 else
267 if $type == Lisp_Type_Symbol || $imp == &lrecord_symbol 261 if $lrecord_type == lrecord_type_symbol
268 pstruct Lisp_Symbol 262 ptype Lisp_Symbol
269 printf "Symbol name: %s\n", $xstruct->name->data 263 printf "Symbol name: %s\n", $type_ptr->name->data
270 else 264 else
271 if $type == Lisp_Type_Vector || $imp == &lrecord_vector 265 if $lrecord_type == lrecord_type_vector
272 pstruct Lisp_Vector 266 ptype Lisp_Vector
273 printf "Vector of length %d\n", $xstruct->size 267 printf "Vector of length %d\n", $type_ptr->size
274 #print *($xstruct->data) @ $xstruct->size 268 #print *($type_ptr->data) @ $type_ptr->size
275 else 269 else
276 if $imp == &lrecord_bit_vector 270 if $lrecord_type == lrecord_type_bit_vector
277 pstruct Lisp_Bit_Vector 271 ptype Lisp_Bit_Vector
278 else 272 else
279 if $imp == &lrecord_buffer 273 if $lrecord_type == lrecord_type_buffer
280 pstruct buffer 274 pstructtype buffer
281 else 275 else
282 if $imp == &lrecord_char_table 276 if $lrecord_type == lrecord_type_char_table
283 pstruct Lisp_Char_Table 277 ptype Lisp_Char_Table
284 else 278 else
285 if $imp == &lrecord_char_table_entry 279 if $lrecord_type == lrecord_type_char_table_entry
286 pstruct Lisp_Char_Table_Entry 280 ptype Lisp_Char_Table_Entry
287 else 281 else
288 if $imp == &lrecord_charset 282 if $lrecord_type == lrecord_type_charset
289 pstruct Lisp_Charset 283 ptype Lisp_Charset
290 else 284 else
291 if $imp == &lrecord_coding_system 285 if $lrecord_type == lrecord_type_coding_system
292 pstruct Lisp_Coding_System 286 ptype Lisp_Coding_System
293 else 287 else
294 if $imp == &lrecord_color_instance 288 if $lrecord_type == lrecord_type_color_instance
295 pstruct Lisp_Color_Instance 289 ptype Lisp_Color_Instance
296 else 290 else
297 if $imp == &lrecord_command_builder 291 if $lrecord_type == lrecord_type_command_builder
298 pstruct command_builder 292 ptype command_builder
299 else 293 else
300 if $imp == &lrecord_compiled_function 294 if $lrecord_type == lrecord_type_compiled_function
301 pstruct Lisp_Compiled_Function 295 ptype Lisp_Compiled_Function
302 else 296 else
303 if $imp == &lrecord_console 297 if $lrecord_type == lrecord_type_console
304 pstruct console 298 pstructtype console
305 else 299 else
306 if $imp == &lrecord_database 300 if $lrecord_type == lrecord_type_database
307 pstruct Lisp_Database 301 ptype Lisp_Database
308 else 302 else
309 if $imp == &lrecord_device 303 if $lrecord_type == lrecord_type_device
310 pstruct device 304 pstructtype device
311 else 305 else
312 if $imp == &lrecord_event 306 if $lrecord_type == lrecord_type_event
313 pstruct Lisp_Event 307 ptype Lisp_Event
314 else 308 else
315 if $imp == &lrecord_extent 309 if $lrecord_type == lrecord_type_extent
316 pstruct extent 310 pstructtype extent
317 else 311 else
318 if $imp == &lrecord_extent_auxiliary 312 if $lrecord_type == lrecord_type_extent_auxiliary
319 pstruct extent_auxiliary 313 pstructtype extent_auxiliary
320 else 314 else
321 if $imp == &lrecord_extent_info 315 if $lrecord_type == lrecord_type_extent_info
322 pstruct extent_info 316 pstructtype extent_info
323 else 317 else
324 if $imp == &lrecord_face 318 if $lrecord_type == lrecord_type_face
325 pstruct Lisp_Face 319 ptype Lisp_Face
326 else 320 else
327 if $imp == &lrecord_float 321 if $lrecord_type == lrecord_type_float
328 pstruct Lisp_Float 322 ptype Lisp_Float
329 else 323 else
330 if $imp == &lrecord_font_instance 324 if $lrecord_type == lrecord_type_font_instance
331 pstruct Lisp_Font_Instance 325 ptype Lisp_Font_Instance
332 else 326 else
333 if $imp == &lrecord_frame 327 if $lrecord_type == lrecord_type_frame
334 pstruct frame 328 pstructtype frame
335 else 329 else
336 if $imp == &lrecord_glyph 330 if $lrecord_type == lrecord_type_glyph
337 pstruct Lisp_Glyph 331 ptype Lisp_Glyph
338 else 332 else
339 if $imp == &lrecord_hash_table 333 if $lrecord_type == lrecord_type_gui_item
340 pstruct Lisp_Hash_Table 334 ptype Lisp_Gui_Item
341 else 335 else
342 if $imp == &lrecord_image_instance 336 if $lrecord_type == lrecord_type_hash_table
343 pstruct Lisp_Image_Instance 337 ptype Lisp_Hash_Table
344 else 338 else
345 if $imp == &lrecord_keymap 339 if $lrecord_type == lrecord_type_image_instance
346 pstruct Lisp_Keymap 340 ptype Lisp_Image_Instance
347 else 341 else
348 if $imp == &lrecord_lcrecord_list 342 if $lrecord_type == lrecord_type_keymap
349 pstruct lcrecord_list 343 ptype Lisp_Keymap
350 else 344 else
351 if $imp == &lrecord_lstream 345 if $lrecord_type == lrecord_type_lcrecord_list
352 pstruct lstream 346 pstructtype lcrecord_list
353 else 347 else
354 if $imp == &lrecord_marker 348 if $lrecord_type == lrecord_type_ldap
355 pstruct Lisp_Marker 349 ptype Lisp_LDAP
356 else 350 else
357 if $imp == &lrecord_opaque 351 if $lrecord_type == lrecord_type_lstream
358 pstruct Lisp_Opaque 352 pstructtype lstream
359 else 353 else
360 if $imp == &lrecord_opaque_ptr 354 if $lrecord_type == lrecord_type_marker
361 pstruct Lisp_Opaque_Ptr 355 ptype Lisp_Marker
362 else 356 else
363 if $imp == &lrecord_popup_data 357 if $lrecord_type == lrecord_type_opaque
364 pstruct popup_data 358 ptype Lisp_Opaque
365 else 359 else
366 if $imp == &lrecord_process 360 if $lrecord_type == lrecord_type_opaque_ptr
367 pstruct Lisp_Process 361 ptype Lisp_Opaque_Ptr
368 else 362 else
369 if $imp == &lrecord_range_table 363 if $lrecord_type == lrecord_type_popup_data
370 pstruct Lisp_Range_Table 364 ptype popup_data
371 else 365 else
372 if $imp == &lrecord_specifier 366 if $lrecord_type == lrecord_type_process
373 pstruct Lisp_Specifier 367 ptype Lisp_Process
374 else 368 else
375 if $imp == &lrecord_subr 369 if $lrecord_type == lrecord_type_range_table
376 pstruct Lisp_Subr 370 ptype Lisp_Range_Table
377 else 371 else
378 if $imp == &lrecord_symbol_value_buffer_local 372 if $lrecord_type == lrecord_type_specifier
379 pstruct symbol_value_buffer_local 373 ptype Lisp_Specifier
380 else 374 else
381 if $imp == &lrecord_symbol_value_forward 375 if $lrecord_type == lrecord_type_subr
382 pstruct symbol_value_forward 376 ptype Lisp_Subr
383 else 377 else
384 if $imp == &lrecord_symbol_value_lisp_magic 378 if $lrecord_type == lrecord_type_symbol_value_buffer_local
385 pstruct symbol_value_lisp_magic 379 pstructtype symbol_value_buffer_local
386 else 380 else
387 if $imp == &lrecord_symbol_value_varalias 381 if $lrecord_type == lrecord_type_symbol_value_forward
388 pstruct symbol_value_varalias 382 pstructtype symbol_value_forward
389 else 383 else
390 if $imp == &lrecord_toolbar_button 384 if $lrecord_type == lrecord_type_symbol_value_lisp_magic
391 pstruct toolbar_button 385 pstructtype symbol_value_lisp_magic
392 else 386 else
393 if $imp == &lrecord_tooltalk_message 387 if $lrecord_type == lrecord_type_symbol_value_varalias
394 pstruct Lisp_Tooltalk_Message 388 pstructtype symbol_value_varalias
395 else 389 else
396 if $imp == &lrecord_tooltalk_pattern 390 if $lrecord_type == lrecord_type_timeout
397 pstruct Lisp_Tooltalk_Pattern 391 ptype Lisp_Timeout
398 else 392 else
399 if $imp == &lrecord_weak_list 393 if $lrecord_type == lrecord_type_toolbar_button
400 pstruct weak_list 394 pstructtype toolbar_button
401 else 395 else
402 if $imp == &lrecord_window 396 if $lrecord_type == lrecord_type_tooltalk_message
403 pstruct window 397 ptype Lisp_Tooltalk_Message
404 else 398 else
405 if $imp == &lrecord_window_configuration 399 if $lrecord_type == lrecord_type_tooltalk_pattern
406 pstruct window_config 400 ptype Lisp_Tooltalk_Pattern
401 else
402 if $lrecord_type == lrecord_type_weak_list
403 pstructtype weak_list
404 else
405 if $lrecord_type == lrecord_type_window
406 pstructtype window
407 else
408 if $lrecord_type == lrecord_type_window_configuration
409 pstructtype window_config
407 else 410 else
408 echo Unknown Lisp Object type\n 411 echo Unknown Lisp Object type\n
409 print $arg0 412 print $arg0
410 # Barf, gag, retch 413 # Barf, gag, retch
411 end 414 end
421 end 424 end
422 end 425 end
423 end 426 end
424 end 427 end
425 end 428 end
429 end
430 end
426 # Repeat after me... gdb sux, gdb sux, gdb sux... 431 # Repeat after me... gdb sux, gdb sux, gdb sux...
427 end 432 end
428 end 433 end
429 end 434 end
430 end 435 end
441 end 446 end
442 end 447 end
443 end 448 end
444 end 449 end
445 # Are we having fun yet?? 450 # Are we having fun yet??
451 end
446 end 452 end
447 end 453 end
448 end 454 end
449 end 455 end
450 end 456 end