Page MenuHomeFreeBSD

Reliably enable debug exceptions on all CPUs.
ClosedPublic

Authored by jhb on Aug 12 2017, 3:37 AM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 20 2023, 12:04 AM
Unknown Object (File)
Nov 15 2023, 6:08 PM
Unknown Object (File)
Nov 15 2023, 5:33 PM
Unknown Object (File)
Nov 7 2023, 6:26 AM
Unknown Object (File)
Nov 5 2023, 5:26 AM
Unknown Object (File)
Oct 14 2023, 5:08 PM
Unknown Object (File)
Oct 14 2023, 4:30 PM
Unknown Object (File)
Oct 6 2023, 5:21 AM
Subscribers

Details

Summary

Previously, debug exceptions were only enabled on the boot CPU if
DDB was enabled in the dbg_monitor_init() function. APs also called
this function, but since mp_machdep.c doesn't include opt_ddb.h, the
APs ended up calling an empty stub defined in <machine/debug_monitor.h>
instead of the real function. Also, if DDB was not enabled in the kernel,
the boot CPU would not enable debug exceptions.

Fix this by adding a new dbg_init() function that always clears the OS
lock to enable debug exceptions which the boot CPU and the APs call.
This function also calls dbg_monitor_init() to enable hardware breakpoints
from DDB on all CPUs if DDB is enabled. Eventually base support for
hardware breakpoints/watchpoints will need to move out of the DDB-only
debug_monitor.c for use by userland debuggers.

Test Plan
  • cpuset -l 0 gdb /bin/ls and single step would work
  • cpuset -l 1 gdb /bin/ls and single step would not

Diff Detail

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

Event Timeline

sys/arm64/arm64/machdep.c
225 ↗(On Diff #31974)

This includes D11972 because I tested these in a shared tree, but I will commit D11972 first.

I think Semihalf was only interested in the kernel debugger when they added this.

This revision is now accepted and ready to land.Aug 12 2017, 7:49 AM
This revision was automatically updated to reflect the committed changes.