Linux kernel hardware break points

跟風遠走 提交于 2020-01-01 17:12:32

问题


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)?


回答1:


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.



来源:https://stackoverflow.com/questions/16362063/linux-kernel-hardware-break-points

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!