Meta+Documentation: Allow cross-debugging x86_64 Serenity on M1 Macs

While there is no native GDB on Apple Silicon, a cross-debugger that
supports x86-64 does exist.
This commit is contained in:
Daniel Bertalan 2023-03-11 20:09:10 +01:00 committed by Andreas Kling
parent 59ba94a2d2
commit b668000e44
2 changed files with 11 additions and 1 deletions

View file

@ -22,6 +22,9 @@ Toolchain/BuildFuseExt2.sh
# (option 2) genext2fs
brew install genext2fs
# for kernel debugging, on Apple Silicon
brew install x86_64-elf-gdb
```
If you have Xcode version 13 or older, also install a newer host compiler from homebrew. Xcode 14 is known to work.
@ -51,3 +54,6 @@ It's important to make sure that Xcode is not only installed but also accordingl
Homebrew is known to ship bleeding edge CMake versions, but building CMake from source with homebrew
gcc or llvm may not work. If homebrew does not offer cmake 3.25.x+ on your platform, it may be necessary
to manually run Toolchain/BuildCMake.sh with Apple clang from Xcode as the first compiler in your $PATH.
If you want to debug the x86-64 kernel on an Apple Silicon machine, you can install the `x86_64-elf-gdb`
package to get a native build of GDB that can cross-debug x86-64 code.

View file

@ -14,7 +14,11 @@ if [ -z "$SERENITY_KERNEL_DEBUGGER" ]; then
PATH="$SCRIPT_DIR/../Toolchain/Local/aarch64/bin:$PATH"
SERENITY_KERNEL_DEBUGGER="aarch64-pc-serenity-gdb"
else
SERENITY_KERNEL_DEBUGGER="gdb"
if command -v x86_64-elf-gdb >/dev/null 2>&1; then
SERENITY_KERNEL_DEBUGGER="x86_64-elf-gdb"
else
SERENITY_KERNEL_DEBUGGER=gdb
fi
fi
fi