Use GDB to debug code (2-Example)

<1> Using GDB to Debug a Program

bash$ gdb Lab5

<2&5> Specify a condition in the program and apply it to any breakpoint.
Let’s stop a loop at the 99th iteration

(gdb) b 112 if i == 99

<3> Delete breakpoint1

(gdb) delete 1

<4> Print values of variables

(gdb) print i

<2&5> Set breakpoint at specified location.

(gdb) break [LOCATION] [if CONDITION]

where
CONDITION is a boolean expression.

<6> Continue running the code

(gdb) continue // read and skip function
(gdb) step // read line by line

Use GDB to debug code (2-Example)

上一篇:mysql 主从复制原理,概念,故障的检控/分析/处理


下一篇:oracle学习笔记服务启动