]> code.delx.au - gnu-emacs/blobdiff - src/.gdbinit
Update copyright year to 2015
[gnu-emacs] / src / .gdbinit
index fa580cc99bfd3fa2f9892beba1d5e19998de117d..ea65ad6b4d5d034552b415d882556b874ff92d49 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 1992-1998, 2000-201 Free Software Foundation, Inc.
+# Copyright (C) 1992-1998, 2000-2015 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
@@ -13,9 +13,7 @@
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with GNU Emacs; see the file COPYING.  If not, write to the
-# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
+# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 # Force loading of symbols, enough to give us VALBITS etc.
 set $dummy = main + 8
@@ -69,7 +67,7 @@ define xgettype
   else
     set $bugfix = $arg0
   end
-  set $type = (enum Lisp_Type) (USE_LSB_TAG ? $bugfix & (1 << GCTYPEBITS) - 1 : $bugfix >> VALBITS)
+  set $type = (enum Lisp_Type) (USE_LSB_TAG ? $bugfix & (1 << GCTYPEBITS) - 1 : (EMACS_UINT) $bugfix >> VALBITS)
 end
 
 # Set up something to print out s-expressions.
@@ -360,7 +358,6 @@ end
 
 define pwinx
   set $w = $arg0
-  xgetint $w->sequence_number
   if ($w->mini_p != Qnil)
     printf "Mini "
   end
@@ -495,7 +492,8 @@ define pgx
   end
   xgettype ($g.object)
   if ($type == Lisp_String)
-    printf " str=%x[%d]", $g.object, $g.charpos
+    xgetptr $g.object
+    printf " str=0x%x[%d]", ((struct Lisp_String *)$ptr)->data, $g.charpos
   else
     printf " pos=%d", $g.charpos
   end
@@ -608,7 +606,7 @@ 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
+  printf "edges=(%d,%d),enb=%d,r2l=%d,cont=%d,trunc=(%d,%d),at_zv=%d\n", $arg0->minpos.charpos, $arg0->maxpos.charpos, $arg0->enabled_p, $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.
@@ -822,15 +820,7 @@ define xwindow
   xgetptr $
   print (struct window *) $ptr
   set $window = (struct window *) $ptr
-  xgetint $window->total_cols
-  set $width=$int
-  xgetint $window->total_lines
-  set $height=$int
-  xgetint $window->left_col
-  set $left=$int
-  xgetint $window->top_line
-  set $top=$int
-  printf "%dx%d+%d+%d\n", $width, $height, $left, $top
+  printf "%dx%d+%d+%d\n", $window->total_cols, $window->total_lines, $window->left_col, $window->top_line
 end
 document xwindow
 Print $ as a window pointer, assuming it is an Emacs Lisp window value.
@@ -1074,7 +1064,13 @@ end
 
 define xprintstr
   set $data = (char *) $arg0->data
-  output ($arg0->size > 1000) ? 0 : ($data[0])@($arg0->size_byte < 0 ? $arg0->size & ~ARRAY_MARK_FLAG : $arg0->size_byte)
+  set $strsize = ($arg0->size_byte < 0) ? ($arg0->size & ~ARRAY_MARK_FLAG) : $arg0->size_byte
+  # GDB doesn't like zero repetition counts
+  if $strsize == 0
+    output ""
+  else
+    output ($arg0->size > 1000) ? 0 : ($data[0])@($strsize)
+  end
 end
 
 define xprintsym
@@ -1152,17 +1148,18 @@ Print $ assuming it is a list font (font-spec, font-entity, or font-object).
 end
 
 define xbacktrace
-  set $bt = backtrace_list
-  while $bt
-    xgettype ($bt->function)
+  set $bt = backtrace_top ()
+  while backtrace_p ($bt)
+    set $fun = backtrace_function ($bt)
+    xgettype $fun
     if $type == Lisp_Symbol
-      xprintsym ($bt->function)
-      printf " (0x%x)\n", $bt->args
+      xprintsym $fun
+      printf " (0x%x)\n", backtrace_args ($bt)
     else
-      xgetptr $bt->function
+      xgetptr $fun
       printf "0x%x ", $ptr
       if $type == Lisp_Vectorlike
-       xgetptr ($bt->function)
+       xgetptr $fun
         set $size = ((struct Lisp_Vector *) $ptr)->header.size
         if ($size & PSEUDOVECTOR_FLAG)
          output (enum pvec_type) (($size & PVEC_TYPE_MASK) >> PSEUDOVECTOR_AREA_BITS)
@@ -1174,7 +1171,7 @@ define xbacktrace
       end
       echo \n
     end
-    set $bt = $bt->next
+    set $bt = backtrace_next ($bt)
   end
 end
 document xbacktrace
@@ -1185,8 +1182,13 @@ end
 
 define xprintbytestr
   set $data = (char *) $arg0->data
+  set $bstrsize = ($arg0->size_byte < 0) ? ($arg0->size & ~ARRAY_MARK_FLAG) : $arg0->size_byte
   printf "Bytecode: "
-  output/u ($arg0->size > 1000) ? 0 : ($data[0])@($arg0->size_byte < 0 ? $arg0->size & ~ARRAY_MARK_FLAG : $arg0->size_byte)
+  if $bstrsize > 0
+    output/u ($arg0->size > 1000) ? 0 : ($data[0])@($bvsize)
+  else
+    printf ""
+  end
 end
 document xprintbytestr
   Print a string of byte code.
@@ -1222,8 +1224,8 @@ end
 
 # Show Lisp backtrace after normal backtrace.
 define hookpost-backtrace
-  set $bt = backtrace_list
-  if $bt
+  set $bt = backtrace_top ()
+  if backtrace_p ($bt)
     echo \n
     echo Lisp Backtrace:\n
     xbacktrace