I have tried may things but I can get my program to generate core dump when it crashes.
$ ulimit -c
200000000
The limit seems ok.
$ cat /proc/sys/fs/suid_dumpable
2
The pattern looks ok.
$ cat /proc/sys/kernel/core_pattern
/tmp/core_%e
When I kill -SIGSEGV I get a core dump. The process has very little memory. Why is there no core dump file?
I have a print at the end of main that i don't see and I'm running the program in bash while loop with sleep 2;
The os is Ubuntu 12.04LTS
Related
I can use gcore generating the core file of my application which was built with debug symbol. Out of curiosity, I tried using kill command to generated the core file, but no core is generated.
Here are the steps I took:
I first ran the following commands:
ulimit -c unlimited
sudo sysctl -w kernel.core_pattern=/tmp/core-%e.%p.%h.%t
Then start the application.
Then I tried the SIGABRT, SIGTRAP, SIGQUIT, there is no core file generated:
kill -SIGABRT `pidof my_app`
kill -SIGTRAP `pidof my_app`
kill -SIGQUIT `pidof my_app`
In all these runs, my_app was stoped, but there is no core file, locally or /tmp.
I am using Ubuntu 20.04.
Do you see anything wrong?
On my ubuntu 14.04 (Linux 3.19.0 64bit) PC, I ran a perl program that has the following in a loop
$params = setupParams();
$ret = `SOME_CMD $params`;
...
But for some reason, SOME_CMD sometimes gaves Segmentation fault (core dumped) occasionally. In order to figure out the cause of the core dump, I need to get the core file.
Unfortunately I tried ulimit -S -c 0 on the terminal where I ran the perl script, but it didn't produce a core file.
Any ideas would be appreciated.
ulimit -c 0 prevents core files to be written. You need to use
ulimit -c unlimited
Btw: you should upgrade to a maintained OS.
I'm running Valgrind's Helgrind tool on a program in a script.
Here's the relevant part of the script:
(The only line I wrote is the first one)
sudo valgrind --tool=helgrind ./core-linux.bin --reset PO 2>> ../Test_CFE_SB/valgrindLog.txt &
PID=$!
printf "\n" >> ../Test_CFE_SB/valgrindLog.txt
sleep $sleepTime
#did it crash?
ps ax | grep $PID | grep -vc grep
RESULT=$?
if [ $RESULT -eq 0 ]
then
sudo kill $PID
echo "Process killed by buildscript."
else
echo $name >> crash.log
OS: 32 bit XUbuntu 14.04
The program helgrind is running on, core-linux.bin, does not shut down by it self, like a server. Runs until it gets a kill command.
What happens is that the program shuts down after the kill $PID command but Helgrind keeps going in the background taking about 94% of the CPU according to top. I then have to kill it using kill -9 and valgrindLog.txt only contains the starting message from Valgrind, no report or anything. I have let it run through the night with the same result so it's not that it's just slow.
I ran the exact same script except used --tool=memcheck instead and that runs perfectly well. valgrindLog.txt contains everything it should and all is well there. Same if I use --tool=drd, all good. But helgrind doesn't want to play ball and unfortunately I'm not so familiar with Valgrind that I can figure this out on my own, so far at least.
To see what your application is doing under Valgrind/helgrind,
you can attach using gdb+vgdb and examine if your program advances
or else, where it stays blocked.
If you cannot attach, then it means that Valgrind is running in its own
code, and that might be a valgrind/helgrind bug.
If you have a small reproducer, file a bug in valgrind bugzilla
Cygwin includes a program dumper.exe
The dumper utility can be used to create a core dump of running Windows
process.
Usage: dumper [OPTION] FILENAME WIN32PID
Dump core from WIN32PID to FILENAME.core
However it seems to only work with Cygwin processes
$ ps -Ws | grep calc
3880 ? 20:22:02 C:\Windows\System32\calc.exe
$ dumper calc-dump 3880
Cannot attach to process #3880, error 50
I have been using ProcDump for some time now, but I would like to move to a program that is included in Cygwin packages.
It turns out that dumper.exe will work with a Windows process, but only 32-bit processes.
$ C:/Windows/SysWOW64/calc.exe &
[1] 3660
$ dumper calc 3660 &
[2] 3500
$ ls -l
total 18688
-rw-r--r--+ 1 Steven None 19071028 Jun 7 20:38 calc.core
I am trying to force core dump of a program. Core dumping is enabled via
ulimit -c unlimited
If my program is launched by the init process, and I kill it like this
kill -6 <pid_of_prog>
I can't find the core.
However, if it is launched from a terminal, and I kill it with the above command, then it dumps core. The program chdir to a directory when it is launched, and the core file is found in this directory.
ulimit does not set the limit of already launched process, so my init launched process is not affected by the ulimit command. I guess the correct answer is to use setrlimit