仅当在 NetBeans 中运行 C 代码时才会出现错误

发布于 2024-09-19 21:17:53 字数 213 浏览 1 评论 0原文

从 Netbeans 6.8 内部运行一段 C 代码会导致分段错误。但在调试模式或从 shell 运行时,问题不会出现。在 Netbeans 的外部终端和输出窗口中都进行了尝试。

该进程是线程化的,并使用发送信号的计时器,我使用 pthread_sigmask 对不相关的线程进行屏蔽。

我看到一些关于在调试模式下隐藏错误的事情,但是为什么它们在 shell 中运行时也可以隐藏?

Running a piece of C code from inside Netbeans 6.8 causes a Segmentation Fault. But the problem doesn't appear when running in debugging mode or from shell. Tried both in external terminal and output window of Netbeans.

The process is threaded, and uses an itimer that sends a signal, which I am masking with pthread_sigmask for threads that are irrelevant.

I saw some things about bugs hiding in debugging mode, but why could they also be hidden when running in shell?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

扮仙女 2024-09-26 21:17:54

当您的程序表现出任何未定义的行为时,操作环境的任何变化都可能导致应用程序表现不同。这种不同的行为可能是也可能不是崩溃。

如果应用程序是多线程的,则可能会遇到一些竞争条件。最好的办法是获取核心转储并进行调查。

When your program exhibits any undefined behaviour, any change in the operating environment can cause the application to behave differently. This different behaviour may or may not be a crash.

If the application is multithreaded, you may have some race conditions. Best bet is to take the core dump and investigate.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文