Using gdb debugging techniques

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:

Published 23 original articles · won praise 2 · views 10000 +

Guess you like

Origin blog.csdn.net/wenson0705/article/details/104814974