Deepti_vobilineni
asked on
Need help regarding SEGV
I am trying to handle SIGSEGV in my C++ program.
I wrote a signal handler that uses a different stack other than my program using SA_ONSTACK flag.
I want the core to be dumped when my program results in a SEGV. So i tried sending SEGV to the program using htop utility. My signal handler function is executed but I am not able to see any core dump.
What else I need to do so that I can get the core dump and how to set the path of the core dump file?
Also, I need to know if there is a way to access the core file in the program so that I can print its contents into the log file before exiting the program after it results in SEGV?
I wrote a signal handler that uses a different stack other than my program using SA_ONSTACK flag.
I want the core to be dumped when my program results in a SEGV. So i tried sending SEGV to the program using htop utility. My signal handler function is executed but I am not able to see any core dump.
What else I need to do so that I can get the core dump and how to set the path of the core dump file?
Also, I need to know if there is a way to access the core file in the program so that I can print its contents into the log file before exiting the program after it results in SEGV?
ASKER
My ulimit value for core file is already set to unlimited.
[root@InvadePRI ~]# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
max nice (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 77824
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
max rt priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 77824
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
[root@InvadePRI ~]# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
max nice (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 77824
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
max rt priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 77824
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
ASKER
[root@InvadePRI ~]# ulimit -a
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
max nice (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 77824
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
max rt priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 77824
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
max nice (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 77824
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
max rt priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 77824
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
May I ask why you gave a B grade ? That usually means that something was missing in the answer and/or that something is still unclear. If so, you don't have to close the question yet, and can ask for clarification where needed.
ASKER
Sorry, I did not give any grade as such...This is the first time I am using this site and i am so happy to find a solution within no time...thnks 2 u for the reply...My doubt was answered promptly and I didnt know how u were assigned a B grade !!??
No problem ;) I'm glad to be of assistance.
The grade is assigned when you close the question (you get the option to choose the grade). For more information on choosing the correct grade, see here :
https://www.experts-exchange.com/help.jsp#hi97
The grade is assigned when you close the question (you get the option to choose the grade). For more information on choosing the correct grade, see here :
https://www.experts-exchange.com/help.jsp#hi97
ulimit -c
to see whether core dumps are enabled now. If they're not, then set the maximum size of the core dump to a value bigger than 0 (preferrably a lot bigger ;) ) :
ulimit -c 10000
or :
ulimit -c unlimited