Use Case: Breaking at a Specific UEFI Module

  1. To load source information, boot till the EFI shell or idle loop and use the UEFI Scripted Buttons.
  2. To set a breakpoint in a module, choose one of the following options.
    • Option 1: Break at the module entry point
      1. In the menu bar, select: View > Source Files
      2. Right-click your desired module
      3. Select Create Breakpoint at Init

    • Option 2: Break at specific module's function

      Use the SET BREAK AT command in the Console window, using the format : SET BREAK AT {ModuleName.efi}KnownFunction, for example:

      xdb> SET BREAK AT {DxeCore.efi}DxeMain

  3. To reset the target from the debugger, select Run > Reset Target Default from the menu bar and wait for the target system to complete the reset. The debugger will halt the target at the reset vector (usually 0xF000:0xFFF0), provided that the target system supports this. Note that resetting the target disables all active code and data breakpoints.
  4. Re-enable your breakpoints in the Breakpoints window. Follow these steps:
    1. In the menu bar, select: View > Breakpoints.
    2. Find your breakpoints in the Breakpoints window. Check the boxes next to the breakpoints you wish to enable.
  5. Click the Run button in the debugger's toolbar.

    The target resumes execution. After a few seconds, the debugger hits the breakpoint, and the target is halted at the beginning of the desired function.

Note

Software breakpoints do not persist over a reset, because during the PEI shadowing phase, the module is reloaded to memory and it will overwrite the software breakpoint. Hardware breakpoints will persist but the module could be loaded to a different address, and the hardware breakpoint location is altered after a reset.

The debugger can run to a UEFI module by the module name if the agent based connection over a serial cable is used. See Setting Up the Target about how to set up the agent-based connection.

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