Page MenuHomeFreeBSD

Don't clear DR6 for debug exceptions from userland.
ClosedPublic

Authored by jhb on Sep 25 2018, 7:24 PM.
Tags
None
Referenced Files
Unknown Object (File)
Nov 19 2024, 5:37 AM
Unknown Object (File)
Oct 7 2024, 11:40 AM
Unknown Object (File)
Sep 27 2024, 5:26 AM
Unknown Object (File)
Sep 23 2024, 3:28 PM
Unknown Object (File)
Sep 18 2024, 12:30 AM
Unknown Object (File)
Sep 16 2024, 12:31 PM
Unknown Object (File)
Sep 11 2024, 12:08 AM
Unknown Object (File)
Sep 10 2024, 10:28 PM
Subscribers

Details

Summary

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

Test Plan
  • tested watchpoints in gdb under both amd64 and i386 and found they didn't work on stock HEAD but did work again after reverting this change.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable