linux下gdb单步调试(GDB single step debugging under Linux)GDB single step debugging under Linux
Set breakpoint (BreakPoint)
We set breakpoints with the break command. How many breakpoints are set on the front?:
Break
Stop when you enter the specified function. In C++, you can specify the function name in class:: function or function (type, type) format.
Break
Stop at the specified line number.
Break +offset
Break -offset
Stops at the front or back of the current line number in the offset row. Offiset is a natural number.
Break filename:linenum
Stop at the linenum row of the source file filename.
Break filename:function
Stop at the entrance of the function function of the source file filename.
Break *address
Stop at the memory address of the program running.
Break
When the break command does not have a parameter, it means that it stops at the next instruction.
Break... If
It can be the parameter mentioned above. Condition represents the condition and stops when the condition is established. For example, in the loop body, you can set the break if i=100 to indicate the stop program when I is 100.
When you look at breakpoints, you can use the info command, as follows: (Note: n represents breakpoint number)
Info breakpoints [n]
Info break [n]
Two. Set observation points (WatchPoint)
Observation points are generally used to observe whether an expression (variable is also an expression) has changed, and if there is a change, stop the program immediately. We have several ways to set up observation points:
Watch
Set an observation point for the expression (variable) expr. Stop the program immediately when there is a change in the expression value.
Rwatch
When the expression of expr (variable) read, stop program.
Awatch
When the expression (variable) values read or written to, stop the program.
Info watchpoints
Lists all the observation points currently set up.
Three, set the capture point (CatchPoint)
You can set up capture po