// set breakpoint in function // compile with gdb support g++ -g -o runme main1.cpp // start gdb gdb runme // set a breakpoint break SumOfTwo // run program run // it should stop upon entering the function SumOfTwo // show a backtrace... backtrace or bt bt // if you want to switch to a specific frame frame 1 // print the variables info locals