views:

1110

answers:

2

I have a couple of questions regarding core dumps. I have gdb on Windows, using Cygwin.

  1. 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".

  2. What is the command for opening and understanding core dump file?

+3  A: 
  1. 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.

  2. 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.

Martin B
How to modify cygwin environment variable?
avd
see http://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.
Martin B
Actually 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->...) ?
avd
That'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.
Martin B
I 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.
avd
Try `CYGWIN=error_start=c:\cygwin\bin\dumper.exe`. See also http://www.mail-archive.com/[email protected]/msg77667.html for more advice.
Martin B
Thank you very much for the answer. Got it finally by adding "set CYGWIN=error_start=c:\cygwin\bin\dumper.exe"
avd
+1  A: 
  1. Yes, cygwin creates a.exe.stackdump files by default. You need to configure it to create cores as well (Martin's answer covers that).
  2. A simple tutorial on core dump debugging can be found here
Yuval A