gdb stacktrace

For my thesis I have been coding in C++. Having to workthrough another persons c++ code is quite the trying task. Especially one that chunks away millions of tuples of just raw numbers. So finding out the stack trace when your c++ code throws the very nice and useful “Segmentation Fault” would be good.

After digging through the net I found a nifty alias for your ubuntu that runs the app in gdb and will throw out the stacktrace if seg fault happens.

Add the following to your .bashrc, source it and your good to go:


alias gcatch='gdb -ex r -ex back -ex q -args'

Thusjanthan

Leave a Reply