-3

Is there a good place to lookup failure codes while debugging c programs? For example: I am getting "Abort trap: 6" while running one of my programs and I don't know what that means.

Edit: This was on a mac, and I'm looking for a reference to lookup any error code that comes up, not just the example I gave.

chf2117
  • 166
  • 9
  • That's specific to Windows I think. You have to learn how to use a debugger. Your code is doing something that makes the OS kill it. So the information provided is not about where or how your program violated the rules, it just tells you which rule. – Iharob Al Asimi Feb 07 '18 at 01:28
  • Also, note that [here is a possible duplicate](https://stackoverflow.com/questions/26431147/abort-trap-6-error-in-c), before asking make sure you read it and clearly distinguished it from your own question, so that it doesn't have the same answer. – Iharob Al Asimi Feb 07 '18 at 01:29
  • [Windows system error codes](https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx). A simple Google search is all it took. – ack Feb 07 '18 at 01:39
  • @AlexQuilliam: Those are codes for errors in function calls, retrieved by `GetLastError`. I have not used Windows in a while, but I would not expect those to be the same as either command exit status codes or the codes printed when a program aborts. Are they? – Eric Postpischil Feb 07 '18 at 06:28
  • @IharobAlAsimi This was on a mac. I'm looking for a reference to lookup what rule I've violated – chf2117 Feb 08 '18 at 16:03
  • @chf2117 It doesn't matter from a practical point of view. Because what you really need to know is where you did so. And knowing what happened will just be good to suspect from this or that code. But since there exists the concept of *undefined behavior*, there is no benefit in knowing what the fault means, because it's cause might not be directly clear from your code. I don't mean that you shouldn't know them, I mean that it wont help you as much as you think. The knowledge is always valuable of course. – Iharob Al Asimi Feb 08 '18 at 16:19
  • @chf2117 So instead learn what is Undefined Behavior, when it happens and how you can avoid it, that way you will also automagically learn what *SIGSEGV*'s are and why the system delivers a signal to your program and terminates it when it violates the rules. – Iharob Al Asimi Feb 08 '18 at 16:21

1 Answers1

1

I misunderstood the error message. SIGABRT is defined as 6, 6 does not give any information about what caused abort() to be called.

The signal codes and brief descriptions are defined in <signal.h> which is located at /usr/include/sys/signal.h on my machine. More detailed descriptions can be found at https://en.wikipedia.org/wiki/Signal_(IPC)

chf2117
  • 166
  • 9