Linux内核硬件断点 [英] Linux kernel hardware break points

查看:239
本文介绍了Linux内核硬件断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为x86架构构建一个简单的linux内核调试器。我首先想要设置断点。我想知道是否有用于配置调试器寄存器的内核api,如果有的话,有什么好的文档?如果没有用于调试器寄存器的内核api有关于如何手动正确配置寄存器的文档(使用程序集MOV指令)?

解决方案

这取决于你想要处理的内核版本。



至少从2.6.33开始,内核中设置了一个用于设置硬件断点的API虽然它可能已经改变了版本3.0-3.2。



看看 register_wide_hw_breakpoint()函数在$ code> kernel / events / hw_breakpoint.c 和附近的那些。



文档似乎相当稀缺,但是有一个一个例子如何在内核中使用该API,可能会有所帮助。



可以找到使用该API的更复杂的示例在 RaceHound项目


I want to build a simple linux kernel debugger for the x86 architecture. I first want it to set break points. I was wondering if there is a kernel api for configuring the debugger registers and if so any good documentation? If there is no kernel api for debugger registers is there any documentation on how to properly configure the registers manually(using the assembly "MOV" instruction)?

解决方案

It depends on which kernel versions you would like to handle.

There is an API for setting hardware breakpoints in the kernel at least since 2.6.33, although it might have changed a bit around versions 3.0-3.2.

Take a look at register_wide_hw_breakpoint() function in kernel/events/hw_breakpoint.c and the ones near it.

The documentation seems to be quite scarce but there is an example of how to use that API in the kernel, it may help.

A more complex example using that API can be found in RaceHound project.

这篇关于Linux内核硬件断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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