From: Ralph Ronnquist Date: Thu, 20 May 2021 10:49:29 +0000 (+1000) Subject: debugging support X-Git-Url: https://git.rrq.au/?a=commitdiff_plain;h=3f5ae14cc91f1a3fe6a4c39bd4efc6f5f93220c5;p=rrq%2Frrqforth.git debugging support --- 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