1

I'm using Cygwin to compile my C programs

I created a program that will call abort whenever an error occurs.

when I run the program from Cygwin Terminal the function produces the following output:

Aborted (core dumped)

but If I run the program from Windows CMD or Explorer it produces the following:

      0 [main] test 1904 cygwin_exception::open_stackdumpfile: Dumping stack trace to test.exe.stackdump

Can I change the message to the first format? How?

because the second format is very ugly and I can't tell if this is a bug in the program (e.g: Access Violation, Divide By Zero,...) or the abort function>

and why do I get different messages even though the build is the same?

Note: Please, Don't tell me not to use the abort function or the Cygwin compiler

1
  • Is test.exe.stackdump written when the second (ugly) message is produced? (I wonder whether this message indicates a problem with writing the stackdumpfile, e. g. permission in the current directory, and would go away if that problem were solved.) – Armali Jul 24 '15 at 9:59
1

The point is that the output you're seeing comes from the Cygwin standard library. You will either need to modify that (don't worry, it's surely open source).

It seems that the cygwin terminal environment has a way of handling with such exceptions in a manner that doesn't cause the string you don't want to be printed. So, since abort should really not be overly user-configurable, you'll have to modify the way SIGABRTs are handled by the cygwin libc.

Thus, you've excluded the only answer that seems correct: Don't use stock cygwin, or don't use abort. Generally, you can't rely on what abort gives on your console, since this definitely isn't defined behaviour, can change with localizations, and is generally a bad way of handing error codes out of your applications. The old-school unix way of doing this is return codes, so I recommend using them.

1
  • who is going to handle the signal? what I know is that cygwin lib has default handlers for signals. is it possible that the environment will handle them – Ameen Jan 17 '15 at 4:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.