Mac 上的核心转储写在哪里?
在 Mac OS X 上,如果我向 C 程序发送 SIGQUIT,它会终止,但没有核心转储文件。
您是否必须在 Mac OS X 上手动启用核心转储(如何?),或者它们是否写入其他位置而不是工作目录?
On Mac OS X, if I send SIGQUIT to my C program, it terminates, but there is no core dump file.
Do you have to manually enable core dumps on Mac OS X (how?), or are they written to somewhere else instead of the working directory?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
看来他们默认是被压制的。运行
将为当前终端启用核心转储,并将其作为
core.PID
放置在/cores
中。当您打开新会话时,它将再次设置为默认值。It seems they are suppressed by default. Running
Will enable core dumps for the current terminal, and it will be placed in
/cores
ascore.PID
. When you open a new session, it will be set to the default value again.在 macOS 上,您的故障转储由故障报告器自动处理。
您可以通过执行Console并转到用户诊断报告来查找回溯文件 部分(在“诊断和使用信息”组下),或者您可以在
~/Library/Logs/DiagnosticReports
中找到它们。您还可以通过监视
system.log
文件来检查转储的生成位置,例如您可以在
/cores
中找到实际的core 转储文件。另请参阅:
On macOS, your crash dumps are automatically handled by Crash Reporter.
You can find backtrace files by executing Console and going to User Diagnostic Reports section (under 'Diagnostic and Usage Information' group) or you can locate them in
~/Library/Logs/DiagnosticReports
.You can also check where dumps are generated by monitoring
system.log
file, e.g.The actual core dump files you can find in
/cores
.See also:
此外,/cores 目录必须存在,并且运行该程序的用户必须对其具有写入权限。
Additionally, the /cores directory must exist and the user running the program must have write permissions on it.
上面的答案,
有效 - 但请确保在运行转储核心的程序的同一终端中运行它。您需要先运行 ulimit 命令。
The answer above,
works -- but be sure to run that in the same terminal from which you will run the program that dumps core. You need to run the ulimit command first.
默认情况下,mac osx 中的特定目录是隐藏的。您可能想在终端中启用此功能,然后核心转储应该在目录 /cores 中可见。
by default, specific directories in mac osx are hidden. you might want to enable this feature in the terminal and then the core dump should be visible within the directory /cores.
Apple 论坛上的
Quinn “The Eskimo!”
有一个很好的解释https://developer.apple.com/forums/thread/694233
我大致遵循那个指南。这是我所做的步骤。
授予对
/cores
目录的所有写入权限设置 core 文件的大小
编译并签署程序
运行程序
现在有一个
core
文件还有 Apple 的
Console 应用程序有一个包含
崩溃报告
的列表。There is a great explanation by
Quinn “The Eskimo!”
on Apple's forumshttps://developer.apple.com/forums/thread/694233
I roughly followed that guide. Here are the steps that I did.
Grant write all access to the
/cores
dirSet size of core file
Compile and sign the program
Run the program
Now there is a
core
fileAlso Apple's
Console
app has a list withCrash Reports
.