Subject: Re: bug#29332: 27.0.50; running under gdb

From: Eli Zaretskii <[email-masked]>
Date: Fri, 17 Nov 2017 12:10:04 +0200

> From: Richard Stallman <[email-masked]>
> Date: Thu, 16 Nov 2017 22:17:55 -0500
> 
> I cd to src and type
> 
>    gdb emacs
> 
>    r
> 
> and I get the error message
> 
>    there is no member named name
> 
> I am using GDB version 7.7.1 which is in Trisquel 7.
> In principle I could install the latest GDB, but it would be a lot of work
> and I doubt it would make a difference.  I think the bug is in src/.gdbinit.

You are right.  Fixed on the release branch with the changes below.

commit 42c8768134dcfaaf08637e36fe478605c1957517
Author:     Eli Zaretskii <[email-masked]>
AuthorDate: Fri Nov 17 12:08:06 2017 +0200
Commit:     Eli Zaretskii <[email-masked]>
CommitDate: Fri Nov 17 12:08:06 2017 +0200

    Fix .gdbinit following lisp.h changes
    
    * src/.gdbinit (xsymname, pwinx, pgx, xbuffer, xcar, xcdr, xlist)
    (xprintstr): Adapt to latest changes in Lisp object C structures.
    (Bug#29332)

diff --git a/src/.gdbinit b/src/.gdbinit
index 60f6348..48bb5df 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -78,7 +78,7 @@ end
 # Access the name of a symbol
 define xsymname
   xgetsym $arg0
-  set $symname = $ptr->name
+  set $symname = $ptr->u.s.name
 end
 
 # Set up something to print out s-expressions.
@@ -376,7 +376,7 @@ define pwinx
   xgetptr $w->buffer
   set $tem = (struct buffer *) $ptr
   xgetptr $tem->name_
-  printf "%s", ((struct Lisp_String *) $ptr)->data
+  printf "%s", ((struct Lisp_String *) $ptr)->u.s.data
   printf "\n"
   xgetptr $w->start
   set $tem = (struct Lisp_Marker *) $ptr
@@ -504,7 +504,7 @@ define pgx
   xgettype ($g.object)
   if ($type == Lisp_String)
     xgetptr $g.object
-    printf " str=0x%x[%d]", ((struct Lisp_String *)$ptr)->data, $g.charpos
+    printf " str=0x%x[%d]", ((struct Lisp_String *)$ptr)->u.s.data, $g.charpos
   else
     printf " pos=%d", $g.charpos
   end
@@ -896,7 +896,7 @@ define xbuffer
   xgetptr $
   print (struct buffer *) $ptr
   xgetptr $->name_
-  output ((struct Lisp_String *) $ptr)->data
+  output ((struct Lisp_String *) $ptr)->u.s.data
   echo \n
 end
 document xbuffer
@@ -935,7 +935,7 @@ end
 define xcar
   xgetptr $
   xgettype $
-  print/x ($type == Lisp_Cons ? ((struct Lisp_Cons *) $ptr)->car : 0)
+  print/x ($type == Lisp_Cons ? ((struct Lisp_Cons *) $ptr)->u.s.car : 0)
 end
 document xcar
 Assume that $ is an Emacs Lisp pair and print its car.
@@ -944,7 +944,7 @@ end
 define xcdr
   xgetptr $
   xgettype $
-  print/x ($type == Lisp_Cons ? ((struct Lisp_Cons *) $ptr)->u.cdr : 0)
+  print/x ($type == Lisp_Cons ? ((struct Lisp_Cons *) $ptr)->u.s.u.cdr : 0)
 end
 document xcdr
 Assume that $ is an Emacs Lisp pair and print its cdr.
@@ -957,9 +957,9 @@ define xlist
   set $nil = $ptr
   set $i = 0
   while $cons != $nil && $i < 10
-    p/x $cons->car
+    p/x $cons->u.s.car
     xpr
-    xgetptr $cons->u.cdr
+    xgetptr $cons->u.s.u.cdr
     set $cons = (struct Lisp_Cons *) $ptr
     set $i = $i + 1
     printf "---\n"
@@ -1072,13 +1072,13 @@ Print $ as a lisp object of any type.
 end
 
 define xprintstr
-  set $data = (char *) $arg0->data
-  set $strsize = ($arg0->size_byte < 0) ? ($arg0->size & ~ARRAY_MARK_FLAG) : $arg0->size_byte
+  set $data = (char *) $arg0->u.s.data
+  set $strsize = ($arg0->u.s.size_byte < 0) ? ($arg0->u.s.size & ~ARRAY_MARK_FLAG) : $arg0->u.s.size_byte
   # GDB doesn't like zero repetition counts
   if $strsize == 0
     output ""
   else
-    output ($arg0->size > 1000) ? 0 : ($data[0])@($strsize)
+    output ($arg0->u.s.size > 1000) ? 0 : ($data[0])@($strsize)
   end
 end
 
@@ -1255,7 +1255,7 @@ commands
   xsymname globals.f_Vinitial_window_system
   xgetptr $symname
   set $tem = (struct Lisp_String *) $ptr
-  set $tem = (char *) $tem->data
+  set $tem = (char *) $tem->u.s.data
   # If we are running in synchronous mode, we want a chance to look
   # around before Emacs exits.  Perhaps we should put the break
   # somewhere else instead...