Subject: Re: 27.0.50; xgettype (and friends) don't know about Lisp_Word
From: Paul Eggert <[email-masked]>
To: Stefan Monnier <[email-masked]>
Cc: [email-masked]
Date: Tue, 2 Jan 2018 22:40:41 -0800
List-Id: <debbugs-submit.debbugs.gnu.org>

Thanks for reporting that; I installed the attached.
From f8b4e87d5d4f57954b50677add76ce5136211dc1 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Tue, 2 Jan 2018 22:38:01 -0800
Subject: [PATCH] Fix .gdbinit to work with Lisp_Word

Problem reported by Stefan Monnier (Bug#29957).
* src/.gdbinit (xgetptr, xgetint, xgettype):
Cast Lisp_Word value to EMACS_INT, since it might be a pointer now.
---
 src/.gdbinit | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/.gdbinit b/src/.gdbinit
index de35ef1..a5411e6 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -49,7 +49,7 @@ define xgetptr
   else
     set $bugfix = $arg0
   end
-  set $ptr = $bugfix & VALMASK
+  set $ptr = (EMACS_INT) $bugfix & VALMASK
 end
 
 define xgetint
@@ -58,7 +58,7 @@ define xgetint
   else
     set $bugfix = $arg0
   end
-  set $int = $bugfix << (USE_LSB_TAG ? 0 : INTTYPEBITS) >> INTTYPEBITS
+  set $int = (EMACS_INT) $bugfix << (USE_LSB_TAG ? 0 : INTTYPEBITS) >> INTTYPEBITS
 end
 
 define xgettype
@@ -67,7 +67,7 @@ define xgettype
   else
     set $bugfix = $arg0
   end
-  set $type = (enum Lisp_Type) (USE_LSB_TAG ? $bugfix & (1 << GCTYPEBITS) - 1 : (EMACS_UINT) $bugfix >> VALBITS)
+  set $type = (enum Lisp_Type) (USE_LSB_TAG ? (EMACS_INT) $bugfix & (1 << GCTYPEBITS) - 1 : (EMACS_UINT) $bugfix >> VALBITS)
 end
 
 define xgetsym
-- 
2.7.4