Subject: bug#76004: 31.0.50; feature/igc crashed on Linux, wayland (with full gdb debug info)

From: Eval Exec <[email-masked]>
Date: Sun, 2 Feb 2025 18:12:20 +0800

(gdb) p &lispsym
$1 = (struct Lisp_Symbol (*)[1786]) 0xd459c0 <lispsym>

$ objdump -h /home/exec/Projects/git.savannah.gnu.org/git/emacs-build/feature_igc-6f7e916a6c80df11bf169587913fb0443f6b5490-gdb/bin/emacs-31.0.50

/home/exec/Projects/git.savannah.gnu.org/git/emacs-build/feature_igc-6f7e916a6c80df11bf169587913fb0443f6b5490-gdb/bin/emacs-31.0.50:
    file format elf64-x86-64

Sections:
Idx Name          Size      VMA               LMA               File off  Algn
  0 .interp       00000053  0000000000400318  0000000000400318  00000318  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .note.gnu.property 00000040  0000000000400370  0000000000400370
00000370  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .note.ABI-tag 00000020  00000000004003b0  00000000004003b0  000003b0  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .hash         0000bf80  00000000004003d0  00000000004003d0  000003d0  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .gnu.hash     0000c474  000000000040c350  000000000040c350  0000c350  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  5 .dynsym       0002fc88  00000000004187c8  00000000004187c8  000187c8  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  6 .dynstr       00023db3  0000000000448450  0000000000448450  00048450  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  7 .gnu.version  00003fb6  000000000046c204  000000000046c204  0006c204  2**1
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  8 .gnu.version_r 000003c0  00000000004701c0  00000000004701c0  000701c0  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  9 .rela.dyn     00000708  0000000000470580  0000000000470580  00070580  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 10 .rela.plt     00009fd8  0000000000470c88  0000000000470c88  00070c88  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 11 .init         0000001b  000000000047b000  000000000047b000  0007b000  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 12 .plt          00006aa0  000000000047b020  000000000047b020  0007b020  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 13 .plt.got      00000050  0000000000481ac0  0000000000481ac0  00081ac0  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 14 .text         00311f20  0000000000481b10  0000000000481b10  00081b10  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 15 .fini         0000000d  0000000000793a30  0000000000793a30  00393a30  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 16 .rodata       000381a0  0000000000794000  0000000000794000  00394000  2**5
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 17 .eh_frame_hdr 0000da6c  00000000007cc1a0  00000000007cc1a0  003cc1a0  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 18 .eh_frame     00046ec0  00000000007d9c10  00000000007d9c10  003d9c10  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 19 .init_array   00000008  0000000000821210  0000000000821210  00421210  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 20 .fini_array   00000008  0000000000821218  0000000000821218  00421218  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 21 .data.rel.ro  0000c058  0000000000821220  0000000000821220  00421220  2**5
                  CONTENTS, ALLOC, LOAD, DATA
 22 .dynamic      000005d0  000000000082d278  000000000082d278  0042d278  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 23 .got          000037a0  000000000082d848  000000000082d848  0042d848  2**3
                  CONTENTS, ALLOC, LOAD, DATA
 24 .data         004efb70  0000000000831000  0000000000831000  00431000  2**5
                  CONTENTS, ALLOC, LOAD, DATA
 25 .subrs        00023a60  0000000000d20b80  0000000000d20b80  00920b80  2**5
                  CONTENTS, ALLOC, LOAD, DATA
 26 .bss          000bea68  0000000000d445e0  0000000000d445e0  009445e0  2**5
                  ALLOC
 27 .comment      00000012  0000000000000000  0000000000000000  009445e0  2**0
                  CONTENTS, READONLY
 28 .debug_aranges 00000c90  0000000000000000  0000000000000000  009445f2  2**0
                  CONTENTS, READONLY, DEBUGGING, OCTETS
 29 .debug_info   00aa3459  0000000000000000  0000000000000000  00945282  2**0
                  CONTENTS, READONLY, DEBUGGING, OCTETS
 30 .debug_abbrev 00030fd7  0000000000000000  0000000000000000  013e86db  2**0
                  CONTENTS, READONLY, DEBUGGING, OCTETS
 31 .debug_line   00330b49  0000000000000000  0000000000000000  014196b2  2**0
                  CONTENTS, READONLY, DEBUGGING, OCTETS
 32 .debug_str    0007442a  0000000000000000  0000000000000000  0174a1fb  2**0
                  CONTENTS, READONLY, DEBUGGING, OCTETS
 33 .debug_line_str 00002df6  0000000000000000  0000000000000000  017be625  2**0
                  CONTENTS, READONLY, DEBUGGING, OCTETS
 34 .debug_loclists 003e18d5  0000000000000000  0000000000000000  017c141b  2**0
                  CONTENTS, READONLY, DEBUGGING, OCTETS
 35 .debug_rnglists 0005c8ce  0000000000000000  0000000000000000  01ba2cf0  2**0
                  CONTENTS, READONLY, DEBUGGING, OCTETS

On Sun, Feb 2, 2025 at 5:02 PM Pip Cet <[email-masked]> wrote:
>
> "Eval EXEC" <[email-masked]> writes:
>
> > Hello,
> >
> > I'm helping to test feature/igc branch, and I got a crash, with full gdb
> > debug info.
> >
> > I build this emacs executable with:
> > ```bash
> > set -ex
> >
> > make extraclean
> >
> > BRANCH_NAME=$(git branch --show-current | sed 's/\//_/g')
> > COMMIT_ID=$(git rev-parse HEAD)
> > BUILD_DIR=${BRANCH_NAME}-${COMMIT_ID}-gdb
> > INSTALL_PREFIX=$(realpath ../emacs-build/${BUILD_DIR})
> >
> > ./autogen.sh
> > ./configure  CFLAGS='-g -ggdb -march=native' \
> >   --prefix=${INSTALL_PREFIX} \
> >   --with-imagemagick  \
> >   --with-mps=yes \
> >   --with-xwidgets \
> >   --with-modules \
> >   --with-cairo --with-cairo-xcb \
> >   --without-compress-install \
> >   --with-mailutils\
> >   --enable-link-time-optimization \
> >   --with-tree-sitter --with-xinput2 \
> >   --with-dbus \
> >   --with-native-compilation=aot \
> >   --with-file-notification=inotify\
> >   && make -j20 install
> > ```
> >
> > What should I do to help you to investigate this crash?
>
> Could you also print the address of lispsym:
>
> p &lispsym
>
> as well as provide the mapped memory ranges; if you have a corefile,
>
> objdump -h <core>
>
> from the shell prompt will work.  If you don't, run "gcore" from gdb to
> generate one.
>
> I'm very confused about
>
>          binding = XIL(0x7f6c2ae81440)
>
> Lisp symbols aren't represented as pointers to their structs, there's an
> offset in there, by the address of &lispsym (so the 0 word corresponds
> to &lispsym[0] rather than a NULL pointer).
>
> On my system, I've never seen the address of &lispsym be so small that
> binding would remain in the valid 47-bit address range once we add the
> lispsym offset.  This would explain the segfault (though not why GDB
> makes inaccurate claims).
>
> Pip
>