如何实现/设置数据断点? [英] How to implement/set a data breakpoint?

查看:66
本文介绍了如何实现/设置数据断点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当内存位置更改或写入时,我需要生成中断.从 ISR 中,我可以触发蓝屏,它为我提供了带有方法名称的漂亮堆栈跟踪.

I need to generate an interrupt, when a memory location changes or is written to. From an ISR, I can trigger a blue screen which gives me a nice stack trace with method names.

  • 测试计时器 ISR 中的值.显然,这不会产生令人满意的结果.
  • 我发现了 bochs 虚拟机.它有一个基本的内置调试器,可以设置数据断点并停止程序.但那时我似乎无法产生中断.
  • bochs 允许将 gdb 连接到它.不过,我无法在 gdb 支持下构建它.
  • Testing the value in the timer ISR. Obviously this doesn't give satisfying results.
  • I discovered the bochs virtual machine. It has a basic builtin debugger that can set data breakpoints and stop the program. But I can't seem to generate an interrupt at that point.
  • bochs allows one to connect a gdb to it. I haven't been able to build it with gdb support though.
  • 一种预览指令"中断,在执行每条指令之前触发.使用的内存写入指令集应该很容易管理,但我认为提取地址仍然是一个 PITA.我认为没有这样的中断.
  • 一种预览内存访问"中断.再说一次,我不认为它在那里.
  • 滥用分页.将感兴趣的页面标记为不存在并测试页面错误处理程序中的地址.仍然需要区分读取和写入操作,我认为,页面错误处理程序不会知道确切的地址,只知道页码.

推荐答案

参见英特尔 软件开发人员手册第 3A 卷.它提供了有关使用调试寄存器的信息,这些寄存器为在访问某个地址时引发调试器异常提供支持等.中断将在引起中断的指令之后触发.具体来说,您必须将 dr0-dr3 之一设置为您要查看的地址,并将 dr7 设置为正确的值,以告诉处理器哪些类型的访问会导致中断.

See chapter 16 in Intel's Software Developer's Manual Volume 3A. It gives information about using the debug registers, which provide support for causing the debugger exception when accessing a certain address, among other things. The interrupt will be triggered after the instruction which caused it. Specifically, you will have to set one of dr0-dr3 to the address you want to watch, and dr7 with the proper values to tell the processor what types of accesses should cause the interrupt.

这篇关于如何实现/设置数据断点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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