Subject: bug#12839: 24.3.50; Emacs aborts in GC

From: Eli Zaretskii <[email-masked]>
Date: Fri, 09 Nov 2012 09:24:10 +0200

> Date: Fri, 09 Nov 2012 07:40:10 +0400
> From: Dmitry Antipov <[email-masked]>
> CC: [email-masked]
> 
> Although I do my best to avoid platform-dependent tricks, some
> things are platform-dependent anyway, like the DEFUN macro. If you
> compile with Microsoft compiler, this is your case;

I'm using GCC, not the Microsoft compiler.  The MinGW development
environment uses ported GNU utilities (GCC, Binutils, GDB, etc.) to
compile native Windows programs.  (If I were using MSVC, I couldn't
have debugged programs with GDB, because GDB doesn't support the PDB
debug info format emitted by the Microsoft compiler.)

> can you use
> gdb to dump any struct Lisp_Subr to see it's vectorlike_header?

Is this what you wanted:

  (gdb) p Scons
  $6 = {
    header = {
      size = 1241513984
    },
    function = {
      a0 = 0x101a52e <Fcons>,
      a1 = 0x101a52e <Fcons>,
      a2 = 0x101a52e <Fcons>,
      a3 = 0x101a52e <Fcons>,
      a4 = 0x101a52e <Fcons>,
      a5 = 0x101a52e <Fcons>,
      a6 = 0x101a52e <Fcons>,
      a7 = 0x101a52e <Fcons>,
      a8 = 0x101a52e <Fcons>,
      aUNEVALLED = 0x101a52e <Fcons>,
      aMANY = 0x101a52e <Fcons>
    },
    min_args = 2,
    max_args = 2,
    symbol_name = 0x1543375 "cons",
    intspec = 0x0,
    doc = 0xfff9849c <Address 0xfff9849c out of bounds>
  }
  (gdb) p *(struct vectorlike_header *)&(Scons.header)
  $7 = {
    size = 1241513984
  }
  (gdb) p/x *(struct vectorlike_header *)&(Scons.header)
  $8 = {
    size = 0x4a000000
  }

> Also, if you suspect potentially bogus struct Lisp_Vector pointers,
> please try xvectype and xvecsize gdb commands to get something
> more informative than just the header->size shown as integer.

Sorry, I'm not sure I understand: in the first backtrace I've shown,
which was here (alloc.c:sweep_vectors):

	      else
		{
		  int tmp;
		  SETUP_ON_FREE_LIST (vector, total_bytes, tmp);  <<<<<<<
		}

the vector in question is not a Lisp object, it is a pointer to
'struct Lisp_Vector':

  #2  0x0101b1a8 in sweep_vectors () at alloc.c:2864
  2864                      SETUP_ON_FREE_LIST (vector, total_bytes, tmp);
  (gdb) p vector
  $1 = (struct Lisp_Vector *) 0x38ae230

Maybe you meant this:

  (gdb) p *vector
  $2 = {
    header = {
      size = 1166225408
    },
    contents = {55859226}
  }
  (gdb) p vector->contents
  $3 = {55859226}
  (gdb) p vector->contents[0]
  $4 = 55859226
  (gdb) xtype
  Lisp_Symbol
  (gdb) xsymbol
  $5 = (struct Lisp_Symbol *) 0x3545818
  "nil"

> >    emacs -Q
> >    C-x 3
> >    M-x set-variable RET auto-hscroll-mode RET nil RET
> 
> I can't reproduce it on Linux, so it looks like the same
> platform-dependent problem.

I'd be happy to try debugging this myself, but I need guidance
regarding some basics of what you changed recently in this area.
Alternatively, tell me what to do in GDB, and I will post the results.
I'm quite fluent with GDB, and reproducing this is extremely easy :-(.

TIA