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[0]}" >> gdbinit
+# ;; rax = cfa of called word
+# ;; rsi = cell* of next forth word
+# ;; [$rsp] = from where the call was
+
+cat <<EOF >> gdbinit
+commands $((NBR+1))
+print (void*) \$rsp
+print (void*) \$rsi
+print (char*)((*((void**)(*((void**)\$rsi)-16)))+32)
+end
+EOF
DS="$(grep "${PFX}DS_TOP:" rrqforth.map | sed 's/ .*//')"
RS="$(grep "${PFX}RS_TOP:" rrqforth.map | sed 's/ .*//')"