aboutsummaryrefslogtreecommitdiffstats
path: root/src/.gdbinit
diff options
context:
space:
mode:
Diffstat (limited to 'src/.gdbinit')
-rw-r--r--src/.gdbinit167
1 files changed, 75 insertions, 92 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index 2cf5663df91..7cd828733b1 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -1,4 +1,4 @@
1# Copyright (C) 1992-1998, 2000-2011 Free Software Foundation, Inc. 1# Copyright (C) 1992-1998, 2000-2012 Free Software Foundation, Inc.
2# 2#
3# This file is part of GNU Emacs. 3# This file is part of GNU Emacs.
4# 4#
@@ -67,10 +67,7 @@ end
67# from calling OutputDebugString, which causes GDB to display each 67# from calling OutputDebugString, which causes GDB to display each
68# character twice (yuk!). 68# character twice (yuk!).
69define pr 69define pr
70 set $output_debug = print_output_debug_flag 70 pp $
71 set print_output_debug_flag = 0
72 set debug_print ($)
73 set print_output_debug_flag = $output_debug
74end 71end
75document pr 72document pr
76Print the emacs s-expression which is $. 73Print the emacs s-expression which is $.
@@ -90,48 +87,17 @@ Print the argument as an emacs s-expression
90Works only when an inferior emacs is executing. 87Works only when an inferior emacs is executing.
91end 88end
92 89
93# Print out s-expressions from tool bar
94define pp1
95 set $tmp = $arg0
96 set $output_debug = print_output_debug_flag
97 set print_output_debug_flag = 0
98 set safe_debug_print ($tmp)
99 set print_output_debug_flag = $output_debug
100end
101document pp1
102Print the argument as an emacs s-expression.
103Works only when an inferior emacs is executing.
104For use on tool bar when debugging in Emacs
105where the variable name would not otherwise
106be recorded in the GUD buffer.
107end
108
109# Print value of lisp variable 90# Print value of lisp variable
110define pv 91define pv
111 set $tmp = "$arg0" 92 set $tmp = "$arg0"
112 set $output_debug = print_output_debug_flag 93 set $output_debug = print_output_debug_flag
113 set print_output_debug_flag = 0 94 set print_output_debug_flag = 0
114 set safe_debug_print ( find_symbol_value (intern ($tmp)))
115 set print_output_debug_flag = $output_debug
116end
117document pv
118Print the value of the lisp variable given as argument.
119Works only when an inferior emacs is executing.
120end
121
122# Print value of lisp variable
123define pv1
124 set $tmp = "$arg0"
125 set $output_debug = print_output_debug_flag
126 set print_output_debug_flag = 0
127 set safe_debug_print (find_symbol_value (intern ($tmp))) 95 set safe_debug_print (find_symbol_value (intern ($tmp)))
128 set print_output_debug_flag = $output_debug 96 set print_output_debug_flag = $output_debug
129end 97end
130document pv1 98document pv
131Print the value of the lisp variable given as argument. 99Print the value of the lisp variable given as argument.
132Works only when an inferior emacs is executing. 100Works only when an inferior emacs is executing.
133For use when debugging in Emacs where the variable
134name would not otherwise be recorded in the GUD buffer.
135end 101end
136 102
137# Print out current buffer point and boundaries 103# Print out current buffer point and boundaries
@@ -288,8 +254,8 @@ define pitx
288 while ($i < $it->sp && $i < 4) 254 while ($i < $it->sp && $i < 4)
289 set $e = $it->stack[$i] 255 set $e = $it->stack[$i]
290 printf "stack[%d]: ", $i 256 printf "stack[%d]: ", $i
291 pitmethod $e->method 257 pitmethod $e.method
292 printf "[%d]", $e->position.charpos 258 printf "[%d]", $e.position.charpos
293 printf "\n" 259 printf "\n"
294 set $i = $i + 1 260 set $i = $i + 1
295 end 261 end
@@ -311,9 +277,8 @@ define prowx
311 printf "y=%d x=%d pwid=%d", $row->y, $row->x, $row->pixel_width 277 printf "y=%d x=%d pwid=%d", $row->y, $row->x, $row->pixel_width
312 printf " a+d=%d+%d=%d", $row->ascent, $row->height-$row->ascent, $row->height 278 printf " a+d=%d+%d=%d", $row->ascent, $row->height-$row->ascent, $row->height
313 printf " phys=%d+%d=%d", $row->phys_ascent, $row->phys_height-$row->phys_ascent, $row->phys_height 279 printf " phys=%d+%d=%d", $row->phys_ascent, $row->phys_height-$row->phys_ascent, $row->phys_height
314 printf " vis=%d", $row->visible_height 280 printf " vis=%d\n", $row->visible_height
315 printf " L=%d T=%d R=%d", $row->used[0], $row->used[1], $row->used[2] 281 printf "used=(LMargin=%d,Text=%d,RMargin=%d) Hash=%d\n", $row->used[0], $row->used[1], $row->used[2], $row->hash
316 printf "\n"
317 printf "start=%d end=%d", $row->start.pos.charpos, $row->end.pos.charpos 282 printf "start=%d end=%d", $row->start.pos.charpos, $row->end.pos.charpos
318 if ($row->enabled_p) 283 if ($row->enabled_p)
319 printf " ENA" 284 printf " ENA"
@@ -483,83 +448,83 @@ end
483define pgx 448define pgx
484 set $g = $arg0 449 set $g = $arg0
485 # CHAR_GLYPH 450 # CHAR_GLYPH
486 if ($g->type == 0) 451 if ($g.type == 0)
487 if ($g->u.ch >= ' ' && $g->u.ch < 127) 452 if ($g.u.ch >= ' ' && $g.u.ch < 127)
488 printf "CHAR[%c]", $g->u.ch 453 printf "CHAR[%c]", $g.u.ch
489 else 454 else
490 printf "CHAR[0x%x]", $g->u.ch 455 printf "CHAR[0x%x]", $g.u.ch
491 end 456 end
492 end 457 end
493 # COMPOSITE_GLYPH 458 # COMPOSITE_GLYPH
494 if ($g->type == 1) 459 if ($g.type == 1)
495 printf "COMP[%d (%d..%d)]", $g->u.cmp.id, $g->slice.cmp.from, $g->slice.cmp.to 460 printf "COMP[%d (%d..%d)]", $g.u.cmp.id, $g.slice.cmp.from, $g.slice.cmp.to
496 end 461 end
497 # GLYPHLESS_GLYPH 462 # GLYPHLESS_GLYPH
498 if ($g->type == 2) 463 if ($g.type == 2)
499 printf "GLYPHLESS[" 464 printf "GLYPHLESS["
500 if ($g->u.glyphless.method == 0) 465 if ($g.u.glyphless.method == 0)
501 printf "THIN]" 466 printf "THIN]"
502 end 467 end
503 if ($g->u.glyphless.method == 1) 468 if ($g.u.glyphless.method == 1)
504 printf "EMPTY]" 469 printf "EMPTY]"
505 end 470 end
506 if ($g->u.glyphless.method == 2) 471 if ($g.u.glyphless.method == 2)
507 printf "ACRO]" 472 printf "ACRO]"
508 end 473 end
509 if ($g->u.glyphless.method == 3) 474 if ($g.u.glyphless.method == 3)
510 printf "HEX]" 475 printf "HEX]"
511 end 476 end
512 end 477 end
513 # IMAGE_GLYPH 478 # IMAGE_GLYPH
514 if ($g->type == 3) 479 if ($g.type == 3)
515 printf "IMAGE[%d]", $g->u.img_id 480 printf "IMAGE[%d]", $g.u.img_id
516 end 481 end
517 # STRETCH_GLYPH 482 # STRETCH_GLYPH
518 if ($g->type == 4) 483 if ($g.type == 4)
519 printf "STRETCH[%d+%d]", $g->u.stretch.height, $g->u.stretch.ascent 484 printf "STRETCH[%d+%d]", $g.u.stretch.height, $g.u.stretch.ascent
520 end 485 end
521 xgettype ($g->object) 486 xgettype ($g.object)
522 if ($type == Lisp_String) 487 if ($type == Lisp_String)
523 printf " str=%x[%d]", $g->object, $g->charpos 488 printf " str=%x[%d]", $g.object, $g.charpos
524 else 489 else
525 printf " pos=%d", $g->charpos 490 printf " pos=%d", $g.charpos
526 end 491 end
527 # For characters, print their resolved level and bidi type 492 # For characters, print their resolved level and bidi type
528 if ($g->type == 0) 493 if ($g.type == 0)
529 printf " blev=%d,btyp=", $g->resolved_level 494 printf " blev=%d,btyp=", $g.resolved_level
530 pbiditype $g->bidi_type 495 pbiditype $g.bidi_type
531 end 496 end
532 printf " w=%d a+d=%d+%d", $g->pixel_width, $g->ascent, $g->descent 497 printf " w=%d a+d=%d+%d", $g.pixel_width, $g.ascent, $g.descent
533 # If not DEFAULT_FACE_ID 498 # If not DEFAULT_FACE_ID
534 if ($g->face_id != 0) 499 if ($g.face_id != 0)
535 printf " face=%d", $g->face_id 500 printf " face=%d", $g.face_id
536 end 501 end
537 if ($g->voffset) 502 if ($g.voffset)
538 printf " vof=%d", $g->voffset 503 printf " vof=%d", $g.voffset
539 end 504 end
540 if ($g->multibyte_p) 505 if ($g.multibyte_p)
541 printf " MB" 506 printf " MB"
542 end 507 end
543 if ($g->padding_p) 508 if ($g.padding_p)
544 printf " PAD" 509 printf " PAD"
545 end 510 end
546 if ($g->glyph_not_available_p) 511 if ($g.glyph_not_available_p)
547 printf " N/A" 512 printf " N/A"
548 end 513 end
549 if ($g->overlaps_vertically_p) 514 if ($g.overlaps_vertically_p)
550 printf " OVL" 515 printf " OVL"
551 end 516 end
552 if ($g->avoid_cursor_p) 517 if ($g.avoid_cursor_p)
553 printf " AVOID" 518 printf " AVOID"
554 end 519 end
555 if ($g->left_box_line_p) 520 if ($g.left_box_line_p)
556 printf " [" 521 printf " ["
557 end 522 end
558 if ($g->right_box_line_p) 523 if ($g.right_box_line_p)
559 printf " ]" 524 printf " ]"
560 end 525 end
561 if ($g->slice.img.x || $g->slice.img.y || $g->slice.img.width || $g->slice.img.height) 526 if ($g.slice.img.x || $g.slice.img.y || $g.slice.img.width || $g.slice.img.height)
562 printf " slice=%d,%d,%d,%d" ,$g->slice.img.x, $g->slice.img.y, $g->slice.img.width, $g->slice.img.height 527 printf " slice=%d,%d,%d,%d" ,$g.slice.img.x, $g.slice.img.y, $g.slice.img.width, $g.slice.img.height
563 end 528 end
564 printf "\n" 529 printf "\n"
565end 530end
@@ -677,7 +642,7 @@ end
677 642
678define xvectype 643define xvectype
679 xgetptr $ 644 xgetptr $
680 set $size = ((struct Lisp_Vector *) $ptr)->size 645 set $size = ((struct Lisp_Vector *) $ptr)->header.size
681 output ($size & PVEC_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size & ~gdb_array_mark_flag 646 output ($size & PVEC_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size & ~gdb_array_mark_flag
682 echo \n 647 echo \n
683end 648end
@@ -818,7 +783,7 @@ end
818define xvector 783define xvector
819 xgetptr $ 784 xgetptr $
820 print (struct Lisp_Vector *) $ptr 785 print (struct Lisp_Vector *) $ptr
821 output ($->size > 50) ? 0 : ($->contents[0])@($->size & ~gdb_array_mark_flag) 786 output ($->header.size > 50) ? 0 : ($->contents[0])@($->header.size & ~gdb_array_mark_flag)
822echo \n 787echo \n
823end 788end
824document xvector 789document xvector
@@ -853,7 +818,7 @@ end
853define xcompiled 818define xcompiled
854 xgetptr $ 819 xgetptr $
855 print (struct Lisp_Vector *) $ptr 820 print (struct Lisp_Vector *) $ptr
856 output ($->contents[0])@($->size & 0xff) 821 output ($->contents[0])@($->header.size & 0xff)
857end 822end
858document xcompiled 823document xcompiled
859Print $ as a compiled function pointer. 824Print $ as a compiled function pointer.
@@ -903,7 +868,7 @@ define xchartable
903 print (struct Lisp_Char_Table *) $ptr 868 print (struct Lisp_Char_Table *) $ptr
904 printf "Purpose: " 869 printf "Purpose: "
905 xprintsym $->purpose 870 xprintsym $->purpose
906 printf " %d extra slots", ($->size & 0x1ff) - 68 871 printf " %d extra slots", ($->header.size & 0x1ff) - 68
907 echo \n 872 echo \n
908end 873end
909document xchartable 874document xchartable
@@ -927,7 +892,7 @@ end
927define xboolvector 892define xboolvector
928 xgetptr $ 893 xgetptr $
929 print (struct Lisp_Bool_Vector *) $ptr 894 print (struct Lisp_Bool_Vector *) $ptr
930 output ($->size > 256) ? 0 : ($->data[0])@((($->size & ~gdb_array_mark_flag) + 7)/ 8) 895 output ($->header.size > 256) ? 0 : ($->data[0])@((($->header.size & ~gdb_array_mark_flag) + 7)/ 8)
931 echo \n 896 echo \n
932end 897end
933document xboolvector 898document xboolvector
@@ -1093,7 +1058,7 @@ define xpr
1093# end 1058# end
1094 end 1059 end
1095 if $type == Lisp_Vectorlike 1060 if $type == Lisp_Vectorlike
1096 set $size = ((struct Lisp_Vector *) $ptr)->size 1061 set $size = ((struct Lisp_Vector *) $ptr)->header.size
1097 if ($size & PVEC_FLAG) 1062 if ($size & PVEC_FLAG)
1098 set $vec = (enum pvec_type) ($size & PVEC_TYPE_MASK) 1063 set $vec = (enum pvec_type) ($size & PVEC_TYPE_MASK)
1099 if $vec == PVEC_NORMAL_VECTOR 1064 if $vec == PVEC_NORMAL_VECTOR
@@ -1202,7 +1167,7 @@ end
1202 1167
1203define xfont 1168define xfont
1204 xgetptr $ 1169 xgetptr $
1205 set $size = (((struct Lisp_Vector *) $ptr)->size & 0x1FF) 1170 set $size = (((struct Lisp_Vector *) $ptr)->header.size & 0x1FF)
1206 if $size == FONT_SPEC_MAX 1171 if $size == FONT_SPEC_MAX
1207 print (struct font_spec *) $ptr 1172 print (struct font_spec *) $ptr
1208 else 1173 else
@@ -1229,7 +1194,7 @@ define xbacktrace
1229 printf "0x%x ", $ptr 1194 printf "0x%x ", $ptr
1230 if $type == Lisp_Vectorlike 1195 if $type == Lisp_Vectorlike
1231 xgetptr (*$bt->function) 1196 xgetptr (*$bt->function)
1232 set $size = ((struct Lisp_Vector *) $ptr)->size 1197 set $size = ((struct Lisp_Vector *) $ptr)->header.size
1233 output ($size & PVEC_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size & ~gdb_array_mark_flag 1198 output ($size & PVEC_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size & ~gdb_array_mark_flag
1234 else 1199 else
1235 printf "Lisp type %d", $type 1200 printf "Lisp type %d", $type
@@ -1245,20 +1210,36 @@ document xbacktrace
1245 an error was signaled. 1210 an error was signaled.
1246end 1211end
1247 1212
1248define which 1213define xprintbytestr
1249 set debug_print (which_symbols ($arg0)) 1214 set $data = (char *) $arg0->data
1215 printf "Bytecode: "
1216 output/u ($arg0->size > 1000) ? 0 : ($data[0])@($arg0->size_byte < 0 ? $arg0->size & ~gdb_array_mark_flag : $arg0->size_byte)
1217end
1218document xprintbytestr
1219 Print a string of byte code.
1220end
1221
1222define xwhichsymbols
1223 set $output_debug = print_output_debug_flag
1224 set print_output_debug_flag = 0
1225 set safe_debug_print (which_symbols ($arg0, $arg1))
1226 set print_output_debug_flag = $output_debug
1250end 1227end
1251document which 1228document xwhichsymbols
1252 Print symbols which references a given lisp object 1229 Print symbols which references a given lisp object
1253 either as its symbol value or symbol function. 1230 either as its symbol value or symbol function.
1231 Call with two arguments: the lisp object and the
1232 maximum number of symbols referencing it to produce.
1254end 1233end
1255 1234
1256define xbytecode 1235define xbytecode
1257 set $bt = byte_stack_list 1236 set $bt = byte_stack_list
1258 while $bt 1237 while $bt
1259 xgettype ($bt->byte_string) 1238 xgetptr $bt->byte_string
1260 printf "0x%x => ", $bt->byte_string 1239 set $ptr = (struct Lisp_String *) $ptr
1261 which $bt->byte_string 1240 xprintbytestr $ptr
1241 printf "\n0x%x => ", $bt->byte_string
1242 xwhichsymbols $bt->byte_string 5
1262 set $bt = $bt->next 1243 set $bt = $bt->next
1263 end 1244 end
1264end 1245end
@@ -1278,7 +1259,9 @@ end
1278 1259
1279define xreload 1260define xreload
1280 set $tagmask = (((long)1 << gdb_gctypebits) - 1) 1261 set $tagmask = (((long)1 << gdb_gctypebits) - 1)
1281 set $valmask = gdb_use_lsb ? ~($tagmask) : ((long)1 << gdb_valbits) - 1 1262 # The consing_since_gc business widens the 1 to EMACS_INT,
1263 # a symbol not directly visible to GDB.
1264 set $valmask = gdb_use_lsb ? ~($tagmask) : ((consing_since_gc - consing_since_gc + 1) << gdb_valbits) - 1
1282end 1265end
1283document xreload 1266document xreload
1284 When starting Emacs a second time in the same gdb session under 1267 When starting Emacs a second time in the same gdb session under