Skip to content

Commit

Permalink
Debug: Achieve parity between GDB and LLDB on 32/64
Browse files Browse the repository at this point in the history
 - UEFI symbols loaded
 - Cannot see stack properly
 - Cannot see local variables properly
 - Can do some successful stepping around in the code
  • Loading branch information
mikebeaton committed Oct 28, 2023
1 parent ae81e44 commit 2974a73
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions Debug/efidebug.tool
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# defaults to X64; use CPU_ARCH=Ia32 to debug 32-bit firmware on 32-bit CPU
# GDB_ARCH - GDB `set arch` value
# defaults to correct value for CPU_ARCH
# LLDB_ARCH - LLDB `--arch` value
# defaults to correct value for CPU_ARCH
# EFI_PORT - debugger TCP connection port
# defaults to 8864 for X64 and 8832 for Ia32
# EFI_HOST - debugger TCP connection host
Expand Down Expand Up @@ -82,14 +80,6 @@ choose_debugger() {
fi
fi

if [ "${LLDB_ARCH}" = "" ]; then
if [ "${CPU_ARCH}" = "X64" ]; then
LLDB_ARCH="x86_64"
else
LLDB_ARCH="i386"
fi
fi

if [ "${EFI_ARCH}" = "" ]; then
EFI_ARCH="${CPU_ARCH}"
elif [ "${EFI_ARCH}" = "IA32" ]; then
Expand Down Expand Up @@ -167,11 +157,9 @@ choose_debugger() {
fi

if [ "${CPU_ARCH}" = "X64" ]; then
LLDB_TARGET_DEFINITION1="-o"
LLDB_TARGET_DEFINITION2="settings set plugin.process.gdb-remote.target-definition-file Scripts/x86_64_target_definition.py"
lldb_target_definition="settings set plugin.process.gdb-remote.target-definition-file Scripts/x86_64_target_definition.py"
else
LLDB_TARGET_DEFINITION1=""
LLDB_TARGET_DEFINITION2=""
lldb_target_definition="settings set target.default-arch ${EFI_TRIPLE}"
fi
}

Expand All @@ -186,8 +174,7 @@ if [ "${EFI_DEBUGGER}" = "GDB" ] || [ "${EFI_DEBUGGER}" = "gdb" ]; then
-ex "b DebugBreak" \
"${EFI_SYMS}"
elif [ "${EFI_DEBUGGER}" = "LLDB" ] || [ "${EFI_DEBUGGER}" = "lldb" ]; then
"$LLDB" --arch "${LLDB_ARCH}" \
"${LLDB_TARGET_DEFINITION1}" "${LLDB_TARGET_DEFINITION2}" \
"$LLDB" -o "${lldb_target_definition}" \
-o "gdb-remote ${EFI_HOST}:${EFI_PORT}" \
-o "target create ${EFI_SYMS_PDB} ${EFI_SYMS}" \
-o "command script import Scripts/lldb_uefi.py" \
Expand Down

0 comments on commit 2974a73

Please sign in to comment.