Core dump analysis using gdb
Solution 1
-
You need to configure Cygwin to produce core dumps by including
error_start=x:\path\to\dumper.exe
in yourCYGWIN
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.
Solution 2
- Yes, cygwin creates
a.exe.stackdump
files by default. You need to configure it to createcore
s as well (Martin's answer covers that). - A simple tutorial on core dump debugging can be found here
Related videos on Youtube
avd
Updated on April 15, 2022Comments
-
avd about 2 years
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?
-
avd over 14 yearsHow to modify cygwin environment variable?
-
Martin B over 14 yearssee en.wikipedia.org/wiki/Environment_variable. If you're using Cygwin, I would strongly recommend that you read up on some Unix basics -- you're going to need them.
-
avd over 14 yearsActually I know the concept of environment variable. I understood what u r saying, setting environment variable named "error_start". I am asking where should I define the new environment variable? at the same place (my computer->properties->...) ?
-
Martin B over 14 yearsThat's an option -- but a better place is probably in cygwin.bat, since the variable is specific to Cygwin. Or, for testing, just set the variable from the bash shell (using the
export
command) just before you run the executable you're testing. -
avd over 14 yearsI did this in cygwin shell before running my executable. "export error_start=/c/cygwin/bin/dumper.exe". Still it did not generate the core file.
-
Martin B over 14 yearsTry
CYGWIN=error_start=c:\cygwin\bin\dumper.exe
. See also mail-archive.com/[email protected]/msg77667.html for more advice. -
avd over 14 yearsThank you very much for the answer. Got it finally by adding "set CYGWIN=error_start=c:\cygwin\bin\dumper.exe"
-
Lumi over 12 yearsWhen using Bash and
export
, you need to quote the backslashes:export CYGWIN='error_start=C:\Opt\Cygwin\bin\dumper.exe'