Commit 27eb668a authored by Eli Zaretskii's avatar Eli Zaretskii

Adapt GDB scripts to '--enable-check-lisp-object-type' builds

* etc/emacs-buffer.gdb <$qnil>: New variable.
(ybuffer-list, yset-buffer): Use $qnil for comparing against
'nil', as direct comparison with Qnil doesn't work in a build with
'--enable-check-lisp-object-type'.

* src/.gdbinit: Adapt commands of the temporary breakpoint in
init_sys_modes to a build with '--enable-check-lisp-object-type'.
parent dac64e35
...@@ -70,8 +70,10 @@ ...@@ -70,8 +70,10 @@
# Code: # Code:
# Force loading of symbols, enough to give us VALMASK etc. # Force loading of symbols, enough to give us VALBITS etc.
set main set $dummy = main + 8
# With some compilers, we need this to give us struct Lisp_Symbol etc.:
set $dummy = Fmake_symbol + 8
# When nonzero, display some extra diagnostics in various commands # When nonzero, display some extra diagnostics in various commands
set $yverbose = 1 set $yverbose = 1
...@@ -82,6 +84,11 @@ define ygetptr ...@@ -82,6 +84,11 @@ define ygetptr
set $ptr = (CHECK_LISP_OBJECT_TYPE ? $ptr.i : $ptr) & VALMASK set $ptr = (CHECK_LISP_OBJECT_TYPE ? $ptr.i : $ptr) & VALMASK
end end
# Get the value of Qnil for comparison. Needed when
# CHECK_LISP_OBJECT_TYPE is non-zero.
ygetptr Qnil
set $qnil = $ptr
define ybuffer-list define ybuffer-list
set $files_only = $yfile_buffers_only set $files_only = $yfile_buffers_only
set $yfile_buffers_only = 0 set $yfile_buffers_only = 0
...@@ -93,10 +100,13 @@ define ybuffer-list ...@@ -93,10 +100,13 @@ define ybuffer-list
set $i = 0 set $i = 0
set $alist = Vbuffer_alist set $alist = Vbuffer_alist
while $alist != Qnil ygetptr $alist
ygetptr $alist set $alist = $ptr
while $alist != $qnil
set $this = ((struct Lisp_Cons *) $ptr)->car set $this = ((struct Lisp_Cons *) $ptr)->car
set $alist = ((struct Lisp_Cons *) $ptr)->u.cdr set $alist = ((struct Lisp_Cons *) $ptr)->u.cdr
ygetptr $alist
set $alist = $ptr
# Vbuffer_alist elts are pairs of the form (name . buffer) # Vbuffer_alist elts are pairs of the form (name . buffer)
ygetptr $this ygetptr $this
...@@ -104,7 +114,9 @@ define ybuffer-list ...@@ -104,7 +114,9 @@ define ybuffer-list
ygetptr $buf ygetptr $buf
set $buf = (struct buffer *) $ptr set $buf = (struct buffer *) $ptr
if ! ($files_only && $buf->filename_ == Qnil) ygetptr $buf->filename_
set $fname = $ptr
if ! ($files_only && $fname == $qnil)
ygetptr $buf->name_ ygetptr $buf->name_
set $name = ((struct Lisp_String *) $ptr)->data set $name = ((struct Lisp_String *) $ptr)->data
set $modp = ($buf->text->modiff > $buf->text->save_modiff) ? '*' : ' ' set $modp = ($buf->text->modiff > $buf->text->save_modiff) ? '*' : ' '
...@@ -112,11 +124,11 @@ define ybuffer-list ...@@ -112,11 +124,11 @@ define ybuffer-list
ygetptr $buf->mode_name_ ygetptr $buf->mode_name_
set $mode = ((struct Lisp_String *) $ptr)->data set $mode = ((struct Lisp_String *) $ptr)->data
if $buf->filename_ != Qnil if $fname != $qnil
ygetptr $buf->filename_ ygetptr $buf->filename_
printf "%2d %c %9d %-20s %-10s %s\n", \ printf "%2d %c %9d %-20s %-10s %s\n", \
$i, $modp, ($buf->text->z_byte - 1), $name, $mode, \ $i, $modp, ($buf->text->z_byte - 1), $name, $mode, \
((struct Lisp_String *) $ptr)->data ((struct Lisp_String *) $fname)->data
else else
printf "%2d %c %9d %-20s %-10s\n", \ printf "%2d %c %9d %-20s %-10s\n", \
$i, $modp, ($buf->text->z_byte - 1), $name, $mode $i, $modp, ($buf->text->z_byte - 1), $name, $mode
...@@ -146,15 +158,17 @@ define yset-buffer ...@@ -146,15 +158,17 @@ define yset-buffer
set $i = $arg0 set $i = $arg0
set $alist = Vbuffer_alist set $alist = Vbuffer_alist
while ($alist != Qnil && $i > 0) ygetptr $alist
ygetptr $alist set $alist = $ptr
while ($alist != $qnil && $i > 0)
set $alist = ((struct Lisp_Cons *) $ptr)->u.cdr set $alist = ((struct Lisp_Cons *) $ptr)->u.cdr
ygetptr $alist
set $alist = $ptr
set $i-- set $i--
end end
# Get car of alist; this is a pair (name . buffer) # Get car of alist; this is a pair (name . buffer)
ygetptr $alist set $this = ((struct Lisp_Cons *) $alist)->car
set $this = ((struct Lisp_Cons *) $ptr)->car
# Get the buffer object # Get the buffer object
ygetptr $this ygetptr $this
......
...@@ -1267,8 +1267,7 @@ break terminate_due_to_signal ...@@ -1267,8 +1267,7 @@ break terminate_due_to_signal
tbreak init_sys_modes tbreak init_sys_modes
commands commands
silent silent
xgetptr globals.f_Vinitial_window_system xsymname globals.f_Vinitial_window_system
xsymname $ptr
xgetptr $symname xgetptr $symname
set $tem = (struct Lisp_String *) $ptr set $tem = (struct Lisp_String *) $ptr
set $tem = (char *) $tem->data set $tem = (char *) $tem->data
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment