Fix compilation of xmenu.c and unexcoff.c, clean up MSDOS source files.
[bpt/emacs.git] / src / .gdbinit
index 2242df6..b3bb6b5 100644 (file)
@@ -1,5 +1,5 @@
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001,
-#   2002, 2003, 2004, 2005, 2006, 2007, 2008
+#   2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
 #   Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
@@ -21,6 +21,8 @@
 
 # Force loading of symbols, enough to give us gdb_valbits etc.
 set main
+# With some compilers, we need this to give us struct Lisp_Symbol etc.:
+set Fmake_symbol
 
 # Find lwlib source files too.
 dir ../lwlib
@@ -163,6 +165,35 @@ Print current buffer's point and boundaries.
 Prints values of point, beg, end, narrow, and gap for current buffer.
 end
 
+define pitmethod
+  set $itmethod = $arg0
+  # output $itmethod
+  if ($itmethod == 0)
+    printf "GET_FROM_BUFFER"
+  end
+  if ($itmethod == 1)
+    printf "GET_FROM_DISPLAY_VECTOR"
+  end
+  if ($itmethod == 2)
+    printf "GET_FROM_STRING"
+  end
+  if ($itmethod == 3)
+    printf "GET_FROM_C_STRING"
+  end
+  if ($itmethod == 4)
+    printf "GET_FROM_IMAGE"
+  end
+  if ($itmethod == 5)
+    printf "GET_FROM_STRETCH"
+  end
+  if ($itmethod < 0 || $itmethod > 5)
+    output $itmethod
+  end
+end
+document pitmethod
+Pretty print it->method given as first arg
+end
+
 # Print out iterator given as first arg
 define pitx
   set $it = $arg0
@@ -193,7 +224,8 @@ define pitx
   if ($it->sp != 0)
     printf " sp=%d", $it->sp
   end
-  if ($it->what == IT_CHARACTER)
+  # IT_CHARACTER
+  if ($it->what == 0)
     if ($it->len == 1 && $it->c >= ' ' && it->c < 255)
       printf " ch='%c'", $it->c
     else
@@ -201,22 +233,49 @@ define pitx
     end
   else
     printf " "
-    output $it->what
+    # output $it->what
+    if ($it->what == 0)
+      printf "IT_CHARACTER"
+    end
+    if ($it->what == 1)
+      printf "IT_COMPOSITION"
+    end
+    if ($it->what == 2)
+      printf "IT_IMAGE"
+    end
+    if ($it->what == 3)
+      printf "IT_STRETCH"
+    end
+    if ($it->what == 4)
+      printf "IT_EOB"
+    end
+    if ($it->what == 5)
+      printf "IT_TRUNCATION"
+    end
+    if ($it->what == 6)
+      printf "IT_CONTINUATION"
+    end
+    if ($it->what < 0 || $it->what > 6)
+      output $it->what
+    end
   end
-  if ($it->method != GET_FROM_BUFFER)
+  if ($it->method != 0)
+    # !GET_FROM_BUFFER
     printf " next="
-    output $it->method
-    if ($it->method == GET_FROM_STRING)
+    pitmethod $it->method
+    if ($it->method == 2)
+      # GET_FROM_STRING
       printf "[%d]", $it->current.string_pos.charpos
     end
-    if ($it->method == GET_FROM_IMAGE)
+    if ($it->method == 4)
+      # GET_FROM_IMAGE
       printf "[%d]", $it->image_id
     end
-    if ($it->method == GET_FROM_COMPOSITION)
-      printf "[%d,%d,%d]", $it->cmp_id, $it->len, $it->cmp_len
-    end
   end
   printf "\n"
+  if ($it->bidi_p)
+    printf "BIDI: base_stop=%d prev_stop=%d level=%d\n", $it->base_level_stop, $it->prev_stop, $it->bidi_it.resolved_level
+  end
   if ($it->region_beg_charpos >= 0)
     printf "reg=%d-%d ", $it->region_beg_charpos, $it->region_end_charpos
   end
@@ -231,7 +290,7 @@ define pitx
   while ($i < $it->sp && $i < 4)
     set $e = $it->stack[$i]
     printf "stack[%d]: ", $i
-    output $e->method
+    pitmethod $e->method
     printf "[%d]", $e->position.charpos
     printf "\n"
     set $i = $i + 1
@@ -393,22 +452,56 @@ document pwin
 Pretty print window structure w.
 end
 
+define pbiditype
+  if ($arg0 == 0)
+    printf "UNDEF"
+  end
+  if ($arg0 == 1)
+    printf "L"
+  end
+  if ($arg0 == 2)
+    printf "R"
+  end
+  if ($arg0 == 3)
+    printf "EN"
+  end
+  if ($arg0 == 4)
+    printf "AN"
+  end
+  if ($arg0 == 5)
+    printf "BN"
+  end
+  if ($arg0 == 6)
+    printf "B"
+  end
+  if ($arg0 < 0 || $arg0 > 6)
+    printf "%d??", $arg0
+  end
+end
+document pbiditype
+Print textual description of bidi type given as first argument.
+end
+
 define pgx
   set $g = $arg0
-  if ($g->type == CHAR_GLYPH)
+  # CHAR_GLYPH
+  if ($g->type == 0)
     if ($g->u.ch >= ' ' && $g->u.ch < 127)
       printf "CHAR[%c]", $g->u.ch
     else
       printf "CHAR[0x%x]", $g->u.ch
     end
   end
-  if ($g->type == COMPOSITE_GLYPH)
-    printf "COMP[%d]", $g->u.cmp_id
+  # COMPOSITE_GLYPH
+  if ($g->type == 1)
+    printf "COMP[%d (%d..%d)]", $g->u.cmp.id, $g->u.cmp.from, $g->u.cmp.to
   end
-  if ($g->type == IMAGE_GLYPH)
+  # IMAGE_GLYPH
+  if ($g->type == 2)
     printf "IMAGE[%d]", $g->u.img_id
   end
-  if ($g->type == STRETCH_GLYPH)
+  # STRETCH_GLYPH
+  if ($g->type == 3)
     printf "STRETCH[%d+%d]", $g->u.stretch.height, $g->u.stretch.ascent
   end
   xgettype ($g->object)
@@ -417,8 +510,14 @@ define pgx
   else
     printf " pos=%d", $g->charpos
   end
+  # For characters, print their resolved level and bidi type
+  if ($g->type == 0)
+    printf " blev=%d,btyp=", $g->resolved_level
+    pbiditype $g->bidi_type
+  end
   printf " w=%d a+d=%d+%d", $g->pixel_width, $g->ascent, $g->descent
-  if ($g->face_id != DEFAULT_FACE_ID)
+  # If not DEFAULT_FACE_ID
+  if ($g->face_id != 0)
     printf " face=%d", $g->face_id
   end
   if ($g->voffset)
@@ -436,6 +535,9 @@ define pgx
   if ($g->overlaps_vertically_p)
     printf " OVL"
   end
+  if ($g->avoid_cursor_p)
+    printf " AVOID"
+  end
   if ($g->left_box_line_p)
     printf " ["
   end
@@ -509,6 +611,38 @@ document pgrow
 Pretty print all glyphs in row structure row.
 end
 
+define pgrowit
+  pgrowx it->glyph_row
+end
+document pgrowit
+Pretty print all glyphs in it->glyph_row.
+end
+
+define prowlims
+  printf "edges=(%d,%d),r2l=%d,cont=%d,trunc=(%d,%d),at_zv=%d\n", $arg0->minpos.charpos, $arg0->maxpos.charpos, $arg0->reversed_p, $arg0->continued_p, $arg0->truncated_on_left_p, $arg0->truncated_on_right_p, $arg0->ends_at_zv_p
+end
+document prowlims
+Print important attributes of a glyph_row structure.
+Takes one argument, a pointer to a glyph_row structure.
+end
+
+define pmtxrows
+  set $mtx = $arg0
+  set $gl = $mtx->rows
+  set $glend = $mtx->rows + $mtx->nrows - 1
+  set $i = 0
+  while ($gl < $glend)
+    printf "%d: ", $i
+    prowlims $gl
+    set $gl = $gl + 1
+    set $i = $i + 1
+  end
+end
+document pmtxrows
+Print data about glyph rows in a glyph matrix.
+Takes one argument, a pointer to a glyph_matrix structure.
+end
+
 define xtype
   xgettype $
   output $type
@@ -763,6 +897,19 @@ Print the address of the char-table $, and its purpose.
 This command assumes that $ is an Emacs Lisp char-table value.
 end
 
+define xsubchartable
+  xgetptr $
+  print (struct Lisp_Sub_Char_Table *) $ptr
+  xgetint $->depth
+  set $depth = $int
+  xgetint $->min_char
+  printf "Depth: %d, Min char: %d (0x%x)\n", $depth, $int, $int
+end
+document xsubchartable
+Print the address of the sub-char-table $, its depth and min-char.
+This command assumes that $ is an Emacs Lisp sub-char-table value.
+end
+
 define xboolvector
   xgetptr $
   print (struct Lisp_Bool_Vector *) $ptr
@@ -1009,7 +1156,7 @@ end
 define xcharset
   set $tmp = (struct Lisp_Hash_Table *) ((Vcharset_hash_table & $valmask) | gdb_data_seg_bits)
   set $tmp = (struct Lisp_Vector *) (($tmp->key_and_value & $valmask) | gdb_data_seg_bits)
-  p $tmp->contents[$arg0->hash_index * 2]
+  p $tmp->contents[charset_table[$arg0].hash_index * 2]
   pr
 end
 document xcharset
@@ -1039,6 +1186,23 @@ define xfontset
   echo \n
 end
 
+define xfont
+  xgetptr $
+  set $size = (((struct Lisp_Vector *) $ptr)->size & 0x1FF)
+  if $size == FONT_SPEC_MAX
+    print (struct font_spec *) $ptr
+  else
+    if $size == FONT_ENTITY_MAX
+      print (struct font_entity *) $ptr
+    else
+      print (struct font *) $ptr
+    end
+  end
+end
+document xfont
+Print $ assuming it is a list font (font-spec, font-entity, or font-object).
+end
+
 define xbacktrace
   set $bt = backtrace_list
   while $bt
@@ -1134,7 +1298,6 @@ set print sevenbit-strings
 
 show environment DISPLAY
 show environment TERM
-set args -geometry 80x40+0+0
 
 # People get bothered when they see messages about non-existent functions...
 xgetptr Vsystem_type