Subject: bug#45515: 28.0.50; [feature/native-comp] emacsGcc crash on Apple Silicon M1

From: mp <[email-masked]>
Date: Tue, 29 Dec 2020 16:07:08 +0100

On 29.12.2020 10:01, Andrea Corallo wrote:

> michal panoch <[email-masked]> writes:
>
>> hi,
>>
>> i'm on the new Apple Silicon M1 architecture and using nix emacs-overlay - https://github.com/nix-community/emacs-overlay/
>>
>> like this: ~/.config/nixpkgs/overlays/emacs.nix
>>
>> import (builtins.fetchTarball {
>>    url = https://github.com/nix-community/emacs-overlay/archive/master.tar.gz;
>> })
>>
>> install whith:
>>
>> $ nix-env -iA nixpkgs.emacsGcc
>>
>> it compiles no problem. it runs and bytecompiles everything no problem, but after a while it crashes with:
>>
>> Assertion failed: (mach_vm_map(mach_task_self(), &address, size, 0, VM_FLAGS_ANYWHERE | VM_MAKE_TAG(VM_MEMORY_COREGRAPHICS_BACKINGSTORES), port, 0, false, prot, prot, VM_INHERIT_SHARE) == KERN_SUCCESS), function backing_map, file /AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/SkyLight/SkyLight-569.6/SkyLight/Services/Windows/CGSBackingStore.c, line 192. Fatal error 6: Aborted [1] 2319 abort emacs --fg-daemon
>>
>> any idea how to investigate?
>>
>> uname -a:
>> Darwin mpm.local 20.2.0 Darwin Kernel Version 20.2.0: Wed Dec  2 20:40:21 PST 2020; root:xnu-7195.60.75~1/RELEASE_ARM64_T8101 arm64
> Hi Michal,
>
> this assertion is out of our code so doesn't ring any bell to me.
> Running under a debugger to have a back-trace of the crash might give
> more information.
>
> Thanks
>
>    Andrea
trying to run with gbd, but it doesn't seem to be working:

mp@mpm:~ :$ gdb /Users/mp/.nix-profile/bin/emacs
GNU gdb (GDB) 10.1
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /Users/mp/.nix-profile/bin/emacs...
(No debugging symbols found in /Users/mp/.nix-profile/bin/emacs)
(gdb) r --fg-daemon
Starting program: 
/nix/store/2y79kkpvkbjdd2jzdxx2w3p3mxdqpagf-user-environment/bin/emacs 
--fg-daemon
[New Thread 0x2a03 of process 54326]
[New Thread 0x2b03 of process 54326]
../../gdb/target.c:2149: internal-error: void 
target_mourn_inferior(ptid_t): Assertion `ptid == inferior_ptid' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) n

This is a bug, please report it.  For instructions, see:
<https://www.gnu.org/software/gdb/bugs/>.

../../gdb/target.c:2149: internal-error: void 
target_mourn_inferior(ptid_t): Assertion `ptid == inferior_ptid' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) n
Command aborted.
Error calling thread_get_state for GP registers for thread 0x2a03
warning: Mach error at "../../gdb/i386-darwin-nat.c:83" in function 
"virtual void i386_darwin_nat_target::fetch_registers(struct regcache *, 
int)": (ipc/send) invalid destination port (0x10000003)

any idea how to proceed?

-mp-