Jefferson Steelflex Jefferson Steelflex - 1 year ago 389
C Question

Abort trap: 6 in C Program

I have a program in C. It compiles successfully and runs works fine but right at the end of

, it crashes and gives me an
Abort trap: 6

I haven't the slightest clue as to how I can debug this. The few questions on SO having to do with
Abort trap: 6
errors have not been of much help to me.

In general, what could be the problem?

(I am reluctant to post my source code for now since it is around 400 lines of code. I would post a particular chunk of code if I knew what to look for.)

Note: I am running the program in Terminal using
. But when I run it in XCode, my program crashes and if I stop it, it ends with
exit code: 9

This is the output from

Process 1191 stopped
* thread #1: tid = 0xa759, 0x00007fff8fa08286 libsystem_kernel.dylib`__pthread_kill + 10, queue = '', stop reason = signal SIGABRT
frame #0: 0x00007fff8fa08286 libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill + 10:
-> 0x7fff8fa08286: jae 0x7fff8fa08290 ; __pthread_kill + 20
0x7fff8fa08288: movq %rax, %rdi
0x7fff8fa0828b: jmp 0x7fff8fa03c53 ; cerror_nocancel
0x7fff8fa08290: retq

Answer Source

You are probably writing to memory you do not own! But you know we can not say more without the code, but I see why you do not post it.

Similar question

I would suggest reading again your code super-carefully and look out for your counter and indices (variables named i, j and so on).

Exit code 9 smells like signal handling going wrong. Check this question.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download