diff options
| author | salmonik <salmonik@tuta.io> | 2026-07-31 03:22:20 +0200 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-07-31 03:22:20 +0200 |
| commit | 0ace22d6f88692883584119c64ff010f4cee6738 (patch) | |
| tree | 6f575f9088dec8bab90943d6c23e174bca183f0a /tools/debug-kernel.py | |
| parent | restructure: rsnix kernel + shell crate + rsdos entry point (diff) | |
| download | rs-dos-0ace22d6f88692883584119c64ff010f4cee6738.tar.gz rs-dos-0ace22d6f88692883584119c64ff010f4cee6738.zip | |
fix(rsdos): organizational changes
Diffstat (limited to 'tools/debug-kernel.py')
| -rwxr-xr-x | tools/debug-kernel.py | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/tools/debug-kernel.py b/tools/debug-kernel.py deleted file mode 100755 index c794ad6..0000000 --- a/tools/debug-kernel.py +++ /dev/null | |||
| @@ -1,64 +0,0 @@ | |||
| 1 | """ | ||
| 2 | GDB Python script for debugging raisernics under QEMU. | ||
| 3 | |||
| 4 | Usage: | ||
| 5 | 1. Terminal 1: ./tools/qemu.sh --debug | ||
| 6 | 2. Terminal 2: gdb -x tools/debug-kernel.py target/x86_64-unknown-uefi/debug/raisernics.efi | ||
| 7 | """ | ||
| 8 | |||
| 9 | import gdb | ||
| 10 | import os | ||
| 11 | |||
| 12 | # Find the kernel binary | ||
| 13 | script_dir = os.path.dirname(os.path.abspath(__file__)) | ||
| 14 | project_root = os.path.dirname(script_dir) | ||
| 15 | binary = os.path.join( | ||
| 16 | project_root, | ||
| 17 | "target/x86_64-unknown-uefi/debug/raisernics.efi" | ||
| 18 | ) | ||
| 19 | |||
| 20 | # Connect to QEMU's GDB stub | ||
| 21 | gdb.execute("target remote :1234") | ||
| 22 | |||
| 23 | # Load the binary (add symbol table) | ||
| 24 | if os.path.exists(binary): | ||
| 25 | gdb.execute(f"symbol-file {binary}") | ||
| 26 | print(f"Loaded symbols from {binary}") | ||
| 27 | else: | ||
| 28 | print(f"WARNING: {binary} not found. Build with debug symbols first.") | ||
| 29 | |||
| 30 | gdb.execute("set breakpoint pending on") | ||
| 31 | |||
| 32 | |||
| 33 | # Helper commands | ||
| 34 | class DumpBootServices(gdb.Command): | ||
| 35 | """Dump EFI boot services signature and key pointers""" | ||
| 36 | |||
| 37 | def __init__(self): | ||
| 38 | super().__init__("dump-bs", gdb.COMMAND_USER) | ||
| 39 | |||
| 40 | def invoke(self, argument, from_tty): | ||
| 41 | del argument, from_tty | ||
| 42 | gdb.execute("printf \"SystemTable, BootServices, and key function pointers\\n\"") | ||
| 43 | gdb.execute("info functions efi_main") | ||
| 44 | |||
| 45 | |||
| 46 | class DumpGop(gdb.Command): | ||
| 47 | """Dump GOP framebuffer info""" | ||
| 48 | |||
| 49 | def __init__(self): | ||
| 50 | super().__init__("dump-gop", gdb.COMMAND_USER) | ||
| 51 | |||
| 52 | def invoke(self, argument, from_tty): | ||
| 53 | del argument, from_tty | ||
| 54 | gdb.execute("printf \"Check the gop::Framebuffer static\\n\"") | ||
| 55 | |||
| 56 | |||
| 57 | DumpBootServices() | ||
| 58 | DumpGop() | ||
| 59 | |||
| 60 | print("") | ||
| 61 | print("raisernics GDB session ready.") | ||
| 62 | print(" target remote :1234 (connected)") | ||
| 63 | print(" Commands: continue, stepi, bt, info registers, etc.") | ||
| 64 | print(" Custom: dump-bs, dump-gop") | ||
