Code: Select all
~/test > cat causeCoreDump.cpp
#include <iostream>
using namespace std;
int main()
{
int array[100];
int x = 10000;
array[x] = 42; // Over index the array.
return 0;
}
~/test > g++44 -g -m64 causeCoreDump.cpp -o causeCoreDump.exe
~/test > ./causeCoreDump.exe
Segmentation fault (core dumped)
~/test > gdb causeCoreDump.exe core.5815
GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /npd/kbisanz/test/causeCoreDump.exe...done.
warning: core file may not match specified executable file.
[New Thread 5815]
Reading symbols from /usr/lib64/libstdc++.so.6...(no debugging symbols found)...done.
Loaded symbols for /usr/lib64/libstdc++.so.6
Reading symbols from /lib64/libm.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib64/libm.so.6
Reading symbols from /lib64/libgcc_s.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib64/libgcc_s.so.1
Reading symbols from /lib64/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib64/libc.so.6
Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Core was generated by `./causeCoreDump.exe'.
Program terminated with signal 11, Segmentation fault.
#0 0x0000000000400673 in main () at causeCoreDump.cpp:9
9 array[x] = 42; // Over index the array.
(gdb) where
#0 0x0000000000400673 in main () at causeCoreDump.cpp:9
(gdb) print x
$1 = 10000
(gdb)
If you get a core from the algorithm, you can also upload that.