It is currently Sat May 18, 2013 8:03 pm

All times are UTC




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: Seg fault but NO core dump?!
PostPosted: Mon Aug 24, 2009 6:38 am 
Zenwalker
Zenwalker

Joined: Mon Aug 24, 2009 6:26 am
Posts: 6
I've tried everything (I think) and I cannot get a core dump!

I did ulimit in bash, limit in csh. It says core size is unlimited.

I've edited config files. I've scoured around the net for hours.

Why can't I get a core dump in Zenwalk? I have version 6.

I can gdb the program, no problem. I'm not a noob.

But it's important for my project to get core dumps when crashes occur.

Any ideas? D!!


 Profile Send private message  
 
 Post subject: Re: Seg fault but NO core dump?!
PostPosted: Mon Aug 24, 2009 11:39 am 
Regular Zenwalker
Regular Zenwalker

Joined: Thu Aug 06, 2009 6:20 pm
Posts: 11
For me, the code:

Code:
int main()
{
   int *p = 0xdeadbeef;

   *p = 10;
   return 0;
}


gcc -ggdb -o test test.c

generates a core dump... I am using Zenwalk 6 too.


 Profile Send private message  
 
 Post subject: Re: Seg fault but NO core dump?!
PostPosted: Mon Aug 24, 2009 7:29 pm 
Zenwalker
Zenwalker

Joined: Mon Aug 24, 2009 6:26 am
Posts: 6
Well, I tried that. I get the seg fault, but no dump.

I did a fresh install of Zenwalk 6 Standard. I set the core limit to unlimited, I made sure permissions were set on the current directory for rwx, I even tried it in the home directory, and then as root. Nada.

I'm at a loss. H!!!


 Profile Send private message  
 
 Post subject: Re: Seg fault but NO core dump?!
PostPosted: Mon Aug 24, 2009 10:17 pm 
Zenwalker
Zenwalker

Joined: Mon Aug 24, 2009 6:26 am
Posts: 6
And the plot thickens...

I installed 6.2 RC1. Did the ulimit thing. Checked permissions. Logged in a root even. Ran "test" - Seg fault yes, core dump, no.

Went to another machine with 6.0 installed. Same deal. No dump. How frustrating!


 Profile Send private message  
 
 Post subject: Re: Seg fault but NO core dump?!
PostPosted: Mon Aug 24, 2009 11:51 pm 
Regular Zenwalker
Regular Zenwalker

Joined: Thu Aug 06, 2009 6:20 pm
Posts: 11
Sorry for asking but how are you setting the core limit? As far as I remember, I didn't need to set the limit. This is very odd... do you get cores in other distributions?


 Profile Send private message  
 
 Post subject: Re: Seg fault but NO core dump?!
PostPosted: Tue Aug 25, 2009 4:12 am 
Zenwalker
Zenwalker

Joined: Mon Aug 24, 2009 6:26 am
Posts: 6
In bash, "ulimit -c unlimited"
In csh, "limit core unlimited"

I read that to prevent core dumps, set the limit to zero; which is by default. It also said that to enable them, make sure the permissions are set for the current user to write files, and that the core limit is above the size of the core dump; unlimited is prefered.

Well, it doesn't dump a core. I haven't tried to put "test" on other distros. It probably will dump a core. I could try other distros but then I run into compatibility issues with old hardware or trying to set up libraries. (Out of frustration of trying to get the BFD - binary file descriptor - library to work in other distros, I switched to Zenwalk because it's installed and working by default).

Is there something I'm doing wrong in setting up Linux? I basically do a default setup. 8GB linux file system with a 1GB swap. Does the file system format matter? I chose the default.


 Profile Send private message  
 
 Post subject: Re: Seg fault but NO core dump?!
PostPosted: Tue Aug 25, 2009 10:31 am 
Regular Zenwalker
Regular Zenwalker

Joined: Thu Jun 18, 2009 12:55 pm
Posts: 17
Location: Abu Dhabi
In the kernel did you check CONFIG_ELF_CORE option?


 Profile Send private message  
 
 Post subject: Re: Seg fault but NO core dump?!
PostPosted: Tue Aug 25, 2009 9:21 pm 
Zenwalker
Zenwalker

Joined: Mon Aug 24, 2009 6:26 am
Posts: 6
I don't know how or where to find that information out about CONFIG_ELF_CORE.


 Profile Send private message  
 
 Post subject: Re: Seg fault but NO core dump?!
PostPosted: Wed Aug 26, 2009 1:30 am 
Regular Zenwalker
Regular Zenwalker

Joined: Thu Aug 06, 2009 6:20 pm
Posts: 11
To see your current kernel configuration you can try to unzip /proc/config.gz. I can only unzip it after copying it to another directory. Something like:

cd ~
cp /proc/config.gz .
unzip config.gz
grep CONFIG_ELF_CORE config (or .config, don't remember right now)

Hope that helps.


 Profile Send private message  
 
 Post subject: Re: Seg fault but NO core dump?!
PostPosted: Wed Aug 26, 2009 3:00 am 
Regular Zenwalker
Regular Zenwalker

Joined: Thu Jun 18, 2009 12:55 pm
Posts: 17
Location: Abu Dhabi
Neither CONFIG_ELF_CORE nor CONFIG_IKCONFIG_PROC (/proc/config.gz) are activated by default in the kernel. At least not in ZW5.2. If you did not rebuild or upgrade your kernel you can check in /boot/config:
grep -E "CONFIG_ELF_CORE|CONFIG_IKCONFIG_PROC" /boot/config

If this is the case you should rebuild your kernel and enable CONFIG_ELF_CORE. If you also enable /proc/config.gz support you can check after:

zcat /proc/config.gz | grep CONFIG_ELF_CORE
CONFIG_ELF_CORE=y

ulimit -c unlimited
./test
Segmentation fault (core dumped)
ls -l core*
-rw------- 1 ivan users 139264 2009-08-26 06:40 core


 Profile Send private message  
 
 Post subject: Re: Seg fault but NO core dump?!
PostPosted: Wed Aug 26, 2009 3:51 pm 
Master of the known universe
Master of the known universe

Joined: Fri May 16, 2008 2:44 pm
Posts: 1347
Location: Munich, Germany
I can confirm that with this flag and ulimit -c unlimited a core dump is created. :)


 Profile Send private message  
 
 Post subject: Re: Seg fault but NO core dump?!
PostPosted: Fri Aug 28, 2009 6:30 pm 
Zenwalker
Zenwalker

Joined: Mon Aug 24, 2009 6:26 am
Posts: 6
\!D/ It works! I simply (or not so simply) had to rebuild the core with the CONFIG_ELF_CORE option turned on. Which brings up an interesting point: Why wasn't this on in the first place?! Sheesh.

Thanks for your help!


 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC


 Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: