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

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

问题描述

您知道为什么除了太多的硬件断点/观察点之外无法插入观察点吗?



我有以下调试会话:

  GNU gdb(GDB)7.1 
...
(gdb)watch itrap_t_beg [1] [222]
硬件观察点1:itrap_t_beg [1] [222]
(gdb)cont
继续。
...
硬件观察点1:itrap_t_beg [1] [222]

...
(gdb)cont
继续。
警告:
无法插入硬件观察点1.
无法插入硬件断点:$ b​​ $ b您可能请求太多硬件断点/观察点。

(gdb)信息中断
数字类型显示地址什么
1 hw监视点保存y itrap_t_beg [1] [222]
断点已经命中1次

正如您所看到的,只有一个观察点,但它不能插入断点。 b
$ b

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

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



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


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

I have the following debug session:

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?

解决方案

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天全站免登陆