gdb debug 情形讨论一
- 断在变量特殊值下
- 我的变量值被谁偷偷改了?
-O2 过度优化可能会导致 No symbol “i” in current context.
调试循环中特定变量的值
break point 要打到 brace 里面
1 |
|
condition
1 | (gdb) b test.cpp:6 |
等同于
1 | b test.cpp:6 if i == 5 |
example 2
1 |
|
1 | (gdb) b test.cpp:9 if i == 6 |
gdb debug 情形讨论一
-O2 过度优化可能会导致 No symbol “i” in current context.
break point 要打到 brace 里面
1 |
|
condition
1 | (gdb) b test.cpp:6 |
等同于
1 | b test.cpp:6 if i == 5 |
example 2
1 |
|
1 | (gdb) b test.cpp:9 if i == 6 |
gdb debug 情形讨论一