2022年12月20日 星期二

Generate Core Dump File C++ on Ubuntu 20.04



setup

cat /proc/sys/kernel/core_pattern
|/usr/share/apport/apport -p%p -s%s -c%c -d%d -P%P -u%u -g%g -- %E
$ ulimit -c
0
$ ulimit -c unlimited
0
$ ulimit -c
unlimited

setup
sudo sysctl kernel.core_pattern=/var/crash/core.%c.%d.%p.%t.%s.%E
cat /proc/sys/kernel/core_pattern
/var/crash/%E.%p.%t.%s

code

touch a.cpp
nano

int main() {
int a = 1/0;
int b = a+1;
return 0;
}

g++ a.cpp
./a.out
Floating point exception (core dumped)

dump

ll /var/crash/
core.18446744073709551615.1.30876.1671522014.8.!home!user!a.out

 

No use

ll /var/lib/apport/coredump
sudo sysctl kernel.core_pattern=core.%p.%s.%c.%d.%P

Reference

https://askubuntu.com/questions/440708/unable-to-generate-core-dump-after-apport-disable

沒有留言:

張貼留言

2023 Promox on Morefine N6000 16GB 512GB

2023 Promox on Morefine N6000 16GB 512GB Software Etcher 100MB (not but can be rufus-4.3.exe 1.4MB) Proxmox VE 7.4 ISO Installer (1st ISO re...