且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用gdb的核心转储分析

更新时间:2022-04-23 02:15:58


  1. 您需要配置Cygwin以生成核心转储包含

  1. You need to configure Cygwin to produce core dumps by including

error_start = x:\path\to\dumper.exe


在您的 CYGWIN 环境变量中(参见这里在转储部分了解更多信息)。

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.

启动gdb如下所示:如果你没有这样做,你只会得到一个堆栈跟踪 - 这也可以帮助你诊断问题。将其附加到核心转储文件:

Start gdb as follows to attach it to a core dump file:

gdb myexecutable --core = mycorefile


现在,您可以使用常用的gdb命令打印一个stacktrace,检查变量的值,等等。

gdb myexecutable --core=mycorefile

You can now use the usual gdb commands to print a stacktrace, examine the values of variables, and so on.