GNU bug report logs - #12036
24.1.50; xvectype and xpr broken by change in PVEC_TYPE_MASK when macro information not available

Previous Next

Package: emacs;

Reported by: Eli Zaretskii <eliz <at> gnu.org>

Date: Mon, 23 Jul 2012 18:20:01 UTC

Severity: normal

Found in version 24.1.50

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 12036 in the body.
You can then email your comments to 12036 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#12036; Package emacs. (Mon, 23 Jul 2012 18:20:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Eli Zaretskii <eliz <at> gnu.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 23 Jul 2012 18:20:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.1.50;
	xvectype and xpr broken by change in PVEC_TYPE_MASK when macro
	information not available
Date: Mon, 23 Jul 2012 21:13:07 +0300
This bug report will be sent to the Bug-GNU-Emacs mailing list
and the GNU bug tracker at debbugs.gnu.org.  Please check that
the From: line contains a valid email address.  After a delay of up
to one day, you should receive an acknowledgement at that address.

Please write in English if possible, as the Emacs maintainers
usually do not have translators for other languages.

Please describe exactly what actions triggered the bug, and
the precise symptoms of the bug.  If you can, give a recipe
starting from `emacs -Q':

 cd src
 gdb ./emacs
 (gdb) break decode_any_window
 (gdb) r -Q
 Breakpoint 3, decode_any_window (window=54912845) at window.c:149
 149       if (NILP (window))
 (gdb) n
 152       CHECK_WINDOW (window);
 (gdb) p window
 $1 = 54912845
 (gdb) xtype
 Lisp_Vectorlike
 No symbol "PVEC_TYPE_MASK" in current context.

AFAICS, this happens because PVEC_TYPE_MASK is now a macro, whereas it
was an enumerated type before.  Therefore, any GDB commands that use
it will not work unless the macro information is available to GDB,
which only happens with some GCC switches.

Please make these commands work without requiring -g3 again.

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
d:/gnu/bzr/emacs/trunk/etc/DEBUG.


In GNU Emacs 24.1.50.1 (i386-mingw-nt5.1.2600)
 of 2012-07-23 on HOME-C4E4A596F7
Bzr revision: 109194 eliz <at> gnu.org-20120723165720-qecdk4kza6po0al7
Windowing system distributor `Microsoft Corp.', version 5.1.2600
Configured using:
 `configure --with-gcc (3.4) --no-opt --enable-checking --cflags
 -Id:/usr/include/libxml2 -DGLYPH_DEBUG=1'

Important settings:
  value of $EMACSDATA: D:/gnu/bzr/emacs/trunk/etc
  value of $EMACSDOC: D:/gnu/bzr/emacs/trunk/etc
  value of $EMACSLOADPATH: D:/gnu/bzr/emacs/trunk/lisp;D:/gnu/bzr/emacs/trunk/leim
  value of $EMACSPATH: D:/gnu/bzr/emacs/trunk/bin
  value of $LANG: ENU
  locale-coding-system: cp1255
  default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-x r e p o r t - e m <tab> <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils time-date tooltip ediff-hook vc-hooks
lisp-float-type mwheel dos-w32 disp-table ls-lisp w32-win w32-vars
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer button faces cus-face files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process multi-tty emacs)




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Thu, 26 Jul 2012 09:22:02 GMT) Full text and rfc822 format available.

Notification sent to Eli Zaretskii <eliz <at> gnu.org>:
bug acknowledged by developer. (Thu, 26 Jul 2012 09:22:02 GMT) Full text and rfc822 format available.

Message #10 received at 12036-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: 12036-done <at> debbugs.gnu.org
Subject: Re: 24.1.50; xvectype and xpr broken by change in PVEC_TYPE_MASK
	when macro information not available
Date: Thu, 26 Jul 2012 02:14:54 -0700
I ran into this problem independently and fixed it in
trunk bzr 109213.  I just now found this bug report and
am marking it as done.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12036; Package emacs. (Thu, 26 Jul 2012 17:04:01 GMT) Full text and rfc822 format available.

Message #13 received at 12036 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 12036 <at> debbugs.gnu.org
Subject: Re: bug#12036: 24.1.50;
	xvectype and xpr broken by change in PVEC_TYPE_MASK when
	macro	information not available
Date: Thu, 26 Jul 2012 19:56:31 +0300
> Date: Thu, 26 Jul 2012 02:14:54 -0700
> From: Paul Eggert <eggert <at> cs.ucla.edu>
> 
> I ran into this problem independently and fixed it in
> trunk bzr 109213.  I just now found this bug report and
> am marking it as done.

Thanks, but it doesn't appear to be entirely fixed.  Somehow, the
CHECK_LISP_OBJECT_TYPE thing is unknown to GDB:

  D:\gnu\bzr\emacs\trunk\src>gdb ./oo/i386/emacs.exe
  GNU gdb (GDB) 7.4.1
  Copyright (C) 2012 Free Software Foundation, Inc.
  [...]
  .gdbinit:1197: Error in sourced command file:
  No symbol "CHECK_LISP_OBJECT_TYPE" in current context.  <<<<<<<<<<<<<<<<
  (gdb) break decode_any_window
  Breakpoint 1 at 0x11de1b8: file window.c, line 149.
  (gdb) r -Q
  Starting program: D:\gnu\bzr\emacs\trunk\src/./oo/i386/emacs.exe -Q
  [New Thread 5748.0xa3c]

  Breakpoint 1, decode_any_window (window=54888269) at window.c:149
  149       if (NILP (window))
  (gdb) n
  152       CHECK_WINDOW (window);
  (gdb) p window
  $1 = 54888269
  (gdb) xtype
  No symbol "CHECK_LISP_OBJECT_TYPE" in current context.  <<<<<<<<<<<<<<<




Did not alter fixed versions and reopened. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 26 Jul 2012 17:15:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12036; Package emacs. (Thu, 26 Jul 2012 18:11:02 GMT) Full text and rfc822 format available.

Message #18 received at 12036 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: eggert <at> cs.ucla.edu
Cc: 12036 <at> debbugs.gnu.org
Subject: Re: bug#12036: 24.1.50;
	xvectype and xpr broken by change in PVEC_TYPE_MASK
	when	macro	information not available
Date: Thu, 26 Jul 2012 21:03:24 +0300
> Date: Thu, 26 Jul 2012 19:56:31 +0300
> From: Eli Zaretskii <eliz <at> gnu.org>
> Cc: 12036 <at> debbugs.gnu.org
> 
> > Date: Thu, 26 Jul 2012 02:14:54 -0700
> > From: Paul Eggert <eggert <at> cs.ucla.edu>
> > 
> > I ran into this problem independently and fixed it in
> > trunk bzr 109213.  I just now found this bug report and
> > am marking it as done.
> 
> Thanks, but it doesn't appear to be entirely fixed.  Somehow, the
> CHECK_LISP_OBJECT_TYPE thing is unknown to GDB:
> 
>   D:\gnu\bzr\emacs\trunk\src>gdb ./oo/i386/emacs.exe
>   GNU gdb (GDB) 7.4.1
>   Copyright (C) 2012 Free Software Foundation, Inc.
>   [...]
>   .gdbinit:1197: Error in sourced command file:
>   No symbol "CHECK_LISP_OBJECT_TYPE" in current context.  <<<<<<<<<<<<<<<<
>   (gdb) break decode_any_window
>   Breakpoint 1 at 0x11de1b8: file window.c, line 149.
>   (gdb) r -Q
>   Starting program: D:\gnu\bzr\emacs\trunk\src/./oo/i386/emacs.exe -Q
>   [New Thread 5748.0xa3c]
> 
>   Breakpoint 1, decode_any_window (window=54888269) at window.c:149
>   149       if (NILP (window))
>   (gdb) n
>   152       CHECK_WINDOW (window);
>   (gdb) p window
>   $1 = 54888269
>   (gdb) xtype
>   No symbol "CHECK_LISP_OBJECT_TYPE" in current context.  <<<<<<<<<<<<<<<

It looks like the enum values are known to GDB only if there's a
variable which has that enum type.  E.g., if I change the enum like
this:

  enum
    {
      CHECK_LISP_OBJECT_TYPE = gdb_CHECK_LISP_OBJECT_TYPE,
      DATA_SEG_BITS = gdb_DATA_SEG_BITS,
      GCTYPEBITS = gdb_GCTYPEBITS,
      USE_LSB_TAG = gdb_USE_LSB_TAG
    } foo;

then there's no problem with CHECK_LISP_OBJECT_TYPE.  However, the
next problem in line is with VALBITS:

  (gdb) break decode_any_window
  Breakpoint 3 at 0x11de1b8: file window.c, line 149.
  (gdb) r -Q
  Starting program: D:\gnu\bzr\emacs\trunk\src/./oo/i386/emacs.exe -Q
  [New Thread 5144.0xe24]

  Breakpoint 3, decode_any_window (window=54888269) at window.c:149
  149       if (NILP (window))
  (gdb) n
  152       CHECK_WINDOW (window);
  (gdb) p window
  $1 = 54888269
  (gdb) xtype
  No symbol "VALBITS" in current context.

This is again because no variable uses this enum:

  enum { VALBITS = BITS_PER_EMACS_INT - GCTYPEBITS };

If I declare a variable with this enum, I get past VALBITS, but then
bump into pvec_type:

  Breakpoint 3, decode_any_window (window=54888269) at window.c:149
  149       if (NILP (window))
  (gdb) n
  152       CHECK_WINDOW (window);
  (gdb) p window
  $1 = 54888269
  (gdb) xtype
  Lisp_Vectorlike
  No enum type named pvec_type.

Etc., etc.

The old code had real variables that used the enumerated types.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12036; Package emacs. (Thu, 26 Jul 2012 18:54:02 GMT) Full text and rfc822 format available.

Message #21 received at 12036 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 12036 <at> debbugs.gnu.org
Subject: Re: bug#12036: 24.1.50;
	xvectype and xpr broken by change in PVEC_TYPE_MASK
	when	macro	information not available
Date: Thu, 26 Jul 2012 11:46:08 -0700
Thanks, I didn't run into those problems since I tested
by debugging when the symbols happened to be in scope.

I reproduced some of the problems and installed a fix as
trunk bzr 109219.

However, there's one thing I couldn't reproduce:

On 07/26/2012 11:03 AM, Eli Zaretskii wrote:
>   Breakpoint 3, decode_any_window (window=54888269) at window.c:149
>   149       if (NILP (window))
>   (gdb) n
>   152       CHECK_WINDOW (window);
>   (gdb) p window
>   $1 = 54888269
>   (gdb) xtype
>   Lisp_Vectorlike
>   No enum type named pvec_type.

I expect that I don't have this problem because the bug has been fixed
in my tools (GCC 4.7.1 + GDB 7.4.1).  I tried to work around the problem
by putting this line into lisp.h:

PUBLISH_TO_GDB ((enum pvec_type) 0);  /* This also publishes PVEC_*.  */

but I can't easily test this, since my tools don't have the problem.
Could you please try it?  And if it doesn't work, could you
please try adding lines like this:

PUBLISH_TO_GDB (PVEC_TYPE_MASK);

for values like PVEC_TYPE_MASK that do not otherwise work for you?
Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12036; Package emacs. (Thu, 26 Jul 2012 20:18:02 GMT) Full text and rfc822 format available.

Message #24 received at 12036 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 12036 <at> debbugs.gnu.org
Subject: Re: bug#12036: 24.1.50;
	xvectype and xpr broken by change in PVEC_TYPE_MASK
	when	macro	information not available
Date: Thu, 26 Jul 2012 23:10:19 +0300
> Date: Thu, 26 Jul 2012 11:46:08 -0700
> From: Paul Eggert <eggert <at> cs.ucla.edu>
> CC: 12036 <at> debbugs.gnu.org
> 
> >   (gdb) xtype
> >   Lisp_Vectorlike
> >   No enum type named pvec_type.
> 
> I expect that I don't have this problem because the bug has been fixed
> in my tools (GCC 4.7.1 + GDB 7.4.1).  I tried to work around the problem
> by putting this line into lisp.h:
> 
> PUBLISH_TO_GDB ((enum pvec_type) 0);  /* This also publishes PVEC_*.  */
> 
> but I can't easily test this, since my tools don't have the problem.
> Could you please try it?  And if it doesn't work, could you
> please try adding lines like this:
> 
> PUBLISH_TO_GDB (PVEC_TYPE_MASK);
> 
> for values like PVEC_TYPE_MASK that do not otherwise work for you?

Unfortunately, with my ancient version of GCC, I don't even get past
CHECK_LISP_OBJECT_TYPE in xgetptr:

  .gdbinit:1197: Error in sourced command file:
  No symbol "CHECK_LISP_OBJECT_TYPE" in current context.

Looks like PUBLISH_TO_GDB is not doing the trick here.

Anyway, with tricky macros such as PUBLISH_TO_GDB, I'd think that
going back to using variables whose type is the enum would be better,
don't you think?  We could modify PUBLISH_TO_GDB to do that.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12036; Package emacs. (Fri, 27 Jul 2012 06:30:02 GMT) Full text and rfc822 format available.

Message #27 received at 12036 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 12036 <at> debbugs.gnu.org
Subject: Re: bug#12036: 24.1.50;
	xvectype and xpr broken by change in PVEC_TYPE_MASK
	when	macro	information not available
Date: Thu, 26 Jul 2012 23:22:40 -0700
On 07/26/2012 01:10 PM, Eli Zaretskii wrote:
> Anyway, with tricky macros such as PUBLISH_TO_GDB, I'd think that
> going back to using variables whose type is the enum would be better,

Yes, that's right.  Unfortunately this can't be encapsulated as nicely
as PUBLISH_TO_GDB can, so I reverted the PUBLISH_TO_GDB business
and went back to the old way of making enums visible, in
trunk bzr 109224.  Please give it a try.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12036; Package emacs. (Fri, 27 Jul 2012 09:48:02 GMT) Full text and rfc822 format available.

Message #30 received at 12036 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 12036 <at> debbugs.gnu.org
Subject: Re: bug#12036: 24.1.50;
	xvectype and xpr broken by change in PVEC_TYPE_MASK
	when	macro	information not available
Date: Fri, 27 Jul 2012 12:40:07 +0300
> Date: Thu, 26 Jul 2012 23:22:40 -0700
> From: Paul Eggert <eggert <at> cs.ucla.edu>
> CC: 12036 <at> debbugs.gnu.org
> 
> On 07/26/2012 01:10 PM, Eli Zaretskii wrote:
> > Anyway, with tricky macros such as PUBLISH_TO_GDB, I'd think that
> > going back to using variables whose type is the enum would be better,
> 
> Yes, that's right.  Unfortunately this can't be encapsulated as nicely
> as PUBLISH_TO_GDB can, so I reverted the PUBLISH_TO_GDB business
> and went back to the old way of making enums visible, in
> trunk bzr 109224.  Please give it a try.

Thanks, it seems to work now, at least in a few simple tests I ran
here.  However, there's still a small nuisance:

  (gdb) break decode_any_window
  Breakpoint 3 at 0x11de2a8: file window.c, line 149.
  (gdb) r -Q
  Starting program: D:\gnu\bzr\emacs\trunk\src/./oo/i386/emacs.exe -Q
  [New Thread 1452.0x15d4]

  Breakpoint 3, decode_any_window (window=54896461) at window.c:149
  149       if (NILP (window))
  (gdb) n
  152       CHECK_WINDOW (window);
  (gdb) p window
  $1 = 54896461
  (gdb) xtype
  Lisp_Vectorlike
  262144          <<<<<<<<<<<<<<<<<<<<<<

In Emacs 24.1, it does better:

  (gdb) p window
  $1 = 53340677
  (gdb) xtype
  Lisp_Vectorlike
  PVEC_WINDOW

I'm not sure if it will be better to go back to 24.1 behavior and
display PVEC_WINDOW, or change .gdbinit to say something more explicit
and human-readable here, such as "window" (and similarly for other
vector-like types).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12036; Package emacs. (Fri, 27 Jul 2012 20:59:02 GMT) Full text and rfc822 format available.

Message #33 received at 12036 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 12036 <at> debbugs.gnu.org
Subject: Re: bug#12036: 24.1.50;
	xvectype and xpr broken by change in PVEC_TYPE_MASK
	when	macro	information not available
Date: Fri, 27 Jul 2012 13:51:30 -0700
On 07/27/2012 02:40 AM, Eli Zaretskii wrote:
> I'm not sure if it will be better to go back to 24.1 behavior and
> display PVEC_WINDOW

That's easier; all we need to do is fix .gdbinit to reflect
the pvec_type changes that were installed on July 4.
I did that, as trunk bzr 109240; please give it a try.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12036; Package emacs. (Sat, 28 Jul 2012 07:38:01 GMT) Full text and rfc822 format available.

Message #36 received at 12036 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 12036 <at> debbugs.gnu.org
Subject: Re: bug#12036: 24.1.50;
	xvectype and xpr broken by change in PVEC_TYPE_MASK
	when	macro	information not available
Date: Sat, 28 Jul 2012 10:30:13 +0300
> Date: Fri, 27 Jul 2012 13:51:30 -0700
> From: Paul Eggert <eggert <at> cs.ucla.edu>
> CC: 12036 <at> debbugs.gnu.org
> 
> On 07/27/2012 02:40 AM, Eli Zaretskii wrote:
> > I'm not sure if it will be better to go back to 24.1 behavior and
> > display PVEC_WINDOW
> 
> That's easier; all we need to do is fix .gdbinit to reflect
> the pvec_type changes that were installed on July 4.
> I did that, as trunk bzr 109240; please give it a try.

Thanks, it works fine now.




bug closed, send any further explanations to 12036 <at> debbugs.gnu.org and Eli Zaretskii <eliz <at> gnu.org> Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 28 Jul 2012 10:53:02 GMT) Full text and rfc822 format available.

Message #39 received at 12036-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 12036-done <at> debbugs.gnu.org
Subject: Re: bug#12036: 24.1.50;
	xvectype and xpr broken by change in PVEC_TYPE_MASK
	when	macro	information not available
Date: Sat, 28 Jul 2012 06:38:49 -0700
On 07/28/2012 12:30 AM, Eli Zaretskii wrote:
> Thanks, it works fine now.

Excellent!  Marking this as done.





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 26 Aug 2012 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 247 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.