硬件观察点-它们如何工作? [英] Hardware watchpoints - how do they work?

查看:88
本文介绍了硬件观察点-它们如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

GDB监视点如何工作?可以实现类似的功能来利用已定义位置的字节级访问吗?

How do GDB watchpoints work? Can similar functionality be implemented to harness byte level access at defined locations?

推荐答案

我相信gdb使用MMU来使内存页包含观察到的地址范围的标记为受保护-然后,当发生写入受保护页面的异常时,gdb处理该异常,检查该写入的地址是否对应于特定的观察点,然后恢复或下降到gdb

I believe gdb uses the MMU so that the memory pages containing watched address ranges are marked as protected - then when an exception occurs for a write to a protected pages gdb handles the exception, checks to see whether the address of the write corresponds to a particular watchpoint, and then either resumes or drops to the gdb command prompt accordingly.

您可以使用 mprotect ,但是如果您想做更复杂的事情而不是仅仅因为写错而失败,就需要实现异常处理程序。

You can implement something similar for your own debugging code or test harness using mprotect, although you'll need to implement an exception handler if you want to do anything more sophisticated than just fail on a bad write.

这篇关于硬件观察点-它们如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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