Subject: Re: bug#47067: 28.0.50; [feature/native-comp] Crash while scrolling through dispnew.c

From: Andrea Corallo <[email-masked]>
Date: Sun, 14 Mar 2021 08:10:08 +0000

Eli Zaretskii <[email-masked]> writes:

>> From: Andrea Corallo <[email-masked]>
>> Cc: Eli Zaretskii <[email-masked]>, [email-masked]
>> Date: Sun, 14 Mar 2021 07:19:17 +0000
>> 
>> Okay with a trunk gdb I'm able to debug...
>
> Yes, 8.2 is quite an old version.
>
>> Here is my backtrace for the suggested reproducer on my Emacs configured
>> with --with-wide-int --enable-checking=yes,glyphs and compiled with the
>> default `comp-debug' 0.
>
> Thanks.  However, your build is optimized, whereas mine isn't.  This
> has a significant effect on the backtrace (static functions are
> inlined and don't appear in the backtrace).  Please reconfigure with
> CFLAGS='-O0 -g3' (and the rest of the switches as you used them for
> this build), and show the backtrace after rebuilding.

Okay will rebuild and report this evening (have to leave the PC now).

> As I established earlier, in
>
>   https://debbugs.gnu.org/cgi/bugreport.cgi?bug=47067#80
>   https://debbugs.gnu.org/cgi/bugreport.cgi?bug=47067#83
>
> the code which GDB fails to identify with any symbols calls Emacs
> primitives via freloc.link_table.  Where is the C source for this
> code?  If there is no C source, then how is that code generated?

There's no C source for that as this is generated by us from Lisp (Emacs
is acting as a GCC frontend).

We can anyway have libgccjit generate some pseudo C code to ease
debugging (see 'gcc_jit_context_dump_to_file' in [1] if you like).  We
trigger this compiling with `comp-debug' >= 1, in this case gdb should
let you step into the .eln following the dumped pseudo C code.

>> Emacs does not crash if then I continue and scroll through down through
>> in the file.
>
> And if you type "C-s sleep"?

Doesn't crash.

Thanks

  Andrea

[1] <https://gcc.gnu.org/onlinedocs/jit/topics/contexts.html>