Skip to content

Commit

Permalink
Merge branch 'acidanthera:master' into YamingNetwork
Browse files Browse the repository at this point in the history
  • Loading branch information
wy414012 authored Oct 27, 2023
2 parents 5f9753a + 763b0ea commit 64b785d
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 4 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ OpenCore Changelog
#### v0.9.6
- Updated builtin firmware versions for SMBIOS and the rest
- Fixed hang while generating boot entries on some systems
- Add `efidebug.tool` support for 32-bit on 32-bit using GDB (in addition to existing 32-bit on 64-bit support)

#### v0.9.5
- Fixed GUID formatting for legacy NVRAM saving
Expand Down
23 changes: 23 additions & 0 deletions Debug/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,29 @@ For example, this is a working `launch.json` file for both LLDB and GDB debuggin
"traceResponse": true
}
},
{
"name": "OC gdb (32/32)",
"type": "cppdbg",
"request": "launch",
"targetArchitecture": "x86",
"program": "${workspaceFolder}/Debug/GdbSyms/Bin/Ia32_GCC5/GdbSyms.debug",
"cwd": "${workspaceFolder}/Debug",
"MIMode": "gdb",
"stopAtEntry": true,
"setupCommands": [
{"text": "set arch i386"},
{"text": "symbol-file ${workspaceFolder}/Debug/GdbSyms/Bin/Ia32_GCC5/GdbSyms.debug"},
{"text": "target remote localhost:8832"},
{"text": "source ${workspaceFolder}/Debug/Scripts/gdb_uefi.py"},
{"text": "reload-uefi"},
],
"launchCompleteCommand": "exec-continue",
"logging": {
"engineLogging": false,
"trace": true,
"traceResponse": true
}
},
]
}
```
Expand Down
33 changes: 29 additions & 4 deletions Debug/efidebug.tool
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
# GDB - path to GDB debugger
# defaults to finding in PATH
# EFI_ARCH - architecture to debug
# defaults to X64
# defaults to X64; use EFI_ARCH=Ia32 to debug 32-bit firmware on 64-bit CPU
# CPU_ARCH - CPU architecture of target
# 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
# EFI_PORT - debugger TCP connection port
# defaults to 8864 for X64 and 8832 for IA32
# defaults to 8864 for X64 and 8832 for Ia32
# EFI_HOST - debugger TCP connection host
# defaults to localhost
# EFI_DEBUGGER - debugger to use
Expand All @@ -24,6 +28,8 @@
# defaults to x86_64-apple-macosx for XCODE5, x86_64-pc-windows-msvc for CLANGDWARF/CLANGPDB,
# x86_64-linux-gnu otherwise.
#
# Note: This script's support for 32-bit UEFI debugging on LLDB is incomplete, GDB is recommended in that case.
#

RUNDIR=$(dirname "$0")
pushd "${RUNDIR}" >/dev/null || exit 1
Expand Down Expand Up @@ -60,8 +66,27 @@ choose_debugger() {
find_gdb
find_lldb

if [ "${CPU_ARCH}" = "IA32" ]; then
CPU_ARCH="Ia32"
elif [ "${CPU_ARCH}" = "" ]; then
CPU_ARCH="X64"
fi

if [ "${GDB_ARCH}" = "" ]; then
if [ "${CPU_ARCH}" = "X64" ]; then
GDB_ARCH="i386:x86-64:intel"
else
GDB_ARCH="i386"
fi
fi

if [ "${EFI_ARCH}" = "" ]; then
EFI_ARCH="X64"
EFI_ARCH="${CPU_ARCH}"
elif [ "${EFI_ARCH}" = "IA32" ]; then
EFI_ARCH="Ia32"
elif [ "${CPU_ARCH}" = "Ia32" ] && [ "${EFI_ARCH}" = "X64" ] ; then
echo "Invalid CPU_ARCH/EFI_ARCH combination!"
exit 1
fi

if [ "${EFI_HOST}" = "" ]; then
Expand Down Expand Up @@ -135,7 +160,7 @@ choose_debugger() {
choose_debugger

if [ "${EFI_DEBUGGER}" = "GDB" ] || [ "${EFI_DEBUGGER}" = "gdb" ]; then
"${GDB}" -ex "set arch i386:x86-64:intel" \
"${GDB}" -ex "set arch ${GDB_ARCH}" \
-ex "target remote ${EFI_HOST}:${EFI_PORT}" \
-ex "source Scripts/gdb_uefi.py" \
-ex "set pagination off" \
Expand Down

0 comments on commit 64b785d

Please sign in to comment.