Segmentation Fault

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
jsgroby
Posts: 83
Joined: Mon Mar 24, 2014 12:26 am
Location: Glen Carbon, IL USA

Segmentation Fault

Post by jsgroby »

I have a Segmentation Fault: 11 on my Mac. Testing my engine. I am wanting to use gdb to analyze what happened, but I cannot locate a core file. Do I need to set up something at the system level to instruct the machine to dump a core file during a segfault in OSX?

Is there a way to analyze what is happening without the core file? Like can I run gdb then execute the program and attach to the pid or something like that?

Thanks for your consideration.

Jeff
User avatar
jsgroby
Posts: 83
Joined: Mon Mar 24, 2014 12:26 am
Location: Glen Carbon, IL USA

Re: Segmentation Fault

Post by jsgroby »

jsgroby wrote:I have a Segmentation Fault: 11 on my Mac. Testing my engine. I am wanting to use gdb to analyze what happened, but I cannot locate a core file. Do I need to set up something at the system level to instruct the machine to dump a core file during a segfault in OSX?

Is there a way to analyze what is happening without the core file? Like can I run gdb then execute the program and attach to the pid or something like that?

Thanks for your consideration.

Jeff
Found it. My ulimit-c was set to 0. I set it to unlimited, ran it again and got the dump in the /cores directory on my system. Now I can run gdb with my engine and the core and see what happened.
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: Segmentation Fault

Post by zullil »

jsgroby wrote:
jsgroby wrote:I have a Segmentation Fault: 11 on my Mac. Testing my engine. I am wanting to use gdb to analyze what happened, but I cannot locate a core file. Do I need to set up something at the system level to instruct the machine to dump a core file during a segfault in OSX?

Is there a way to analyze what is happening without the core file? Like can I run gdb then execute the program and attach to the pid or something like that?

Thanks for your consideration.

Jeff
Found it. My ulimit-c was set to 0. I set it to unlimited, ran it again and got the dump in the /cores directory on my system. Now I can run gdb with my engine and the core and see what happened.
You might also look at the .crash file. Check /Library/Logs/CrashReporter and ~/Library/Logs/CrashReporter.
User avatar
jsgroby
Posts: 83
Joined: Mon Mar 24, 2014 12:26 am
Location: Glen Carbon, IL USA

Re: Segmentation Fault

Post by jsgroby »

zullil wrote:
jsgroby wrote:
jsgroby wrote:I have a Segmentation Fault: 11 on my Mac. Testing my engine. I am wanting to use gdb to analyze what happened, but I cannot locate a core file. Do I need to set up something at the system level to instruct the machine to dump a core file during a segfault in OSX?

Is there a way to analyze what is happening without the core file? Like can I run gdb then execute the program and attach to the pid or something like that?

Thanks for your consideration.

Jeff
Found it. My ulimit-c was set to 0. I set it to unlimited, ran it again and got the dump in the /cores directory on my system. Now I can run gdb with my engine and the core and see what happened.
You might also look at the .crash file. Check /Library/Logs/CrashReporter and ~/Library/Logs/CrashReporter.
Thanks, I was able to get part of the backtrace from that crash file which then allowed me to home in on the problem.

Jeff