Global variable is changed, but memory breakpoint is not hit

隐身守侯 提交于 2019-12-10 18:42:42

问题


I have a bool variable which should be true, but is sometimes set to false. I have set a memory breakpoint to see what is changing that. To my surprise, the breakpoint did not hit, but the variable went to false again.

What could change the memory without memory breakpoint catching it?


回答1:


A few thoughts.

  1. If you pass the bool value into a kernel function and THAT is changing it (or perhaps a kernel function call is overwriting memory because it is called incorrectly) then that won't fire a data breakpoint.

  2. If you are using multiple processes and another process, that isn't being debugged, writes to that memory location then you the breakpoint won't get triggered.

  3. (Edit) As pointed out in the comments a DMA into the memory the hardware breakpoint is on will also not get picked up.

My guess is that you aren't checking a buffer size appropriately somewhere and you are getting hit by (1), perhaps when reading data from a file?



来源:https://stackoverflow.com/questions/2362688/global-variable-is-changed-but-memory-breakpoint-is-not-hit

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