strace:发生任何事情之前的 SIGFPE

发布于 2024-10-18 06:24:26 字数 504 浏览 7 评论 0原文

我在特定机器上执行 C++ 程序时遇到问题。这是整个 strace 输出:

26936 execve("/data1/xfm/bin/xfm", ["/data1/xfm/bin/xfm", "-d", "-s", "/data1/smail/", "-p", "/data1/xfm", "-m", "Mailing.176"], [/* 21 vars */]) = 0
26936 uname({sys="Linux", node="smail2.<removed>.com", ...}) = 0
26936 brk(0)                            = 0x98f7000
26936 --- SIGFPE (Floating point exception) @ 0 (0) ---
26936 +++ killed by SIGFPE +++

我在其他几台机器上安装并运行了这个可执行文件,没有任何问题(并且有数千行 strace 输出)。知道是什么导致了我的问题吗?谢谢。

I'm having trouble executing a C++ program on a particular machine. Here is the entire strace output:

26936 execve("/data1/xfm/bin/xfm", ["/data1/xfm/bin/xfm", "-d", "-s", "/data1/smail/", "-p", "/data1/xfm", "-m", "Mailing.176"], [/* 21 vars */]) = 0
26936 uname({sys="Linux", node="smail2.<removed>.com", ...}) = 0
26936 brk(0)                            = 0x98f7000
26936 --- SIGFPE (Floating point exception) @ 0 (0) ---
26936 +++ killed by SIGFPE +++

I'v installed and run this executable on several other machines with no problem (and with thousands of lines of strace output). Any idea what could be causing my problem? Thanks.

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

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

发布评论

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

评论(2

知你几分 2024-10-25 06:24:26

我的猜测是,有问题的机器正在运行比其他机器更旧的 Linux 发行版:据我所知,造成这种情况的通常原因是二进制文件中的符号哈希表与动态链接器之间不匹配。

动态链接的二进制文件(或库)可能在名为 .hash 的部分中具有经典的 ELF 符号哈希表,或者在名为 .gnu 的部分中具有新的 GNU 符号哈希表.hash,或两者兼而有之。

一些较新的发行版默认将 gcc 设置为将标志传递给链接器 (--hash-style=gnu),这会导致它仅发出.gnu.hash 部分。

如果这样的二进制文件在具有不理解 .gnu.hash 的旧动态链接器的旧系统上运行,它就会以这种方式失败。故障发生在动态链接期间的早期阶段(在二进制文件本身实际执行任何操作之前),这就是为什么您几乎没有从 strace 获得任何输出。

My guess would be that the problem machine is running an older Linux distribution that the others: the usual cause of this, as far as I'm aware, is a mismatch between the symbol hash table in the binary, and the dynamic linker.

A dynamically linked binary (or library for that matter) may have either a classic ELF symbol hash table in a section called .hash, or a new GNU symbol hash table in a section called .gnu.hash, or both.

Some more recent distributions have gcc set up to pass a flag to the linker (--hash-style=gnu) by default, which causes it to emit only a .gnu.hash section in the binary.

If such a binary is run on an older system with an old dynamic linker that does not understand .gnu.hash, it will fail in exactly this way. The failure occurs at a very early point, during dynamic linking (before the binary actually does anything itself), which is why you get virtually no output from strace.

半﹌身腐败 2024-10-25 06:24:26

仅凭这些信息很难给出答案。您应该尝试在 gdb 中运行程序或插入 sigfpe 信号处理程序来确定错误的确切位置及其原因。

It's hard to give an answer having only this information. You should try to run your program in gdb or insert sigfpe signal handler to determine the exact position of error and its reason.

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