删除 Linux 内核 3.0.0 中的所有硬件观察点

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10471674/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 06:11:41  来源:igfitidea点击:

Remove all hardware watchpoints in Linux kernel 3.0.0

linuxgdbbreakpointswatchpoint

提问by Sven

After setting the first (and only possible) hardware watchpoint via watch varnamein GDB, it's not possible to remove it via delete.

通过watch varname在 GDB 中设置第一个(也是唯一可能的)硬件观察点后,无法通过删除将其删除。

Even if I just exit GDB, this watchpoint seems to be enabled till the next reboot. When I try to set another hardware watchpoint after GDB is restarted, a kernel message appears in logs telling me, all hardware watchpoints are already taken. It seems like it's the same problem as in Setting GDB hardware watchpoint/how to set software watchpoint, but because I need a hardware watchpoint, the solution does not apply.

即使我只是退出 GDB,这个观察点似乎也一直启用到下次重新启动。当我在 GDB 重新启动后尝试设置另一个硬件观察点时,日志中会出现一条内核消息,告诉我所有硬件观察点都已被占用。这似乎与Setting GDB hardware watchpoint/how to set software watchpoint 中的问题相同,但因为我需要一个硬件观察点,该解决方案不适用。

Is there a tool or a syscall to remove this (or all) hardware watchpoint? The CPU is an Core i5and the Linux kernel is 3.0.0-17-generic from Ubuntu 11.10(Oneiric Ocelot).

是否有工具或系统调用来删除这个(或所有)硬件观察点?CPU 是Core i5,Linux 内核是来自Ubuntu 11.10(Oneiric Ocelot) 的3.0.0-17-generic 。

回答by Employed Russian

After setting the first (and only possible) hardware watchpoint via watch varname in gdb it's not possible to remove it via delete.

通过 gdb 中的 watch varname 设置第一个(也是唯一可能的)硬件观察点后,无法通过删除将其删除。

The statement above is false. What led you to conclude it is true?

上面的说法是错误的。是什么让你得出结论它是真的?

Is there a tool or a syscall to remove this (or all) hardware watchpoint?

是否有工具或系统调用来删除这个(或所有)硬件观察点?

No such tool is necessary. Simply quit GDB, and all breakpoints and watchpoints will be gone. Or do (gdb) delete(without specifying a break point), and confirm that you want to delete all.

不需要这样的工具。只需退出 GDB,所有断点和观察点都将消失。或者执行(gdb) delete(不指定断点),并确认要全部删除。

回答by debug

Use watchpoints (sometimes called data breakpoints). It can handle it as normal breakpoints, as follows:

使用观察点(有时称为数据断点)。它可以像普通断点一样处理,如下:

(gdb) info watchpoints
Num     Type           Disp Enb Address            What
2       acc watchpoint keep y                      x

(gdb) delete 2

(gdb) info watchpoints
No watchpoints.
(gdb)

A good reference is Setting Watchpoints.

一个很好的参考是设置观察点