2.15 Partition tracker 3 Debugging Target Code
Analyzer User's Guide  /  2 OS Awareness  / 

2.16 UEFI Firmware Tracker

The UEFI Firmware Tracker tracks UEFI, Intel® Slim Bootloader (Intel® SBL) and Intel® Firmware Support Package (Intel® FSP) module loading and unloading to allow source code debugging of UEFI systems. The UEFI Firmware Tracker is implemented as an OS Awareness component. Read more about OS Awareness in chapter 2.

Supported target platforms for the tracker are X86 and ARM64.

While the tracker works on both Windows and Linux and can track UEFI, Intel® Slim Bootloader (Intel® SBL) and Intel® FSP, there are some details to consider when it comes to source code debugging, see section 2.16.3.

2.16.1 Tracking Techniques

Knowing how the UEFI tracker works is optional, but understanding the basics may be useful during configuration. Tracking is handled with several techniques which handles modules loaded in the different UEFI phases.

The below tables lists the tracking techniques available on X86 (figure 7) and ARM64 (figure 8) and for which phases, or modules the tracking techniques work. Note that some tracking techniques may find other module types as well. However, it may not support unload for example.

Tracking TechniqueDefaultSEC and PEI (static)PEI (dynamic)DXESMMIntel® FSP
Map FileDisabledYes
Pre-DXEDisabledYes
DXEEnabledYes
SMMEnabledYes
Execution (1)(2)EnabledYesYesYes
Notification (2)EnabledYesYesYes (3)
Reset (4)Enabled
OS Hand-off (5)Enabled
(1)Detection of module unload is not supported.
(2)Will not remove SEC and PEI modules when UEFI enters DXE (which DXE tracking supports).
(3)Requires that UEFI has been updated with notification support, see appendix B.
(4)Reset tracking does not track modules but will clear the module list when detecting a processor reset.
(5)OS Hand-off tracking does not track modules, but improves simulation performance while executing the OS..
Figure 7. Tracking techniques available on X86 targets.
Tracking TechniqueDefaultSEC and PEI (static)PEI (dynamic)DXE
Map FileDisabledYes
DXEEnabledYes
Execution (1)(2)EnabledYesYes
(1)Detection of module unload is not supported.
(2)Will not remove SEC and PEI modules when UEFI enters DXE (which DXE tracking supports).
Figure 8. Tracking techniques available on ARM64 targets

2.16.2 Commands

The UEFI firmware tracker commands are used to configure the tracker and also to provide information about the UEFI system. The commands are:

For more information about the commands, see:

2.16.3 Source Code Debugging

In order for source code debugging to work, there are some requirements that must be met:

  1. The host type in combination with the compiler tool chain used to compile UEFI must be supported (see table in Figure 9).
  2. The UEFI system must have been compiled with debug information.
  3. The debug information and source files must be available to TCF.
Compiler Tool ChainMicrosoft WindowsLinux
Microsoft Visual StudioSupported (1)
ELF/DWARF compiler such as GCCSupportedSupported
(1)Requires that DBGHELP.DLL is available to TCF.
Figure 9. Supported combinations of of *host type* and *compiler tool chain*

To get the best source code debugging experience when debugging UEFI (or any other binary), please compile with as much debug information as possible and as little optimizationas possible.

If copying an already built UEFI system from another computer, it is important to keep files that are needed for debugging. There is usually a DEBUG folder for each UEFI module that contains the files needed for debugging, and it is important that at least the some of the files are kept. As an example, lets say that the module SecCore has a directory Build/.../SecCore/DEBUG. Then at least the following files must be kept

Microsoft Visual StudioELF/DWARF compiler such as GCC
SecMain.efiSecMain.efi
SecMain.dllSecMain.dll
SecMain.pdbSecMain.debug

2.16.4 Configuration

Some platform start scripts come with UEFI Firmware Tracker support. If that is not the case, a tracker configuration must be added.

Here is an example of how to configure the viper system. For more in-depth information on OS Awareness configurations, read section 2.9.


# Specify the file that will contain the tracker parameters.
if not defined tracker_params { $tracker_params = "uefi.params" }

# Load uefi-fw-tracker and insert it into the tracker hierarchy.
load-module uefi-fw-tracker
viper.software.insert-tracker tracker = uefi_fw_tracker_comp

# Detect the parameters which will be written to the $tracker_params.
viper.software.tracker.detect-parameters -overwrite param-file = $tracker_params

# Load the parameters.
viper.software.tracker.load-parameters $tracker_params

# Enable the tracker.
viper.software.enable-tracker
  

If the target configuration scripts configures another OS-Awareness tracker, this should be deleted first with the command <os_awareness>.delete-tracker, for example:


# Delete the current tracker to allow configuration of the UEFI tracker.
viper.software.delete-tracker
  

After incorporating the tracker configuration and starting the simulation, you can debug the system with the debugger commands in Simics CLI. For more information about debugging with Simics in general, see chapter 3.

2.16.5 Troubleshooting

This section describes common problems and how to fix them.

Figure 10. Troubleshoot the tracker configuration

Figure 11. Troubleshoot by running forward. Not every address (for example the reset vector) has debug information.

Figure 12. Troubleshoot tracking advanced

Figure 13. Troubleshoot stack trace

Figure 14. Troubleshoot debugging UEFI built with Visual Studio

Figure 15. Troubleshoot module problems

2.16.6 Limitations

2.15 Partition tracker 3 Debugging Target Code