Using a stackdump from Cygwin executable

20,062

You can instruct Cygwin to start your gdb debugger just in time when an fault occurs. To achieve this, add error_start=action to the Cygwin environment variable:
export CYGWIN="$CYGWIN error_start=gdb -nw %1 %2"

Else you can have Cygwin generate a real core dump.
export CYGWIN="$CYGWIN error_start=dumper -d %1 %2"

Share:
20,062

Related videos on Youtube

Gerhard
Author by

Gerhard

C & C# Ruby R Embedded & PC PowerPc & AVR

Updated on February 21, 2020

Comments

  • Gerhard
    Gerhard over 4 years

    So I wrote buggy code that occasionally crash ... and creates a stackdump file.

    Using addr2line I can figure out how the program got to the crash point by decoding the addresses on by one. Is there an alternative tool that can ease the debug using stack dumps? Is there a way to to load this information in Insight/Gdb?

  • thoni56
    thoni56 over 8 years
    And run gdb path/to/the/binary path/to/the/core to debug it. Thanks to stackoverflow.com/a/5115653/204658.
  • CMCDragonkai
    CMCDragonkai over 7 years
    With this option error_start=gdb -nw %1 %2 enabled, I have gdb running, however quitting gdb just results it in starting again, how I quit it completely?
  • CMCDragonkai
    CMCDragonkai over 7 years
    I had to go outside and launch process explorer and kill the entire process tree in Windows.
  • Anonymous1847
    Anonymous1847 almost 4 years
    gdb says that it does not recognize the file (with suffix ".stackdump") as a core dump.
  • Anonymous1847
    Anonymous1847 almost 4 years
    @CMCDragonkai For future reference you can just type "kill" in gdb to kill the debugged process and then "quit" to quit gdb as well.