Retaining Breakpoints Set Before SSM Entry

During SMM entry, the Debug Register DR7 is cleared. This disables software and hardware breakpoints that were set before SMM entry. To work around this behavior:

  1. Select Debug > Create Breakpoint... and switch to the Platform tab to create a platform breakpoint.
  2. Add a breakpoint of type "SMM Entry Break".

  3. Alternatively, enter the command SET BREAK ON "SMM ENTRY BREAK" in the Console window.
  4. Click the Run button.

    The target runs until the breakpoint is hit.

    The SMM entry can be forced on most platforms by writing to port 0xB2. With the debugger you can use the following command to do the port write "set port 0xB2 = 1".

    xdb> SET PORT 0xB2 = 1
    WARNING: Multiple breaks, context is set to the most interesting.
    program stopped: SPECIAL BREAK 'SMM Entry Break' (ID=1) at "0x4200:0x00008000"

    Once the debugger has stopped at the SMM Entry break, it will automatically restore the debug registers. Software and hardware breakpoints inside SMM should work now until SMM mode is left again. If you set the Continue option, the debugger will automatically run the target after restoring the breakpoints.

Note

If breakpoints are still ignored, reconfigure them with the command: ENABLE BREAKPOINT /REFRESH

Alternatively, you can patch the BIOS to re-enable breakpoints when entering SMM, but this requires the ability to modify the BIOS which cannot be used in production code.

For more complete information about compiler optimizations, see our Optimization Notice.