strace:发生任何事情之前的 SIGFPE
我在特定机器上执行 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的猜测是,有问题的机器正在运行比其他机器更旧的 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 fromstrace
.仅凭这些信息很难给出答案。您应该尝试在 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.