From: Michael D. Lowis Date: Fri, 1 Dec 2023 03:47:22 +0000 (-0500) Subject: started making handy gdb view for debugging X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=85d81ccdd030faa30b79122ed8a79cf561b3445a;p=proto%2Faas.git started making handy gdb view for debugging --- diff --git a/debug.sh b/debug.sh new file mode 100755 index 0000000..ccd6124 --- /dev/null +++ b/debug.sh @@ -0,0 +1,8 @@ +#!/bin/sh +gdb -ex 'source stack_dump.py' \ + -ex 'tui new-layout asm_debug {-horizontal asm 2 stack 1 regs 1} 1 status 0 cmd 1' \ + -ex 'layout asm_debug' \ + -ex 'focus cmd' \ + -ex 'break main' \ + -ex 'run' \ + ./a.out diff --git a/stack_dump.py b/stack_dump.py new file mode 100644 index 0000000..de6c0ab --- /dev/null +++ b/stack_dump.py @@ -0,0 +1,20 @@ +class history_window: + def __init__(self, tui_window): + self.win = tui_window + + def render(self): + height = self.win.height + width = self.win.width + lines = self.get_stack() + self.win.erase() + for l in lines: + self.win.write(l) + + def get_stack(self): + return [] + + def close(self): + gdb.events.before_prompt.disconnect(self._before_prompt_listener) + +gdb.register_window_type('stack', history_window) +