我有一个对象的64位引用,其中引用的低32位被0xFFFFFFFF覆盖。我无法弄清楚如何在引用本身的字节上设置数据断点,因为监视窗口使我无法获取引用的地址。
答案 0 :(得分:1)
我看到了两种解决方案(如果我正确理解了这个问题):
class object_t
{
public:
int i;
};
class test_t
{
public:
int64_t dummy {};
object_t& ro;
test_t( object_t& aro ) : ro { aro } {}
};
int main()
{
object_t obj;
test_t c { obj };
// without dummy
int64_t* p = (int64_t*)&c;
*(int32_t*)p = 0xffffffff; // simulates memory corruption
c.ro.i = 0; // exception
// with dummy
int64_t* p = (int64_t*)&c;
*(int32_t*)p = 0xffffffff; // will break
return 0;
}
答案 1 :(得分:0)
我不知道直接执行此操作的任何方法。但是,这是一个可能的解决方案:
esp
/ rsp
)。如果引用在不在堆栈中的对象中,则使用this
指针。