# emacs-buffer.gdb --- gdb macros for recovering buffers from emacs coredumps
-# Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+# Copyright (C) 2005-2012 Free Software Foundation, Inc.
# Maintainer: Noah Friedman <friedman@splode.com>
-# Status: Works with Emacs 22.0.51.1 (prerelease) as of 2006-01-12.
-# Older cvs snapshots, and released versions, will not work due to
-# changes in lisp data structures. But there are older versions of
-# this gdb script which work with those versions.
# Created: 2005-04-28
# This file is part of GNU Emacs.
-#
-# GNU Emacs is free software; you can redistribute it and/or modify
+
+# GNU Emacs is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
# GNU Emacs is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# 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/>.
# Commentary:
# `ysave-buffer', and `ybuffer-contents'. The `y' prefix avoids any
# namespace collisions with emacs/src/.gdbinit.
+# Since the internal data structures in Emacs occasionally from time to
+# time, you should use the version of this file that came with your
+# particular Emacs version; older versions might not work anymore.
+
# Example usage:
#
# $ gdb /export/src/emacs/2005-05-02--03-17/src/emacs core.emacs.6.9845
set $yfile_buffers_only = 0
set $tagmask = (((long)1 << gdb_gctypebits) - 1)
-set $valmask = gdb_use_lsb ? ~($tagmask) : ((long)1 << gdb_valbits) - 1
+# The consing_since_gc business widens the 1 to EMACS_INT,
+# a symbol not directly visible to GDB.
+set $valmask = gdb_use_lsb ? ~($tagmask) : ((consing_since_gc - consing_since_gc + 1) << gdb_valbits) - 1
define ygetptr
set $ptr = $arg0
ygetptr $buf
set $buf = (struct buffer *) $ptr
- if ! ($files_only && $buf->filename == Qnil)
- ygetptr $buf->name
+ if ! ($files_only && $buf->filename_ == Qnil)
+ ygetptr $buf->name_
set $name = ((struct Lisp_String *) $ptr)->data
set $modp = ($buf->text->modiff > $buf->text->save_modiff) ? '*' : ' '
- ygetptr $buf->mode_name
+ ygetptr $buf->mode_name_
set $mode = ((struct Lisp_String *) $ptr)->data
- if $buf->filename != Qnil
- ygetptr $buf->filename
+ if $buf->filename_ != Qnil
+ ygetptr $buf->filename_
printf "%2d %c %9d %-20s %-10s %s\n", \
$i, $modp, ($buf->text->z_byte - 1), $name, $mode, \
((struct Lisp_String *) $ptr)->data
end
define yget-current-buffer-name
- set $this = $ycurrent_buffer->name
+ set $this = $ycurrent_buffer->name_
ygetptr $this
set $ycurrent_buffer_name = ((struct Lisp_String *) $ptr)->data
end
# local variables:
# mode: gdb-script
# end:
-
-# arch-tag: 02087f62-2663-4868-977a-1fbb2fc2e7ef