It recommended CGDB, easy to use than GDB, VC familiar with the debug mode, you can use DDD. Note To add "-g" parameter when using the GCC compiler. Reference gdb reference card GDB basic commands are:
- gdb programm (start GDB)
- b breakpoint (breakpoint to be set up four kinds: line breakpoint, the breakpoint function, conditional breakpoints, a temporary breakpoint)
- run starts running program
- bt print function call stack
- p View variable values
- c continue to run from the current breakpoint to the next breakpoint
- Single step n
- Single step s
- quit quit GDB
Question: GDB of n (next) command to make GDB execute the next line, then paused. The role of s (step) command similar to this, except when a function call command step into the function, then the actual use which should be preferred? why?
I think it should have several other debug commands are:
- Change tracking display variable values
- until out of the loop
- finish out of a function
- help help
Learning Reference:
- Chen Hao GDB tutorial with the GDB debugger
- Software debugging art ( electronic version )