本文介绍了gdb问题设置硬件观察点/如何设置软件观察点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

前面的问题解释说,在x86上,被监视对象的大小受调试寄存器的限制。 如预期,我可以看一个双变量。但我不能观看双数据成员,例如

 观看pObject-> dPrice 

产生

 硬件观察点1:pObject - > dPrice 

但是当您尝试继续执行时,表示

 无法插入硬件断点:$ b​​ $ b您可能请求了太多的硬件断点/观察点。 

即使这只是断点/观察点。

我很好奇为什么会这样,但更重要的是有办法吗?根据gdb docs它可以使用软件观察点,如果它不能使用硬件。

解决方案

在这种情况下,它不会尝试使用软件观察点 - 可以:

从:

set can-use-hw-watchpoints



    设置是否使用硬件观察点。



show can-use-hw-watchpoints



    显示当前使用硬件观察点的模式。


An earlier question explained that on x86 the size of objects being watched is limited by debug registers. here. As expected, I can "watch" a double variable. But I can't watch a double datamember, eg

watch pObject->dPrice

produces

Hardware watchpoint 1: pObject->dPrice

But when you try to continue execution, it says

Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.

even though this is the only breakpoint/watchpoint.

I'm curious why this is so, but more importantly is there a way around it? According to gdb docs it may use software watchpoints if it can't use hardware. In this case it makes no attempt to use a software watchpoint -- is there a way to force it to do so?

解决方案

Yes you can:

From 5.1.2 Setting Watchpoints:

set can-use-hw-watchpoints

    Set whether or not to use hardware watchpoints.

show can-use-hw-watchpoints

    Show the current mode of using hardware watchpoints.

这篇关于gdb问题设置硬件观察点/如何设置软件观察点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 15:22