Enable Core Dumps for crashed process in macOS Sierra
Asked Answered
P

1

6

I need to enable Core Dump File creation for processes which terminated by SIGABRT,SIGBUS, etс..

In previous versions of MAC OS X (include ElCapitan) to enable Code Dumps file for all processes i'm will do:

sudo sysctl -w kern.corefile=/Users/tester/core.%U.%P.%N.dump
sudo sysctl -w kern.coredump=1
sudo launchctl limit core unlimited
sudo ulimit -c unlimited
launchctl limit core unlimited
ulimit -c unlimited

Now thise way does not work. In this Site talk about new gcore command, but it work for running processes. For KernelCoreDumps now you must enable NVRAM variable official.

Precipitation answered 4/10, 2016 at 12:44 Comment(0)
B
0

I just tried ulimit -c unlimited with Xcode 9, followed by executing something sure to get a segfault, and, bingo, got a coredump written in /core/. Namely, I tried

#include <stdio.h>
int main()
{
int a[2];
printf("\n hi\n");
a[20000]=10;
return 0;
}

Save this to a file, say x.c, then in the same terminal session where you executed ulimit above do cc x.c (assuming you have Xcode's command line tools installed), followed by ./a.out

The coredump was over 700Mb in size, believe it or not.

Bloomington answered 22/11, 2017 at 19:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.