From 3f5ae14cc91f1a3fe6a4c39bd4efc6f5f93220c5 Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Thu, 20 May 2021 20:49:29 +1000 Subject: [PATCH] debugging support --- debug.sh | 23 +++++++++++++++++++++++ grepline.sh | 3 +++ 2 files changed, 26 insertions(+) create mode 100755 debug.sh create mode 100755 grepline.sh diff --git a/debug.sh b/debug.sh new file mode 100755 index 0000000..6ecb8ce --- /dev/null +++ b/debug.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +PFX='0x[0-9a-f]* rrqforth.asm:[0-9]*[ ]*' + +grep "${PFX}do" rrqforth.map | sed 's/ .*//;s/^/break */' > gdbinit + +NBR=$(wc -l < gdbinit) + +DS="$(grep "${PFX}DS_TOP:" rrqforth.map | sed 's/ .*//')" + +cat <> gdbinit +display *(void**)\$rsp@(((void*)$DS-\$rsp)/8)+1 +display (char*)(*(void**)(\$rax-16)+32) +display (void*)\$rax +display (void*)\$rsi + +define si + stepi + x/3i \$pc + python gdb.execute("shell ./grepline.sh " + str(gdb.parse_and_eval("\$pc"))) +EOF + +exec gdb -x gdbinit rrqforth diff --git a/grepline.sh b/grepline.sh new file mode 100755 index 0000000..677484a --- /dev/null +++ b/grepline.sh @@ -0,0 +1,3 @@ +#!/bin/bash +# +grep "^$1 " rrqforth.map -- 2.39.2