GDB: break if variable equal value
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I like to make GDB set a break point when a variable equal some value I set, I tried this example: #include main() { int i = 0; for(i=0;i Output from GDB: (gdb) break if ((int)i == 5) No default breakpoint address now. (gdb) run Starting program: /home/SIFE/run 0 1 2 3 4 5 6 Program exited normally. (gdb) Like you see, GDB didn't make any break point, is this possible with GDB? 回答1: in addition to a watchpoint nested inside a breakpoint you can also set a single breakpoint on the 'filename:line_number' and use a condition. I find it