问题
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?
回答1:
You need to configure Cygwin to produce core dumps by including
error_start=x:\path\to\dumper.exe
in yourCYGWINenvironment 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.
回答2:
- Yes, cygwin creates
a.exe.stackdumpfiles by default. You need to configure it to createcores as well (Martin's answer covers that). - A simple tutorial on core dump debugging can be found here
来源:https://stackoverflow.com/questions/2176299/core-dump-analysis-using-gdb