gdb notes gdb commands also see: http://www.yolinux.com/TUTORIALS/GDB-Commands.html gcc -c -O0 -Q will show which function is causing it to crash -v will show how cc1 was involked - da dumps the RTL to a file after each stage help Ctrl-c to break Ctrl-d to exit gdb gdb example run run arg1 arg2 // run with command line arguments run arg1 arg2 >file.out // direct results to file gdb file example gdb example core // load after segfault gdb // alternate load [program] break example.c:8. // break on line 8 of file break function break filename:function delete // delete all breakpoints delete example.c:8 // delete that breakpoint clear function // deleate all breakpoints in function info breakpoints // get info on breakpoints save break filename // save breakpoints to file source filename // restore breakpoints set logging on // turn on logging (to gdb.txt) set logging off set logging file // change the logging file name set logging overwrite [on|off] // change to replace/append (off = append is default) set logging redirect [on|off] // change to logging to both tty and file show logging // display logging settings (c)ontinue step // step to next line of code (step into) next // next line (step over) next.[100] // break after 100 next commands until // run to end of current loop backtrace up down frame 3 print buf print x[3].count print list[0]@25 // print 25 elements of list ptype variable // print the type of a variable watch [variable name]. // can break on the watched variable - slows down gdb enormously kill where list [20] // list surrounding lines of code [or around line 20] list [filename][:20]. // either part is optional list function // list function list // now shows next 10 lines call. // call a particular function return // make the curent function return to caller set variable x = 3 // set a variable to something