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)
Thu, Mar 7, 11:45 PM
Unknown Object (File)
Jan 29 2024, 6:41 PM
Unknown Object (File)
Jan 1 2024, 4:22 AM
Unknown Object (File)
Dec 26 2023, 12:13 AM
Unknown Object (File)
Dec 20 2023, 5:08 AM
Unknown Object (File)
Nov 24 2023, 8:35 AM
Unknown Object (File)
Nov 24 2023, 8:31 AM
Unknown Object (File)
Nov 14 2023, 9:12 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