Problem - program exited with code 0377

Discussion in 'C Programming' started by Seo Jae Ick, Feb 15, 2004.

  1. Seo Jae Ick

    Seo Jae Ick Guest

    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
     
    Seo Jae Ick, Feb 15, 2004
    #1
    1. Advertisements

  2. 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.
     
    Mark McIntyre, Feb 15, 2004
    #2
    1. Advertisements

  3. Seo Jae Ick

    Seo Jae Ick Guest

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

    SIGSEGV didn't be caughed.


    Thank you for your kind advice, Mark!
     
    Seo Jae Ick, Feb 15, 2004
    #3
  4. 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.
     
    Mark McIntyre, Feb 15, 2004
    #4
  5. Seo Jae Ick

    Seo Jae Ick Guest

    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
     
    Seo Jae Ick, Feb 16, 2004
    #5
  6. Seo Jae Ick

    Seo Jae Ick Guest

    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
     
    Seo Jae Ick, Feb 16, 2004
    #6
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.