ladybird/Meta/debug-kernel.sh
Gunnar Beutner 7e94b090fe Kernel: Introduce basic pre-kernel environment
This implements a simple bootloader that is capable of loading ELF64
kernel images. It does this by using QEMU/GRUB to load the kernel image
from disk and pass it to our bootloader as a Multiboot module.

The bootloader then parses the ELF image and sets it up appropriately.
The kernel's entry point is a C++ function with architecture-native
code.

Co-authored-by: Liav A <liavalb@gmail.com>
2021-07-18 17:31:13 +02:00

24 lines
730 B
Bash
Executable file

#!/bin/sh
# Set this environment variable to override the default debugger.
#
[ -z "$SERENITY_KERNEL_DEBUGGER" ] && SERENITY_KERNEL_DEBUGGER="gdb"
# The QEMU -s option (enabled by default in ./run) sets up a debugger
# remote on localhost:1234. So point our debugger there, and inform
# the debugger which binary to load symbols, etc from.
#
if [ "$SERENITY_ARCH" = "x86_64" ]; then
gdb_arch=i386:x86-64
else
gdb_arch=i386:intel
fi
exec $SERENITY_KERNEL_DEBUGGER \
-ex "file $(dirname "$0")/../Build/${SERENITY_ARCH:-i686}/Kernel/Kernel" \
-ex "set arch $gdb_arch" \
-ex 'target remote localhost:1234' \
-ex "source $(dirname "$0")/serenity_gdb.py" \
-ex "layout asm" \
-ex "fs next" \
"$@"