当只有一个观察点时,gdb 会因太多观察点而停止 [英] gdb stops with too many watchpoints when there is only one

查看:14
本文介绍了当只有一个观察点时,gdb 会因太多观察点而停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

除了太多的硬件断点/观察点之外,您知道导致无法插入观察点的其他原因吗?

Do you know any other reasons why a watchpoint could not be inserted other than too many hardware breakpoints/watchpoints?

我有以下调试会话:

GNU gdb (GDB) 7.1
...
(gdb) watch itrap_t_beg[1][222]
Hardware watchpoint 1: itrap_t_beg[1][222]
(gdb) cont
Continuing.
...
Hardware watchpoint 1: itrap_t_beg[1][222]

...
(gdb) cont
Continuing.
Warning:
Could not insert hardware watchpoint 1.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.

(gdb) info break
Num     Type           Disp Enb Address            What
1       hw watchpoint  keep y                      itrap_t_beg[1][222]
        breakpoint already hit 1 time

如您所见,只有一个观察点但无法插入断点.

As you can see, there's only one watchpoint yet it can't insert the breakpoint.

你知道我该如何解决这个问题吗?

Do you know how can I fix this?

推荐答案

据我所知,商品 x86 CPU 有四个 调试寄存器可用于支持硬件中断/监视.这限制了您可以观看的对象大小.对象对齐也在这里起作用.

As far as I know commodity x86 CPUs have four debug registers available for supporting hardware breaks/watches. This limits the object size that you can watch. Object alignment also plays here.

尝试将监视范围限制为较小的对象,例如结构的第一个和最后一个成员.

Try limiting the watch scope to a smaller object like pair of first and last members of the structure.

这篇关于当只有一个观察点时,gdb 会因太多观察点而停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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