这个 strace 消息的含义是什么?

这个 strace 消息的含义是什么?

我的程序在 Ubuntu 18.04 上运行一段时间后崩溃了,最后几行strace是这样的:

6260  openat(AT_FDCWD, "/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
6260  openat(AT_FDCWD, "/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
6260  openat(AT_FDCWD, "/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
6260  openat(AT_FDCWD, "/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
6260  openat(AT_FDCWD, "/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
6260  openat(AT_FDCWD, "/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
6260  openat(AT_FDCWD, "/usr/share/locale-langpack/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
6260  openat(AT_FDCWD, "/usr/share/locale-langpack/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
6260  openat(AT_FDCWD, "/usr/share/locale-langpack/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
6260  openat(AT_FDCWD, "/usr/share/locale-langpack/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
6260  openat(AT_FDCWD, "/usr/share/locale-langpack/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
6260  openat(AT_FDCWD, "/usr/share/locale-langpack/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
6260  write(2, "terminate called after throwing "..., 48) = 48
6260  write(2, "std::system_error", 17) = 17
6260  write(2, "'\n", 2)                = 2
6260  write(2, "  what():  ", 11)       = 11
6260  write(2, "Unknown error -1", 16)  = 16
6260  write(2, "\n", 1)                 = 1
6260  rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0
6260  rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [], 8) = 0
6260  getpid()                          = 6260
6260  gettid()                          = 6260
6260  tgkill(6260, 6260, SIGABRT)       = 0
6260  rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
6260  --- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=6260, si_uid=1000} ---
6260  +++ killed by SIGABRT (core dumped) +++

我对上述消息的理解是libc.mo找不到。我的理解对吗?如果是,我该如何修复它?如果没有,有人可以给我一些如何检测崩溃原因的指示吗?

答案1

从 strace 输出中,您可以看到程序正在搜索 file libc.mo,但这不是这里的问题。该.mo文件包含翻译,如果找不到,消息通常会以英文显示。从路径名来看,您的区域设置似乎是en_US,因此您不需要翻译。

该问题的提示如下:

6260  write(2, "terminate called after throwing "..., 48) = 48
6260  write(2, "Unknown error -1", 16)  = 16

使用更大的尺寸来显示“抛出”(或更多)后被截断的消息-s 50。它可能包含异常类名称。另一个提示是“未知错误-1”,通常没有帮助。

如果它不仅仅是一个程序,而是您的程序,请在调试器中运行它。您应该获得回溯和更多有用的信息。

相关内容