手表GDB内存范围? [英] Watch a memory range in gdb?

查看:250
本文介绍了手表GDB内存范围?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我调试广发行计划,我想程序停止当访问内存区域0x08049000到0x0804a000。当我尝试手动设置内存断点,GDB似乎并不同时支持两个以上的位置。

I am debugging a program in gdb and I want the program to stop when the memory region 0x08049000 to 0x0804a000 is accessed. When I try to set memory breakpoints manually, gdb does not seem to support more than two locations at a time.

(gdb) awatch *0x08049000
Hardware access (read/write) watchpoint 1: *0x08049000
(gdb) awatch *0x08049001
Hardware access (read/write) watchpoint 2: *0x08049001
(gdb) awatch *0x08049002
Hardware access (read/write) watchpoint 3: *0x08049002
(gdb) run
Starting program: /home/iblue/git/some-code/some-executable
Warning:
Could not insert hardware watchpoint 3.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.

有已经在那里这已经被问和回答是,这有可能与Valgrind的做到这一点的问题。很不幸,答案不包含在人工Valgrind的任何实例或参考,所以这是不是很enlightning:<一href=\"http://stackoverflow.com/questions/6764544/how-can-gdb-be-used-to-watch-for-any-changes-in-an-entire-region-of-memory\">How GDB可被用来监视在内存中的整个区域的任何变化?

There is already a question where this has been asked and the answer was, that it may be possible to do this with valgrind. Unfortunately the answer does not contain any examples or reference to the valgrind manual, so it was not very enlightning: How can gdb be used to watch for any changes in an entire region of memory?

所以:我如何可以观看整个内存区域

So: How can I watch the whole memory region?

推荐答案

如果您使用GDB 7.4 Valgrind的3.7.0在一起,那么你有
无限模拟硬件观察点。

If you use GDB 7.4 together with Valgrind 3.7.0, then you have unlimited "emulated" hardware watchpoints.

开始Valgrind的在你的程序中,给参数
    - vgdb =全--vgdb错误= 0
然后用GDB连接到它(目标远程| vgdb )。
然后,你可以如 awatch rwatch 做一个内存范围
   rwatch(CHAR [100])* 0x5180040

Start your program under Valgrind, giving the arguments --vgdb=full --vgdb-error=0 then use GDB to connect to it (target remote | vgdb). Then you can e.g. watch or awatch or rwatch a memory range by doing rwatch (char[100]) *0x5180040

请参见的Valgrind的用户手册上的gdb的整合了解详情

这篇关于手表GDB内存范围?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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