Problem - program exited with code 0377

S

Seo Jae Ick

Hi? My name is Seo Jae Ick.

I have a problem with running a program on Linux RedHat 8.0.
GDB have reported this,

program exited with code 0377

I think, this statement comes when

1) explicit call in process exit(-1) <- 0377(octet) = -1(decimal)
2) return -1 in main function

(any other case exists?)

I have searched exit(-1)in whole codes, but not exists.
And I changed main function's return value to another number (like 128)
Finally, I added exit handler, ExitHandler by calling atexit(ExitHandler)

But, gdb reports same statement(program exited with code 0377)
and, breakpoint in ExitHandler skipped.

Somebody knows the reason of this problem?
Thanks in advance!

Seo Jae Ick
 
M

Mark McIntyre

Hi? My name is Seo Jae Ick.

I have a problem with running a program on Linux RedHat 8.0.
GDB have reported this,

program exited with code 0377

I think, this statement comes when

1) explicit call in process exit(-1) <- 0377(octet) = -1(decimal)
2) return -1 in main function

(any other case exists?)

your program crashed, and returned garbage to teh OS, which decided to
interpret it as meaning -1.
Somebody knows the reason of this problem?

You have a bug in your program. You need to find the bug, and fix it.
Narrow down the location, post a (small) piece of code that causes the
crash, and maybe someone here can help fix it.
 
S

Seo Jae Ick

Mark McIntyre said:
your program crashed, and returned garbage to teh OS, which decided to
interpret it as meaning -1.


You have a bug in your program. You need to find the bug, and fix it.
Narrow down the location, post a (small) piece of code that causes the
crash, and maybe someone here can help fix it.

If my program crashed, isn't signal SIGSEGV sent to that program?

SIGSEGV didn't be caughed.


Thank you for your kind advice, Mark!
 
M

Mark McIntyre

....
If my program crashed, isn't signal SIGSEGV sent to that program?

Possibly. The behavioru of the OS when you have a bug is not defined by C.

Its equally possible that the first thingf that gdb does when you load it
is look for a core dump, and tell you what the core dumped for.

But if you /reeally/ want to find out, you need to ask in a group
specialising in whatever OS and Compiler you're using.
 
S

Seo Jae Ick

Mark McIntyre said:
Possibly. The behavioru of the OS when you have a bug is not defined by C.

Its equally possible that the first thingf that gdb does when you load it
is look for a core dump, and tell you what the core dumped for.

But if you /reeally/ want to find out, you need to ask in a group
specialising in whatever OS and Compiler you're using.

Hello, Mark!

Here is my system's information

OS: RedHat Linux 8.0 (Psyche) Kernel(2.4.18-14smp)
Compiler: gcc 3.2-7
Debugger: gdb-5.2.1-4

Though I can't fix this problem still, thank you for your help.
Seo Jae Ick
 
S

Seo Jae Ick

Mark McIntyre said:
Possibly. The behavioru of the OS when you have a bug is not defined by C.

Its equally possible that the first thingf that gdb does when you load it
is look for a core dump, and tell you what the core dumped for.

But if you /reeally/ want to find out, you need to ask in a group
specialising in whatever OS and Compiler you're using.

Ah, I misunderstood your comment.
I'll try to get answer from linux os newsgroup.
(of course try to fix problem by myself also)

Have a nice day!
Seo Jae Ick
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top