From ad3cc266a22476c9a7022a8c8377dc770810a61a Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Mon, 24 May 2021 21:19:18 +1000 Subject: [PATCH] add a debug call break point with print commands --- debug.sh | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/debug.sh b/debug.sh index 12772c2..a665e02 100755 --- a/debug.sh +++ b/debug.sh @@ -2,10 +2,27 @@ PFX='0x[0-9a-f]* rrqforth.asm:[0-9]*[ ]*' + grep "${PFX}do" rrqforth.map | sed 's/ .*//;s/^/break */' > gdbinit -NBR=( $(eval "echo {1..$(wc -l < gdbinit)}") ) -for I in ${NBR[@]} ; do echo disable $I ; done >> gdbinit +NBR=$(wc -l < gdbinit) + +I=1 +while [ $I -lt $NBR ] ; do echo disable $I ; I=$((I+1)) ; done >> gdbinit + +RET=$(grep -w ret rrqforth.map | sed 's/ .*//') +echo "break *$RET" >> gdbinit +# ;; rax = cfa of called word +# ;; rsi = cell* of next forth word +# ;; [$rsp] = from where the call was + +cat <> gdbinit +commands $((NBR+1)) +print (void*) \$rsp +print (((char*)(*(((void**)\$rax)-2)))+32) +print (void*) \$rsi +end +EOF DS="$(grep "${PFX}DS_TOP:" rrqforth.map | sed 's/ .*//')" RS="$(grep "${PFX}RS_TOP:" rrqforth.map | sed 's/ .*//')" -- 2.39.2