全局变量已更改,但内存断点未被击中 [英] Global variable is changed, but memory breakpoint is not hit

查看:131
本文介绍了全局变量已更改,但内存断点未被击中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个bool变量应该是true,但有时设置为false。我设置了一个内存断点,看看是怎么变化的。令我吃惊的是,这个断点并没有被击中,而是变量再次变为虚假。



什么可以改变内存而没有内存断点捕捉? $ b

解决方案

几个想法。


  1. 如果将bool值传递给内核函数,并且它正在更改它(或者也许内核函数调用是覆盖内存因为它被称为不正确),那么这将不会触发数据断点。


  2. 如果您正在使用多个进程和另一个进程,那么没有被调试,写入该内存位置,那么断点不会被触发。


  3. (编辑)正如注释中所指出的那样,一个DMA到内存中的硬件断点也不会被拿起来。


我的猜测是你没有正确地检查缓冲区大小某个地方,当你从文件读取数据时,(1)可能会受到打击?


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?

解决方案

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?

这篇关于全局变量已更改,但内存断点未被击中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆