UEFI Development Kit Debugger Tool with USB 3.0


Satoshi Tanda
 

Hi,

I am new to UEFI development and trying to set up physical machine
debugging environment using UEFI Development Kit Debugger Tool (UDK) but
unsuccessful so far. Can someone assist me to figure out what I am missing?

In short, I am trying to follow a scenarios explained as "Debugging a
standalone module loaded in a UEFI shell" through USB 3.0 with Windbg, but
the debugger never establishes connection with the target even after
loading DebugAgentDxe.dxe.

Here is some information on my setup and steps of attempts.

Debugger:
- Windows 10 x64
- UDK 1.5. Configured as below
----
[Debug Port]
Channel = USB
----
- Windbg 10.0.18362.1 (x86)
- USB 3.0 cable connected through a USB-C-to-A adapter

Target:
- ASUS UX360C, BIOS version 2.17.1249 (the latest I can get)
- Connected through USB-A port directly

Workflow:
1. Insert the USB thumb drive to the target
This USB drive contains the UEFI shell taken from the EDK2
repo, DebugAgentDxe.efi compiled as below, and a test DXE driver with int3
at the entry point.
build -p SourceLevelDebugPkg\SourceLevelDebugPkg.dsc -m
SourceLevelDebugPkg/DebugAgentDxe/DebugAgentDxe.inf -a X64 -D
SOURCE_DEBUG_USE_USB3

2. Boot the target system into the UEFI shell

3. Load DebugAgentDxe.efi in the USB drive
load DebugAgentDxe.efi
This results in either
- a) never returning to the shell (hang). "USB Debug Connection Device"
appearing in Device Manager on the Debugger side, or
- b) returning and "USB Debug Connection Device" not appearing

Starting UDK's SoftDebugger + Windbg does not seem to change, regardless of
whether that is done before or after (3). Windbg prints this
```
Microsoft (R) Windows Debugger Version 10.0.18362.1 X86
Copyright (c) Microsoft Corporation. All rights reserved.
WARNING: An old EXDIv1 server has been detected. Debugger will use the
compatibility layer.
It is advised to rebuild your EXDI server using EXDIv3 interfaces.
```
SoftDebugger Console shows this
```
Intel(R) UEFI Development Kit Debugger Tool Version 1.5.0
Debugging through USB (\\?\USB2DBG)
Redirect Target output to TCP port (20715)
```

4. In case the system did not freeze after (3), load the test driver to
execute int3. System hangs.

Debugging through USB 3 is possible as far as I read from the manual of
UDK, and this training material. So I am lost as to what the problem is.
https://gitpitch.com/tianocore-training/EDK_II_UDK_Debugger_Pres/master#/11

Setup of Windbg & UDK is unlikely the issue as I was also able to debug the
DXE driver running on VirtualBox, although it was serial-based. Those
pieces of hardware are also unlikely a problem as I am able to debug the
Windows kernel using the same devices.

I also tried with Dell XPS 13 9360 but the results are the same. My best
guess is that the target's UEFI is somehow not compatible
with SourceLevelDebugPkg, but I would appreciate if anyone can review my
configurations and give me suggestion on setting up a debug environment
with physical devices.

Thank you for your help in advance.

Best,
Satoshi