gdb: do not break when watchpoint on local variable goes out of scope

三世轮回 提交于 2019-12-11 01:15:20

问题


I have an application that basically creates a thread many times. I would like to watch changes to a local variable on these threads. I can install a watchpoint dynamically by setting a breakpoint after the variable was initialized, which then automatically installs a watch point whenever such a thread is run:

break somefile.c:123
commands
watch myvar
continue
end

This seems to work great, except that every time one of these threads terminates, gdb breaks with the following message:

Watchpoint 3 deleted because the program has left the block in which its expression is valid.

Which makes sense, because the local variable is going out of scope. But is there any way to make gdb not break when this happens, so that the application keeps running without me having to hit continue countless of times?

来源:https://stackoverflow.com/questions/40266133/gdb-do-not-break-when-watchpoint-on-local-variable-goes-out-of-scope

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!