From: Ralph Ronnquist Date: Mon, 24 May 2021 11:19:18 +0000 (+1000) Subject: add a debug call break point with print commands X-Git-Url: https://git.rrq.au/?a=commitdiff_plain;h=ad3cc266a22476c9a7022a8c8377dc770810a61a;p=rrq%2Frrqforth.git add a debug call break point with print commands --- 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/ .*//')"