【发布时间】:2015-10-24 11:52:07
【问题描述】:
我使用的是 Mac OS X 10.10。
我注意到我的硬盘已满,因为每隔几分钟,/cores 中就会出现一个新的核心转储文件:
$ ls -alhtr /cores
total 3551488
-rw-r--r--@ 1 saqib admin 6.0K Apr 24 12:38 .DS_Store
drwxr-xr-x 32 root admin 1.1K Aug 1 17:00 ../
-r-------- 1 saqib admin 578M Aug 1 22:36 core.35049
-r-------- 1 saqib admin 578M Aug 1 22:37 core.35202
drwxrwxr-t@ 6 root admin 204B Aug 1 22:38 ./
-r-------- 1 saqib admin 578M Aug 1 22:38 core.35438
但我不知道哪些进程正在创建这些核心文件。文件名中的数字应该代表创建它们的进程的 PID。但当然,这些过程现在已经死了。那么如何确定是哪个进程创建了这些内核,以便修复/删除它呢?
编辑 1
在核心文件上执行gdb -c 并没有提供我需要的信息:
$ gdb -c /cores/core.35438
GNU gdb (GDB) 7.8.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin14.0.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
"/cores/core.35438": no core file handler recognizes format
(gdb)
编辑 2
file 似乎也不起作用:
$ file /cores/core.35049
/cores/core.35049: Mach-O core i386
编辑 3
我使用名为MachOView 的应用程序打开了核心文件。你可以看到它向我展示的屏幕截图。我还是不知道是哪个应用创建了这个核心文件。
【问题讨论】:
-
没有直接关系,但是你看过CrashReporter吗?它应该默认启用并记录所有崩溃,但您可能希望将其设置为开发人员模式,如 this wiki page 所示
-
运行一个小循环,每秒将所有进程 ID 存储到一个文件中,然后等待核心到达,使用 Ctrl-C 停止循环,并检查文件中的 processId。
while :; do ps -aef >> /tmp/pids.txt; sleep 1; done
标签: unix osx-yosemite pid coredump