Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Core dump analysis using gdb

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?

like image 490
avd Avatar asked Feb 01 '10 11:02

avd


2 Answers

  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.

like image 199
Martin B Avatar answered Sep 22 '22 23:09

Martin B


  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
like image 35
Yuval Adam Avatar answered Sep 22 '22 23:09

Yuval Adam