]> git.mdlowis.com Git - proto/aas.git/commitdiff
started making handy gdb view for debugging
authorMichael D. Lowis <mike@mdlowis.com>
Fri, 1 Dec 2023 03:47:22 +0000 (22:47 -0500)
committerMichael D. Lowis <mike@mdlowis.com>
Fri, 1 Dec 2023 03:47:22 +0000 (22:47 -0500)
debug.sh [new file with mode: 0755]
stack_dump.py [new file with mode: 0644]

diff --git a/debug.sh b/debug.sh
new file mode 100755 (executable)
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 (file)
index 0000000..de6c0ab
--- /dev/null
@@ -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)
+