What is GDB? GDB, the GNU Project debugger, allows you to see what is going on `inside' another program while it executes -- or what another program was doing at the moment it crashed. https://sourceware.org/gdb/onlinedocs/gdb/index.html Off-line Debug When you got segmentation fault , you can use gdb to load the core dump file to debug what happened. But Linux default did not enable core dump file, you will need to enable it by the following command. Beware, ulimit command will set the core dump file size to unlimited, and it will be only enabled in the current shell. ulimit -c unlimited sudo sysctl -w kernel.core_pattern = /tmp/core-%e.%p.%h.%t Compile your program with debug symbols, add "-g" to compile options. g++ -g -std = c++11 -o myprogram myprogram.cpp ` pkg-config opencv --cflags --libs ` Now, run your program again, then you will find the core dump file under /tmp Ex: /tmp/core-myprogram.17521.evan-desktop.1565936379 Use ...