]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Don't clear DR6 for debug exceptions from userland.
authorJohn Baldwin <jhb@FreeBSD.org>
Thu, 27 Sep 2018 17:33:59 +0000 (17:33 +0000)
committerJohn Baldwin <jhb@FreeBSD.org>
Thu, 27 Sep 2018 17:33:59 +0000 (17:33 +0000)
commit83382d027f64411dc5ac57d25496e8c63d106297
tree2f7a738eb32ab8cc399b7b65b6512dbbb0cfc034
parent5bbde333cdbd9054fd9b4257a2a3e51d4a819ab4
Don't clear DR6 for debug exceptions from userland.

This reverts part of r333368.  The attempt to clear DR6 was occuring
too soon as trapsignal() does not pause to let the debugger notice the
SIGTRAP and query DR6.  The signal exchange does not occur until much
later during ast().  As a result, GDB was no longer recognizing
hardware breakpoints and watchpoints on x86.

In addition, any userland programs that want to inspect DR6 in a
SIGTRAP handler don't have a way to do this if we clear DR6 in the
exception handler.

Instead of relying on the kernel to clear DR6, debuggers will have to
explicitly clear it after a trace trap (which they needed to do on
older kernels anyway).

Reviewed by: kib
Approved by: re (delphij)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D17319
sys/amd64/amd64/trap.c
sys/i386/i386/trap.c