Notes

gdb

Tutorial

https://linuxtools-rst.readthedocs.io/zh_CN/latest/tool/gdb.html

Deal with Segmentation Fault

Set -g flag for compiler,

g++ -g -Wall -O3 ...
bash

Set core dump,

ulimit -c unlimited # this should be run every time 
bash

Run program and got Segmentation Fault (core dumped),

./god_damn_program 
# Segmentation Fault
# a `core` should be generated in current dir
bash

Run gdb,

gdb ./god_damn_program ./core

$gdb info stack # show traceback
# ctrl-d to exit
bash

seg fault in python that calls c

gdb --args python main.py
....................
......greetings.....
....................
run
....................
... the seg fault...
....................
bt
bash

Type to search.