obtain core dump by aborting the running apps
May 13th, 2007 mysurface Posted in kill, pkill, ulimit | Hits: 52891 | 6 Comments »
To obtain core dump, the line bellow is mandatory.
ulimit -c unlimited
Check out generate coredumps to help developer for debugging for more details of ulimit.
Core dump will be generated automatically if a program crashed due to segmentation fault or some other reason. But core dump will not be generated if an application halt and been terminate by control+c or conventional way of kill or pkill. Therefore, how we are going to investigate the reason of the halt process? There is an option that you can gdb a current running process by specified the GID. But what if you are not the author of the program? You are just a support engineer who wants to escalate the bugs to development team by providing the core file, what can you do?
You can abort the apps and obtain the core dump using kill or pkill. If you check kill man page, you will discover abort signal from the list of signal description with various purpose
...
ABRT 6 core
...
To abort the halt process is easy, with kill you need to specified the GID
kill -6 12345
With pkill, you provide it with the process name.
pkill -6 myapp
[䏿–‡ç¿»è¯‘ï¼½







May 17th, 2007 at 10:26 pm
Great post. I’m curious though about the following. One, I thought when you killed a process with ^C that the core dump was written to the current working directory. However, when I do this I do not see the core file. Two, are there any gotchas to using these command on a Windows box running cygwin?
May 18th, 2007 at 12:36 am
bpw1621:
1. Control c is to trigger an interrupt signal, same as pkill -2, it will just exit, not core file will be generated.
2. pkill -6 should have no problem in cygwin.
March 16th, 2008 at 7:09 am
gcore will generate core without killing the process.
March 17th, 2008 at 10:46 am
Interesting! Thanks W.G. Will check out the gcore soon.
December 14th, 2010 at 1:46 pm
If i kill the hung process process.
Then wat steps should i follow to collect the core dump?
Please revert for this query.
November 3rd, 2011 at 4:38 am
You must also change ulimit -c (check ulimit -a)
ulimit -c unlimited