-# Copyright (C) 1992-1998, 2000-2011 Free Software Foundation, Inc.
+# Copyright (C) 1992-1998, 2000-2013 Free Software Foundation, Inc.
#
# This file is part of GNU Emacs.
#
# 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 gdb_valbits etc.
-set main
+# Force loading of symbols, enough to give us VALBITS etc.
+set $dummy = main + 8
# With some compilers, we need this to give us struct Lisp_Symbol etc.:
-set Fmake_symbol
+set $dummy = Fmake_symbol + 8
# Find lwlib source files too.
dir ../lwlib
# debugging.
handle SIGALRM ignore
-# $valmask and $tagmask are mask values set up by the xreload macro below.
-
# Use $bugfix so that the value isn't a constant.
# Using a constant runs into GDB bugs sometimes.
define xgetptr
- set $bugfix = $arg0
- set $ptr = (gdb_use_union ? (gdb_use_lsb ? $bugfix.u.val << gdb_gctypebits : $bugfix.u.val) : $bugfix & $valmask) | gdb_data_seg_bits
+ if (CHECK_LISP_OBJECT_TYPE)
+ set $bugfix = $arg0.i
+ else
+ set $bugfix = $arg0
+ end
+ set $ptr = ($bugfix & VALMASK) | DATA_SEG_BITS
end
define xgetint
- set $bugfix = $arg0
- set $int = gdb_use_union ? $bugfix.s.val : (gdb_use_lsb ? $bugfix : $bugfix << gdb_gctypebits) >> gdb_gctypebits
+ if (CHECK_LISP_OBJECT_TYPE)
+ set $bugfix = $arg0.i
+ else
+ set $bugfix = $arg0
+ end
+ set $int = $bugfix << (USE_LSB_TAG ? 0 : INTTYPEBITS) >> INTTYPEBITS
end
define xgettype
- set $bugfix = $arg0
- set $type = gdb_use_union ? $bugfix.s.type : (enum Lisp_Type) (gdb_use_lsb ? $bugfix & $tagmask : $bugfix >> gdb_valbits)
+ if (CHECK_LISP_OBJECT_TYPE)
+ set $bugfix = $arg0.i
+ else
+ set $bugfix = $arg0
+ end
+ set $type = (enum Lisp_Type) (USE_LSB_TAG ? $bugfix & (1 << GCTYPEBITS) - 1 : $bugfix >> VALBITS)
end
# Set up something to print out s-expressions.
# from calling OutputDebugString, which causes GDB to display each
# character twice (yuk!).
define pr
- set $output_debug = print_output_debug_flag
- set print_output_debug_flag = 0
- set debug_print ($)
- set print_output_debug_flag = $output_debug
+ pp $
end
document pr
Print the emacs s-expression which is $.
set $tmp = $arg0
set $output_debug = print_output_debug_flag
set print_output_debug_flag = 0
- set safe_debug_print ($tmp)
+ call safe_debug_print ($tmp)
set print_output_debug_flag = $output_debug
end
document pp
Works only when an inferior emacs is executing.
end
-# Print out s-expressions from tool bar
-define pp1
- set $tmp = $arg0
- set $output_debug = print_output_debug_flag
- set print_output_debug_flag = 0
- set safe_debug_print ($tmp)
- set print_output_debug_flag = $output_debug
-end
-document pp1
-Print the argument as an emacs s-expression.
-Works only when an inferior emacs is executing.
-For use on tool bar when debugging in Emacs
-where the variable name would not otherwise
-be recorded in the GUD buffer.
-end
-
# Print value of lisp variable
define pv
set $tmp = "$arg0"
set $output_debug = print_output_debug_flag
set print_output_debug_flag = 0
- set safe_debug_print ( find_symbol_value (intern ($tmp)))
+ call safe_debug_print (find_symbol_value (intern ($tmp)))
set print_output_debug_flag = $output_debug
end
document pv
Works only when an inferior emacs is executing.
end
-# Print value of lisp variable
-define pv1
- set $tmp = "$arg0"
- set $output_debug = print_output_debug_flag
- set print_output_debug_flag = 0
- set safe_debug_print (find_symbol_value (intern ($tmp)))
- set print_output_debug_flag = $output_debug
-end
-document pv1
-Print the value of the lisp variable given as argument.
-Works only when an inferior emacs is executing.
-For use when debugging in Emacs where the variable
-name would not otherwise be recorded in the GUD buffer.
-end
-
# Print out current buffer point and boundaries
define ppt
set $b = current_buffer
while ($i < $it->sp && $i < 4)
set $e = $it->stack[$i]
printf "stack[%d]: ", $i
- pitmethod $e->method
- printf "[%d]", $e->position.charpos
+ pitmethod $e.method
+ printf "[%d]", $e.position.charpos
printf "\n"
set $i = $i + 1
end
printf "y=%d x=%d pwid=%d", $row->y, $row->x, $row->pixel_width
printf " a+d=%d+%d=%d", $row->ascent, $row->height-$row->ascent, $row->height
printf " phys=%d+%d=%d", $row->phys_ascent, $row->phys_height-$row->phys_ascent, $row->phys_height
- printf " vis=%d", $row->visible_height
- printf " L=%d T=%d R=%d", $row->used[0], $row->used[1], $row->used[2]
- printf "\n"
+ printf " vis=%d\n", $row->visible_height
+ printf "used=(LMargin=%d,Text=%d,RMargin=%d) Hash=%d\n", $row->used[0], $row->used[1], $row->used[2], $row->hash
printf "start=%d end=%d", $row->start.pos.charpos, $row->end.pos.charpos
if ($row->enabled_p)
printf " ENA"
define pgx
set $g = $arg0
# CHAR_GLYPH
- if ($g->type == 0)
- if ($g->u.ch >= ' ' && $g->u.ch < 127)
- printf "CHAR[%c]", $g->u.ch
+ 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
+ printf "CHAR[0x%x]", $g.u.ch
end
end
# COMPOSITE_GLYPH
- if ($g->type == 1)
- printf "COMP[%d (%d..%d)]", $g->u.cmp.id, $g->slice.cmp.from, $g->slice.cmp.to
+ if ($g.type == 1)
+ printf "COMP[%d (%d..%d)]", $g.u.cmp.id, $g.slice.cmp.from, $g.slice.cmp.to
end
# GLYPHLESS_GLYPH
- if ($g->type == 2)
+ if ($g.type == 2)
printf "GLYPHLESS["
- if ($g->u.glyphless.method == 0)
+ if ($g.u.glyphless.method == 0)
printf "THIN]"
end
- if ($g->u.glyphless.method == 1)
+ if ($g.u.glyphless.method == 1)
printf "EMPTY]"
end
- if ($g->u.glyphless.method == 2)
+ if ($g.u.glyphless.method == 2)
printf "ACRO]"
end
- if ($g->u.glyphless.method == 3)
+ if ($g.u.glyphless.method == 3)
printf "HEX]"
end
end
# IMAGE_GLYPH
- if ($g->type == 3)
- printf "IMAGE[%d]", $g->u.img_id
+ if ($g.type == 3)
+ printf "IMAGE[%d]", $g.u.img_id
end
# STRETCH_GLYPH
- if ($g->type == 4)
- printf "STRETCH[%d+%d]", $g->u.stretch.height, $g->u.stretch.ascent
+ if ($g.type == 4)
+ printf "STRETCH[%d+%d]", $g.u.stretch.height, $g.u.stretch.ascent
end
- xgettype ($g->object)
+ 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
+ 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
+ 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
+ printf " w=%d a+d=%d+%d", $g.pixel_width, $g.ascent, $g.descent
# If not DEFAULT_FACE_ID
- if ($g->face_id != 0)
- printf " face=%d", $g->face_id
+ if ($g.face_id != 0)
+ printf " face=%d", $g.face_id
end
- if ($g->voffset)
- printf " vof=%d", $g->voffset
+ if ($g.voffset)
+ printf " vof=%d", $g.voffset
end
- if ($g->multibyte_p)
+ if ($g.multibyte_p)
printf " MB"
end
- if ($g->padding_p)
+ if ($g.padding_p)
printf " PAD"
end
- if ($g->glyph_not_available_p)
+ if ($g.glyph_not_available_p)
printf " N/A"
end
- if ($g->overlaps_vertically_p)
+ if ($g.overlaps_vertically_p)
printf " OVL"
end
- if ($g->avoid_cursor_p)
+ if ($g.avoid_cursor_p)
printf " AVOID"
end
- if ($g->left_box_line_p)
+ if ($g.left_box_line_p)
printf " ["
end
- if ($g->right_box_line_p)
+ if ($g.right_box_line_p)
printf " ]"
end
- if ($g->slice.img.x || $g->slice.img.y || $g->slice.img.width || $g->slice.img.height)
- printf " slice=%d,%d,%d,%d" ,$g->slice.img.x, $g->slice.img.y, $g->slice.img.width, $g->slice.img.height
+ if ($g.slice.img.x || $g.slice.img.y || $g.slice.img.width || $g.slice.img.height)
+ printf " slice=%d,%d,%d,%d" ,$g.slice.img.x, $g.slice.img.y, $g.slice.img.width, $g.slice.img.height
end
printf "\n"
end
define xvectype
xgetptr $
- set $size = ((struct Lisp_Vector *) $ptr)->size
- output ($size & PVEC_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size & ~gdb_array_mark_flag
+ set $size = ((struct Lisp_Vector *) $ptr)->header.size
+ if ($size & PSEUDOVECTOR_FLAG)
+ output (enum pvec_type) (($size & PVEC_TYPE_MASK) >> PSEUDOVECTOR_SIZE_BITS)
+ else
+ output $size & ~ARRAY_MARK_FLAG
+ end
echo \n
end
document xvectype
This command assumes that $ is an Emacs Lisp Misc value.
end
-define xintfwd
- xgetptr $
- print (struct Lisp_Intfwd *) $ptr
-end
-document xintfwd
-Print $ as an integer forwarding pointer.
-This command assumes that $ is an Emacs Lisp Misc value.
-end
-
-define xboolfwd
- xgetptr $
- print (struct Lisp_Boolfwd *) $ptr
-end
-document xboolfwd
-Print $ as a boolean forwarding pointer.
-This command assumes that $ is an Emacs Lisp Misc value.
-end
-
-define xobjfwd
- xgetptr $
- print (struct Lisp_Objfwd *) $ptr
-end
-document xobjfwd
-Print $ as an object forwarding pointer.
-This command assumes that $ is an Emacs Lisp Misc value.
-end
-
-define xbufobjfwd
- xgetptr $
- print (struct Lisp_Buffer_Objfwd *) $ptr
-end
-document xbufobjfwd
-Print $ as a buffer-local object forwarding pointer.
-This command assumes that $ is an Emacs Lisp Misc value.
-end
-
-define xkbobjfwd
- xgetptr $
- print (struct Lisp_Kboard_Objfwd *) $ptr
-end
-document xkbobjfwd
-Print $ as a kboard-local object forwarding pointer.
-This command assumes that $ is an Emacs Lisp Misc value.
-end
-
-define xbuflocal
- xgetptr $
- print (struct Lisp_Buffer_Local_Value *) $ptr
-end
-document xbuflocal
-Print $ as a buffer-local-value pointer.
-This command assumes that $ is an Emacs Lisp Misc value.
-end
-
define xsymbol
set $sym = $
xgetptr $sym
define xvector
xgetptr $
print (struct Lisp_Vector *) $ptr
- output ($->size > 50) ? 0 : ($->contents[0])@($->size & ~gdb_array_mark_flag)
+ output ($->header.size > 50) ? 0 : ($->contents[0])@($->header.size & ~ARRAY_MARK_FLAG)
echo \n
end
document xvector
define xcompiled
xgetptr $
print (struct Lisp_Vector *) $ptr
- output ($->contents[0])@($->size & 0xff)
+ output ($->contents[0])@($->header.size & 0xff)
end
document xcompiled
Print $ as a compiled function pointer.
print (struct Lisp_Char_Table *) $ptr
printf "Purpose: "
xprintsym $->purpose
- printf " %d extra slots", ($->size & 0x1ff) - 68
+ printf " %d extra slots", ($->header.size & 0x1ff) - 68
echo \n
end
document xchartable
define xboolvector
xgetptr $
print (struct Lisp_Bool_Vector *) $ptr
- output ($->size > 256) ? 0 : ($->data[0])@((($->size & ~gdb_array_mark_flag) + 7)/ 8)
+ output ($->size > 256) ? 0 : ($->data[0])@(($->size + BOOL_VECTOR_BITS_PER_CHAR - 1)/ BOOL_VECTOR_BITS_PER_CHAR)
echo \n
end
document xboolvector
define xpr
xtype
- if $type == Lisp_Int
+ if $type == Lisp_Int0 || $type == Lisp_Int1
xint
end
if $type == Lisp_Symbol
if $misc == Lisp_Misc_Free
xmiscfree
end
- if $misc == Lisp_Misc_Boolfwd
- xboolfwd
- end
if $misc == Lisp_Misc_Marker
xmarker
end
- if $misc == Lisp_Misc_Intfwd
- xintfwd
- end
- if $misc == Lisp_Misc_Boolfwd
- xboolfwd
- end
- if $misc == Lisp_Misc_Objfwd
- xobjfwd
- end
- if $misc == Lisp_Misc_Buffer_Objfwd
- xbufobjfwd
- end
- if $misc == Lisp_Misc_Buffer_Local_Value
- xbuflocal
- end
-# if $misc == Lisp_Misc_Some_Buffer_Local_Value
-# xvalue
-# end
if $misc == Lisp_Misc_Overlay
xoverlay
end
- if $misc == Lisp_Misc_Kboard_Objfwd
- xkbobjfwd
- end
# if $misc == Lisp_Misc_Save_Value
# xsavevalue
# end
end
if $type == Lisp_Vectorlike
- set $size = ((struct Lisp_Vector *) $ptr)->size
- if ($size & PVEC_FLAG)
- set $vec = (enum pvec_type) ($size & PVEC_TYPE_MASK)
+ set $size = ((struct Lisp_Vector *) $ptr)->header.size
+ if ($size & PSEUDOVECTOR_FLAG)
+ set $vec = (enum pvec_type) (($size & PVEC_TYPE_MASK) >> PSEUDOVECTOR_SIZE_BITS)
if $vec == PVEC_NORMAL_VECTOR
xvector
end
define xprintstr
set $data = (char *) $arg0->data
- output ($arg0->size > 1000) ? 0 : ($data[0])@($arg0->size_byte < 0 ? $arg0->size & ~gdb_array_mark_flag : $arg0->size_byte)
+ output ($arg0->size > 1000) ? 0 : ($data[0])@($arg0->size_byte < 0 ? $arg0->size & ~ARRAY_MARK_FLAG : $arg0->size_byte)
end
define xprintsym
xgetptr $arg0
set $sym = (struct Lisp_Symbol *) $ptr
- xgetptr $sym->xname
+ xgetptr $sym->name
set $sym_name = (struct Lisp_String *) $ptr
xprintstr $sym_name
end
end
define xcoding
- set $tmp = (struct Lisp_Hash_Table *) ((Vcoding_system_hash_table & $valmask) | gdb_data_seg_bits)
- set $tmp = (struct Lisp_Vector *) (($tmp->key_and_value & $valmask) | gdb_data_seg_bits)
+ set $tmp = (struct Lisp_Hash_Table *) ((Vcoding_system_hash_table & VALMASK) | DATA_SEG_BITS)
+ set $tmp = (struct Lisp_Vector *) (($tmp->key_and_value & VALMASK) | DATA_SEG_BITS)
set $name = $tmp->contents[$arg0 * 2]
print $name
pr
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)
+ set $tmp = (struct Lisp_Hash_Table *) ((Vcharset_hash_table & VALMASK) | DATA_SEG_BITS)
+ set $tmp = (struct Lisp_Vector *) (($tmp->key_and_value & VALMASK) | DATA_SEG_BITS)
p $tmp->contents[charset_table[$arg0].hash_index * 2]
pr
end
define xfont
xgetptr $
- set $size = (((struct Lisp_Vector *) $ptr)->size & 0x1FF)
+ set $size = (((struct Lisp_Vector *) $ptr)->header.size & 0x1FF)
if $size == FONT_SPEC_MAX
print (struct font_spec *) $ptr
else
define xbacktrace
set $bt = backtrace_list
while $bt
- xgettype (*$bt->function)
+ xgettype ($bt->function)
if $type == Lisp_Symbol
- xprintsym (*$bt->function)
+ xprintsym ($bt->function)
printf " (0x%x)\n", $bt->args
else
- xgetptr *$bt->function
+ xgetptr $bt->function
printf "0x%x ", $ptr
if $type == Lisp_Vectorlike
- xgetptr (*$bt->function)
- set $size = ((struct Lisp_Vector *) $ptr)->size
- output ($size & PVEC_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size & ~gdb_array_mark_flag
+ xgetptr ($bt->function)
+ set $size = ((struct Lisp_Vector *) $ptr)->header.size
+ if ($size & PSEUDOVECTOR_FLAG)
+ output (enum pvec_type) (($size & PVEC_TYPE_MASK) >> PSEUDOVECTOR_SIZE_BITS)
+ else
+ output $size & ~ARRAY_MARK_FLAG
+ end
else
printf "Lisp type %d", $type
end
an error was signaled.
end
-define which
- set debug_print (which_symbols ($arg0))
+define xprintbytestr
+ set $data = (char *) $arg0->data
+ printf "Bytecode: "
+ output/u ($arg0->size > 1000) ? 0 : ($data[0])@($arg0->size_byte < 0 ? $arg0->size & ~ARRAY_MARK_FLAG : $arg0->size_byte)
+end
+document xprintbytestr
+ Print a string of byte code.
end
-document which
+
+define xwhichsymbols
+ set $output_debug = print_output_debug_flag
+ set print_output_debug_flag = 0
+ call safe_debug_print (which_symbols ($arg0, $arg1))
+ set print_output_debug_flag = $output_debug
+end
+document xwhichsymbols
Print symbols which references a given lisp object
either as its symbol value or symbol function.
+ Call with two arguments: the lisp object and the
+ maximum number of symbols referencing it to produce.
end
define xbytecode
set $bt = byte_stack_list
while $bt
- xgettype ($bt->byte_string)
- printf "0x%x => ", $bt->byte_string
- which $bt->byte_string
+ xgetptr $bt->byte_string
+ set $ptr = (struct Lisp_String *) $ptr
+ xprintbytestr $ptr
+ printf "\n0x%x => ", $bt->byte_string
+ xwhichsymbols $bt->byte_string 5
set $bt = $bt->next
end
end
end
end
-define xreload
- set $tagmask = (((long)1 << gdb_gctypebits) - 1)
- set $valmask = gdb_use_lsb ? ~($tagmask) : ((long)1 << gdb_valbits) - 1
-end
-document xreload
- When starting Emacs a second time in the same gdb session under
- FreeBSD 2.2.5, gdb 4.13, $valmask have lost
- their values. (The same happens on current (2000) versions of GNU/Linux
- with gdb 5.0.)
- This function reloads them.
-end
-xreload
-
# Flush display (X only)
define ff
set x_flush (0)
end
-define hook-run
- xreload
-end
-
-# Call xreload if a new Emacs executable is loaded.
-define hookpost-run
- xreload
-end
-
set print pretty on
set print sevenbit-strings
show environment DISPLAY
show environment TERM
-# People get bothered when they see messages about non-existent functions...
-xgetptr globals.f_Vsystem_type
-# $ptr is NULL in temacs
-if ($ptr != 0)
- set $tem = (struct Lisp_Symbol *) $ptr
- xgetptr $tem->xname
- set $tem = (struct Lisp_String *) $ptr
- set $tem = (char *) $tem->data
-
- # Don't let abort actually run, as it will make stdio stop working and
- # therefore the `pr' command above as well.
- if $tem[0] == 'w' && $tem[1] == 'i' && $tem[2] == 'n' && $tem[3] == 'd'
- # The windows-nt build replaces abort with its own function.
- break w32_abort
- else
- break abort
- end
-end
+# When debugging, it is handy to be able to "return" from
+# terminate_due_to_signal when an assertion failure is non-fatal.
+break terminate_due_to_signal
# x_error_quitter is defined only on X. But window-system is set up
# only at run time, during Emacs startup, so we need to defer setting
silent
xgetptr globals.f_Vinitial_window_system
set $tem = (struct Lisp_Symbol *) $ptr
- xgetptr $tem->xname
+ xgetptr $tem->name
set $tem = (struct Lisp_String *) $ptr
set $tem = (char *) $tem->data
# If we are running in synchronous mode, we want a chance to look