[OT] gcc seg fault code file

  • Thread starter Bill Cunningham
  • Start date

B

Bill Cunningham

When I run a program and get a segmentation fault the compiler says (and
I use gcc) core file dumped. I understand this file is to be used in the
debugger. Is there some special switch with gccc that cause a core file to
be dumped when the compiler conplains "core file dumped"? It's dumping
nothing file wise. Shouldn't there be a file called core ?
 
Ad

Advertisements

K

Keith Thompson

Bill Cunningham said:
When I run a program and get a segmentation fault the compiler says (and
I use gcc) core file dumped. I understand this file is to be used in the
debugger. Is there some special switch with gccc that cause a core file to
be dumped when the compiler conplains "core file dumped"? It's dumping
nothing file wise. Shouldn't there be a file called core ?

No, the compiler doesn't say "core file dumped"; your program does that,
or the OS or shell does it on your program's behalf.

This is not a C question. If "ulimit core unlimited" doesn't answer
your question, please ask elsewhere.
 
G

glen herrmannsfeldt

Bill Cunningham said:
When I run a program and get a segmentation fault the compiler says (and
I use gcc) core file dumped. I understand this file is to be used in the
debugger. Is there some special switch with gccc that cause a core file to
be dumped when the compiler conplains "core file dumped"? It's dumping
nothing file wise. Shouldn't there be a file called core ?

Some shells have the ability to set a maximum core file size,
as often enough one doesn't want one. When the size is set
to zero, no file is created. (It would seem that they should
change the message, but they don't.)

-- glen
 
B

Barry Schwarz

When I run a program and get a segmentation fault the compiler says (and
I use gcc) core file dumped. I understand this file is to be used in the
debugger. Is there some special switch with gccc that cause a core file to

At the time you are executing your program, the compiler has long
since finished its job. The segmentation fault is a result of the
hardware/operating system detecting the fact that your program tried
to do something impossible/illegal. gcc, or any other compiler, has
no control over what happens at this point.
be dumped when the compiler conplains "core file dumped"? It's dumping
nothing file wise. Shouldn't there be a file called core ?

On the Unix system I use, there are such files. Whether the same is
true on the system you are using is something you will have to
research. You might also need to determine under what condition the
file would be produced and in which directory such a file would be
created.
 
I

Ike Naar

Some shells have the ability to set a maximum core file size,
as often enough one doesn't want one. When the size is set
to zero, no file is created. (It would seem that they should
change the message, but they don't.)

Don't they?
If one runs a program that segfaults on this machine

$ uname -mrs
NetBSD 6.1_STABLE amd64

a core file is written, and a message is printed:

Segmentation fault (core dumped)

when there is no restriction on the core file size,
but no core file is written, and the message

Segmentation fault

is printed when the maximum core file is set to zero.
 
G

glen herrmannsfeldt

Barry Schwarz said:
On Thu, 1 May 2014 15:58:38 -0400, "Bill Cunningham"
At the time you are executing your program, the compiler has long
since finished its job. The segmentation fault is a result of the
hardware/operating system detecting the fact that your program tried
to do something impossible/illegal. gcc, or any other compiler, has
no control over what happens at this point.

Well, that is the usual way to write C compilers, but the
standard doesn't require it. The WATFIV Fortran compiler stays
in memory. Convenient for running many small programs with
less wasteful disk I/O. I am not sure about any C compilers
doing that.

-- glen
 
Ad

Advertisements

B

Ben Bacarisse

Richard said:
Are you for real?

You think this is a legitimate Q still? jesus. You must be a bundle of
laughs in the real world.

A few days ago, a journalist, posing as someone hard up, was given food
for him and his family by a food bank without any checks being made that
he was indeed hard-up. Some people, let's call then "Daily Mail
readers" were up in arms that someone was helped by a charity simply
because they asked for help. Others, let's call then "sane people" were
up in arms that anyone would want to write such a cynical story.

If Bill is playing some strange long game, then all credit to him. I am
pleased if he is enjoying himself. No one is forced to reply, so,
presumably, those who do are happy to do so. What's more, the replies
may also help others. It win, win, win as far as I can see.

The only problem is if Bill is genuine, in which case he has my
sympathy, but the replies do no harm even in this unfortunate case.

You don't work for the Daily Mail do you?
 
O

Osmium

:

A few days ago, a journalist, posing as someone hard up, was given food
for him and his family by a food bank without any checks being made that
he was indeed hard-up. Some people, let's call then "Daily Mail
readers" were up in arms that someone was helped by a charity simply
because they asked for help. Others, let's call then "sane people" were
up in arms that anyone would want to write such a cynical story.

If Bill is playing some strange long game, then all credit to him. I am
pleased if he is enjoying himself. No one is forced to reply, so,
presumably, those who do are happy to do so. What's more, the replies
may also help others. It win, win, win as far as I can see.

The only problem is if Bill is genuine, in which case he has my
sympathy, but the replies do no harm even in this unfortunate case.

You don't work for the Daily Mail do you?

I'll be darned! Until that post I had no idea you were in the UK. You
could pass for an American - I'm not sure that's a good thing.
 
B

Bill Cunningham

Ben Bacarisse said:
A few days ago, a journalist, posing as someone hard up, was given food
for him and his family by a food bank without any checks being made that
he was indeed hard-up. Some people, let's call then "Daily Mail
readers" were up in arms that someone was helped by a charity simply
because they asked for help. Others, let's call then "sane people" were
up in arms that anyone would want to write such a cynical story.

If Bill is playing some strange long game, then all credit to him. I am
pleased if he is enjoying himself. No one is forced to reply, so,
presumably, those who do are happy to do so. What's more, the replies
may also help others. It win, win, win as far as I can see.

The only problem is if Bill is genuine, in which case he has my
sympathy, but the replies do no harm even in this unfortunate case.

You don't work for the Daily Mail do you?

Don't feed the trolls
 
B

Bill Cunningham

No, the compiler doesn't say "core file dumped"; your program does that,
or the OS or shell does it on your program's behalf.

This is not a C question. If "ulimit core unlimited" doesn't answer
your question, please ask elsewhere.

I know this is OT. That's why I marked the post OT. It's a compiler
question I think and I don't know where else to ask. Sorry. I've been having
time to study C lately. So I am doing so right now.
 
K

Kenny McCormack

I know this is OT. That's why I marked the post OT. It's a compiler
question I think and I don't know where else to ask. Sorry. I've been having
time to study C lately. So I am doing so right now.

You could put 75 "OT"s in the Subject: line and Kiki would still feel
obliged to point out that your post is OT.
 
Ad

Advertisements

B

Barry Schwarz

I know this is OT. That's why I marked the post OT. It's a compiler
question I think and I don't know where else to ask. Sorry. I've been having
time to study C lately. So I am doing so right now.

It's not a compiler question either.
 
J

Joe Pfeiffer

Bill Cunningham said:
I know this is OT. That's why I marked the post OT. It's a compiler
question I think and I don't know where else to ask. Sorry. I've been having
time to study C lately. So I am doing so right now.

It isn't a compiler question, as several people have already pointed out
to you.
 
K

Kenny McCormack

It isn't a compiler question, as several people have already pointed out
to you.

YHBT

--
"They shall be attended by boys graced with eternal youth, who to the
beholder?s eyes will seem like sprinkled pearls. When you gaze upon that
scene, you will behold a kingdom blissful and glorious."

--- Qur'an 76:19 ---
 
Ad

Advertisements

D

David Thompson

At the time you are executing your program, the compiler has long
since finished its job. The segmentation fault is a result of the
hardware/operating system detecting the fact that your program tried
to do something impossible/illegal.
Yes.

gcc, or any other compiler, has
no control over what happens at this point.
On one (rather unusual) OS I've used, the equivalent of core files is
partly controlled by a flag in the executable, which is normally set
by the linker, which is normally run automatically by the compiler,
and there are compiler directives (for C a #pragma) to set this flag.
Although that C compiler was not gcc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top