PDA

View Full Version : Why no core file after compiling in c gcc?



ThePhilosopher57
January 14th, 2010, 04:45 PM
Hi all

I'm suposed to get a core file after compiling with this command :
gcc -D_GNU_SOURCE bloc.c -o wipeout
I have also try :
gcc -g -D_GNU_SOURCE bloc.c -o wipeout

and no sing of the core file.

I am suposed to see
(core dumped) at the end of the compliation process but I don't.

thanks for the help.

MadCow108
January 14th, 2010, 05:45 PM
why should you get a coredump after compiling?
unless you manage to crash gcc you won't.

coredumps are the memory state of a process to a certain time.
so you at least need to execute your program to get one and also this only if you have enabled coredumps, have enough space reserved (ulimit -c) and your program crashes or explicitly requests a coredump.

ThePhilosopher57
January 14th, 2010, 08:20 PM
why should you get a coredump after compiling?
unless you manage to crash gcc you won't.

coredumps are the memory state of a process to a certain time.
so you at least need to execute your program to get one and also this only if you have enabled coredumps, have enough space reserved (ulimit -c) and your program crashes or explicitly requests a coredump.


Well, I got this from a book to learn programming in c for Linux.
I guess he did a mistake or something.

He is really saying there should be a core file after compiling. Maybe the source code should crash gcc but it's not what he say and it's not crashing it.

MadCow108
January 14th, 2010, 08:32 PM
he probably means there should be a core dump after compiling and executing.
getting gcc to crash is hard and if you manage please file a bug report.

Is there an abort() in the source code?
that function creates an abnormal termination of the process and a core dump (when enabled)

zippaplick
January 15th, 2010, 07:14 AM
Also note you probably need to run "ulimit -c unlimited" in the shell before trying to generate a core file. Otherwise the core file size is set to 0 by default and it wont get generated.

ThePhilosopher57
January 15th, 2010, 04:26 PM
he probably means there should be a core dump after compiling and executing.
getting gcc to crash is hard and if you manage please file a bug report.


:D




Is there an abort() in the source code?
that function creates an abnormal termination of the process and a core dump (when enabled)

No, I don't think so. I'll try this, give you some news tomorow.

thanks

ThePhilosopher57
January 15th, 2010, 04:28 PM
Also note you probably need to run "ulimit -c unlimited" in the shell before trying to generate a core file. Otherwise the core file size is set to 0 by default and it wont get generated.


I will try this too.
Thanks.

ThePhilosopher57
January 15th, 2010, 08:50 PM
Yes, you are right. I have not read corectly. There is an error on the codesource and the compiler do not see it. But when I run the program, it crash.

But I see no core file anyway, I have try the unlimit command of zippaplick.