From 59acddf652ef1afbf07801b74c417481833ee26f Mon Sep 17 00:00:00 2001 From: javalsai Date: Tue, 1 Jul 2025 01:26:35 +0200 Subject: [PATCH] dev: add debug utils folder --- debug/README.md | 3 +++ debug/debug.gdb | 59 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 debug/README.md create mode 100644 debug/debug.gdb diff --git a/debug/README.md b/debug/README.md new file mode 100644 index 0000000..55472b9 --- /dev/null +++ b/debug/README.md @@ -0,0 +1,3 @@ +# Debug + +This folder contains debug utils like gdb scripts. They are not guaranteed to work but can ease some tasks when debugging. diff --git a/debug/debug.gdb b/debug/debug.gdb new file mode 100644 index 0000000..04059f3 --- /dev/null +++ b/debug/debug.gdb @@ -0,0 +1,59 @@ +# this just meant to run in another term, is probably better to attach to another already running window +set inferior-tty /dev/pts/7 +set pagination off + +break *(read_press + 62) +define fake_read + set *((char*) $rsi) = $al + set $rax = 1 + jump *(read_press + 67) +end + +break *(read_press + 108) +define fake_magic_cont + set $eax = 1 + jump *(read_press + 113) +end +define fake_magic_end + set $eax = 0 + jump *(read_press + 113) +end + +run +set $al = 0x1b +fake_read +fake_magic_cont +set $al = '[' +fake_read +fake_magic_cont +set $al = 'D' +fake_read +fake_magic_end + +set $al = 'p' +fake_read +fake_magic_end + +set $al = 'a' +fake_read +fake_magic_end + +set $al = 's' +fake_read +fake_magic_end + +set $al = 's' +fake_read +fake_magic_end + +set $al = 'w' +fake_read +fake_magic_end + +set $al = 'd' +fake_read +fake_magic_end + +set $al = '\n' +fake_read +fake_magic_end