什么原因导致SIGABRT故障? [英] What causes a SIGABRT fault?

查看:174
本文介绍了什么原因导致SIGABRT故障?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请告诉我可能会导致C ++中的SIGABRT故障的原因。

Could you please tell me what could possibly cause a SIGABRT fault in C++?

推荐答案

Per 维基百科


当它调用 abort libc函数(在 stdlib.h c $ c>。 SIGABRT 信号可以被捕获,但不能被阻止;如果信号处理程序返回,则所有打开的流被关闭和刷新,并且程序终止(如果适当,转储核心)。这意味着 abort 调用永远不会返回。由于这个特性,它通常用于表示支持库中的致命条件,当前操作无法完成,但主程序可以在退出之前执行清理。

SIGABRT is sent by the process to itself when it calls the abort libc function, defined in stdlib.h. The SIGABRT signal can be caught, but it cannot be blocked; if the signal handler returns then all open streams are closed and flushed and the program terminates (dumping core if appropriate). This means that the abort call never returns. Because of this characteristic, it is often used to signal fatal conditions in support libraries, situations where the current operation cannot be completed but the main program can perform cleanup before exiting. It is used when an assertion fails.

这意味着如果你的代码没有调用 abort 直接也不通过 raise 发送 SIGABRT 信号,并且没有任何失败的断言,原因必须是支持库(可能是libc)遇到内部错误。如果您提供您的计划的详细信息,我们可能能够建议可能的原因。更好的是,如果你检查一个核心或者在调试器中运行你的程序,你应该能够收集一个堆栈跟踪,这将显示哪个库导致你的程序中止。

That means that if your code is not calling abort directly nor sending itself the SIGABRT signal via raise, and you don't have any failing assertions, the cause must be that a support library (which could be libc) has encountered an internal error. If you provide the details of your program we might be able to suggest possible causes. Even better, if you examine a core or run your program in a debugger you should be able to collect a stack trace, which will show which library caused your program to abort.

SIGABRT ,但这在大多数情况下是不太可能的。)

(It is also possible that another program on your system is sending your program SIGABRT, but this is in most cases vanishingly unlikely.)

这篇关于什么原因导致SIGABRT故障?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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