ulimit -c unlimitedBefore running your program.
Once the core file is generated (say core), we can check the stack trace using GDB:
Special Notes for Cygwin
gdb program_file coreThen type GDB command
wherewhich will show you the stack trace.
Special Notes for Cygwin
When a process (i.e. foo.exe) cores, a default stackdump foo.exe.stackdump is generated. This stackdump contains (among other things) stack frames and functions addresses. You can make some sense of it by using the `addr2line' utility, but it's not as convenient as using a debugger.
Which takes me to the actual useful bit on information in this post. You can instruct Cygwin to start your gdb debugger just in time when an fault occurs or have Cygwin generate a real core dump.
To achieve this, add `error_start=action' to the Cygwin environment variable:
# start gdb
export CYGWIN="$CYGWIN error_start=gdb -nw %1 %2"
# generate core dump
export CYGWIN="$CYGWIN error_start=dumper -d %1 %2"
No comments:
Post a Comment