Procedure to Generate Core dump of a process in Linux system

Hello All,
I have one machine where some customized applications written in C++ (process) are getting hanged frequently.
In order analyze the same , I require to generate a core dump when the application starts responding slow or processing slow.

I have done the following to enable core dump of the system.

1) In /etc/security/limit.conf, I have enabled the following lines which are #shed.

•      * soft core 0
•      * hard core 0

and then save the file.

Run the following command at the time of hang but it did not create any core dump.

#kill -s SIFSEGV <PID of the hang process>

But it has not generate any core dump. I think I am doing some fundamental mistake being not aware much about it.

Can you help me to generate the same? I have gdb installed in my system.My RHEL version in 5.9.

I do not know much about it.Can somebody help me out to generate the core dump.
Member_2_7964709Asked:
Who is Participating?
 
dfkeCommented:
Hi,

To enable Core Dumps for new processes make the following entry in /etc/profile:

ulimit -c unlimited >/dev/null 2>&1

To enable a Core Dump for an already running process with let's say PID 34234 under RedHat:

cd /proc/34234/
[root@somehost 34234]# cat limits  | grep nice
Max nice priority         0                    0
[root@somehost 34234]# echo -n "Max nice priority=5:6" > limits
[root@somehost 34234]# cat limits  | grep nice
Max nice priority         5                    6

Or you can use prlimit:

[root@somehost 34234]# prlimit --core=1000000 --pid 34234
[root@somehost 34234]# prlimit --pid 34234 | grep CORE
CORE       max core file size                   1000000   1000000 bytes


Cheers
0
 
dfkeCommented:
Both options I gave can be used. Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.