使用 gdb 进行核心转储分析
我有几个关于核心转储的问题。我在 Windows 上有 gdb,使用 Cygwin。
核心转储文件的位置是什么?它是.exe.stackdump 文件吗? (这是崩溃后生成的唯一文件)我在其他论坛上读到核心转储文件名为“core”。但我没有看到任何名为“core”的文件。
打开并理解核心转储文件的命令是什么?
I have a couple of questions regarding core dumps. I have gdb on Windows, using Cygwin.
What is the location of core dump file? Is it a.exe.stackdump file? (This is the only file that generated after crash) I read on other forums that the core dump file is named "core". But I don't see any file with name "core".
What is the command for opening and understanding core dump file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要配置 Cygwin 以通过包含来生成核心转储
error_start=x:\path\to\dumper.exe
在您的
CYGWIN
环境变量中(请参阅此处 在“dumper”部分了解更多信息)。如果您没有这样做,您只会获得堆栈跟踪 - 不过,这也可能有助于您诊断问题。按如下方式启动 gdb,将其附加到核心转储文件:
gdb myexecutable --core=mycorefile
现在,您可以使用常用的 gdb 命令来打印堆栈跟踪、检查变量的值等。
You need to configure Cygwin to produce core dumps by including
error_start=x:\path\to\dumper.exe
in your
CYGWIN
environment variable (see here in section "dumper" for more information). If you didn't do this, you will only get a stacktrace -- which may also help you in diagnosing the problem, though.Start gdb as follows to attach it to a core dump file:
gdb myexecutable --core=mycorefile
You can now use the usual gdb commands to print a stacktrace, examine the values of variables, and so on.
a.exe.stackdump
文件。您还需要配置它来创建核心
(马丁的回答涵盖了这一点)。a.exe.stackdump
files by default. You need to configure it to createcore
s as well (Martin's answer covers that).