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)}") )
-NBR=$(wc -l < gdbinit)
+for I in ${NBR[@]} ; do echo disable $I ; done >> gdbinit
DS="$(grep "${PFX}DS_TOP:" rrqforth.map | sed 's/ .*//')"
-
+RS="$(grep "${PFX}RS_TOP:" rrqforth.map | sed 's/ .*//')"
cat <<EOF >> gdbinit
display *(void**)\$rsp@(((void*)$DS-\$rsp)/8)+1
-display (char*)(*(void**)(\$rax-16)+32)
+display *(void**)\$rbp@(((void*)$RS-\$rbp)/8)+1
display (void*)\$rax
display (void*)\$rsi
define si
stepi
- x/3i \$pc
- python gdb.execute("shell ./grepline.sh " + str(gdb.parse_and_eval("\$pc")))
+ x/2i \$pc
+ python gdb.execute("shell ./grepline.sh rrqforth.map " + str(gdb.parse_and_eval("\$pc")))
+end
+
+define map
+ if \$argc == 1
+ python gdb.execute("shell ./grepline.sh rrqforth.map \$arg0" + " 1 " )
+ else
+ python gdb.execute("shell ./grepline.sh rrqforth.map \$arg0" + " 1 " + "\$arg1" )
+ end
+end
EOF
exec gdb -x gdbinit rrqforth