[PATCH] hardware breakpoint doesn't work
Konstantin Baydarov
kbaidarov at ru.mvista.com
Tue Jul 10 09:09:58 PDT 2007
If I get to KDB console hitting software breakpoint and then delete this sw breapoint
and then set hardware breakpoint to the same function - hw breakpoint doesn't
work. Here is log:
Before doing sync, I've set breakpoint to do_sync().
root at 192.168.40.10:~# sync
Instruction(i) breakpoint #0 at 0xc017b64a (adjusted)
0xc017b64a do_sync: int3
Entering kdb (current=0xeffd7a50, pid 2985) on processor 0 due to Breakpoint @
a
[0]kdb> bc 0
Breakpoint 0 at 0xc017b64a cleared
[0]kdb> bph do_sync
Forced Instruction(Register) BP #0 at 0xc017b64a (do_sync)
is enabled in dr0 on cpu 0
[0]kdb> go
root at 192.168.40.10:~#
root at 192.168.40.10:~#
root at 192.168.40.10:~# sync
root at 192.168.40.10:~#
root at 192.168.40.10:~#
The reason of issue:
When KDB executes singe-step over breakpoint it forgets to clear pending
single step exception flag. And if after that hardware breakpoint is triggered
KDB thinks that it's single step and ignores hw breakpoint.
How solved:
Single-step exception pending flag is cleared when kernel enters to KDB
during single-step over breakpoint.
Patch against kernel 2.6.22. It fixes i386 and x86_64 kernels. Thanks.
Signed-off-by: Konstantin Baydarov <kbaidarov at ru.mvista.com>
arch/i386/kdb/kdba_bp.c | 4 ++++
arch/x86_64/kdb/kdba_bp.c | 4 ++++
2 files changed, 8 insertions(+)
Index: linux-2.6.22/arch/i386/kdb/kdba_bp.c
===================================================================
--- linux-2.6.22.orig/arch/i386/kdb/kdba_bp.c
+++ linux-2.6.22/arch/i386/kdb/kdba_bp.c
@@ -108,6 +108,10 @@ kdba_db_trap(struct pt_regs *regs, int e
kdba_installbp(regs, bp);
if (!KDB_STATE(DOING_SS)) {
regs->eflags &= ~EF_TF;
+ /*
+ * Clear the pending exceptions.
+ */
+ kdba_putdr6(0);
return(KDB_DB_SSBPT);
}
break;
Index: linux-2.6.22/arch/x86_64/kdb/kdba_bp.c
===================================================================
--- linux-2.6.22.orig/arch/x86_64/kdb/kdba_bp.c
+++ linux-2.6.22/arch/x86_64/kdb/kdba_bp.c
@@ -108,6 +108,10 @@ kdba_db_trap(struct pt_regs *regs, int e
kdba_installbp(regs, bp);
if (!KDB_STATE(DOING_SS)) {
regs->eflags &= ~EF_TF;
+ /*
+ * Clear the pending exceptions.
+ */
+ kdba_putdr6(0);
return(KDB_DB_SSBPT);
}
break;
---------------------------
Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe.
More information about the kdb
mailing list