ptrace, i386 and DR6 register

Eric Pouech (Eric.Pouech@wanadoo.fr)
Sat, 13 Nov 1999 14:37:39 +0000


Hi,

I'm currently toying with ptrace interface on my 2.2.9 / i386 kernel

I do have issues with the debug registers.

what I'd like to be able to do, is, in the superior process, after
a wait returning a stop for a TRAP on the attached process, to read
DR6 with ptrace(PEEK_USER,...) to know which DR[0..3] has triggered
the trap (if any)

all my attemps always result in DR6 being 0

after looking at the code (but I may be plain wrong), it seems
that DR6 (debugreg[6]) is never updated

would something like this (on arch/i386/kernel/traps.c) do ?
--- traps.c.orig Sat Nov 13 15:27:22 1999
+++ traps.c Sat Nov 13 15:29:28 1999
@@ -391,7 +391,9 @@
return;

debug_vm86:
+ __asm__ __volatile__("movl %%db6,%0" : "=r" (condition));
lock_kernel();
+ tsk->tss.debugreg[6] = condition & ~(DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3);
handle_vm86_trap((struct kernel_vm86_regs *) regs, error_code, 1);
unlock_kernel();
return;

THX

A+

-- 
---------------
Eric Pouech (http://perso.wanadoo.fr/eric.pouech/)
"The future will be better tomorrow", Vice President Dan Quayle

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/