中止陷阱:6 C程序 [英] Abort trap: 6 in C Program

查看:212
本文介绍了中止陷阱:6 C程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个程序C.它成功地编译和运行工作正常,但就在年底的main(),它崩溃并给了我一个中止陷阱:6 错误

我没有丝毫的线索,我怎么能调试此。 6 错误都没有多大帮助我

:对SO具有做中止陷阱的几个问题

在一般情况下,这可能是问题?

(我不愿意发布我的源$ C ​​$ C现在既然是约400 code线。我会张贴code的特定块,如果我知道要寻找什么。)

请注意:我使用的程序运行在终端 GCC 。 9

:但是当我在X code运行它,我的程序崩溃,如果我停止它,它与退出code结束

这是从输出 LLDB

 过程停止1191
*线#1:TID = 0xa759,0x00007fff8fa08286 libsystem_kernel.dylib`__pthread_kill + 10,队列='com.apple.main线程,停止的原因=信号SIGABRT
    帧#0:0x00007fff8fa08286 libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill + 10:
- > 0x7fff8fa08286:宰0x7fff8fa08290; __pthread_kill + 20
   0x7fff8fa08288:MOVQ%RAX,%RDI
   0x7fff8fa0828b:JMP 0x7fff8fa03c53; cerror_nocancel
   0x7fff8fa08290:retq


解决方案

您的可能写入内存你不拥有!但你知道没有code,我们不能说更多,但我看到你为什么不张贴。

类似问题

我建议看一次你的code超仔细,并期待您的计数器和索引(变量名为 I Ĵ等)。


退出code 9 闻起来像的信号处理走错了。检查这个问题

I have a program in C. It compiles successfully and runs works fine but right at the end of main(), it crashes and gives me an Abort trap: 6 error.

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 GCC. 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 lldb:

Process 1191 stopped
* thread #1: tid = 0xa759, 0x00007fff8fa08286 libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread', 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 

解决方案

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.

这篇关于中止陷阱:6 C程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆