X-Git-Url: https://git.wh0rd.org/?p=home.git;a=blobdiff_plain;f=.gdbinit;h=f6991f6cf3368c4fd488a5b4e8394bc586f1fd70;hp=bc473f9ee44a2af8f37927bb6713aeff9f06a300;hb=HEAD;hpb=228980767b9ce390f39e904eefcdd4ea1f6d5f80 diff --git a/.gdbinit b/.gdbinit index bc473f9..f6991f6 100644 --- a/.gdbinit +++ b/.gdbinit @@ -1,42 +1,143 @@ +# Load dynamic Python code first. +source ~/.gdbinit.py + +# +# Base settings. +# + set print pretty on -set prompt (gdb) +set prompt (gdb)  set history save on set pagination off set output-radix 16 set remotetimeout 300 +#handle SIGINT nostop noprint pass +#handle SIGQUIT stop print nopass #catch fork #catch vfork -define exit - quit +# +# U-Boot style memory compare functions +# + +define _cmp + set $$base = (unsigned long)$arg0 + set $$addr1 = $arg0 + set $$addr2 = $arg1 + set $$count = $arg2 + while $$count-- > 0 + if (*$$addr1 != *$$addr2) + printf "Data mismatch at %#x units (@%#x != @%#x)\n", $arg2, $$addr1, $$addr2 + set $$count = -100 + end + set $$addr1 += 1 + set $$addr2 += 1 + end + if $$count == -1 + printf "Data matches for %#x units\n", $arg2 + end + dont-repeat +end +document _cmp +Usage: cmp[bwl]
+Compare between
and
. end -define peedi - target remote peedi:2000 +define cmpb + if $argc == 3 + set $$addr1 = (unsigned char *)$arg0 + set $$addr2 = (unsigned char *)$arg1 + _cmp $$addr1 $$addr2 $arg2 + else + help _cmp + end +end +document cmpb +Use 'help _cmp' +end +define cmpw + if $argc == 3 + set $$addr1 = (unsigned short *)$arg0 + set $$addr2 = (unsigned short *)$arg1 + _cmp $$addr1 $$addr2 $arg2 + else + help _cmp + end end -define jtag - target remote localhost:2000 +document cmpw +Use 'help _cmp' end -define vapier - target remote vapier:2000 +define cmpl + if $argc == 3 + set $$addr1 = (unsigned long *)$arg0 + set $$addr2 = (unsigned long *)$arg1 + _cmp $$addr1 $$addr2 $arg2 + else + help _cmp + end end -define bfin - target remote bfin:1234 +document cmpl +Use 'help _cmp' end -define dis - if $argc == 0 - disassemble $pc ($pc + 0x40) + +# +# U-Boot style memory copy functions +# + +define _cp + set $$src = $arg0 + set $$dst = $arg1 + set $$count = $arg2 + while $$count-- > 0 + set *$$dst = *$$src + set $$src += 1 + set $$dst += 1 end - if $argc == 1 - disassemble $arg0 ($arg0 + 0x40) + printf "Copied %#x units from %#x to %#x\n", $arg2, $arg0, $arg1 + dont-repeat +end +document _cp +Usage: cp[bwl] +Copy from to . +end + +define cpb + if $argc == 3 + set $$addr1 = (unsigned char *)$arg0 + set $$addr2 = (unsigned char *)$arg1 + _cp $$addr1 $$addr2 $arg2 + else + help _cp end end -define go - jump *$arg0 +document cpb +Use 'help _cp' +end +define cpw + if $argc == 3 + set $$addr1 = (unsigned short *)$arg0 + set $$addr2 = (unsigned short *)$arg1 + _cp $$addr1 $$addr2 $arg2 + else + help _cp + end end +document cpw +Use 'help _cp' +end +define cpl + if $argc == 3 + set $$addr1 = (unsigned long *)$arg0 + set $$addr2 = (unsigned long *)$arg1 + _cp $$addr1 $$addr2 $arg2 + else + help _cp + end +end +document cpl +Use 'help _cp' +end + -source /usr/local/src/blackfin/svn/toolchain/trunk/debug-helpers/gdb-scripts/bfin -source /usr/local/src/blackfin/svn/toolchain/trunk/debug-helpers/gdb-scripts/u-boot -source /usr/local/src/blackfin/git/toolchain/debug-helpers/gdb-scripts/bfin -source /usr/local/src/blackfin/git/toolchain/debug-helpers/gdb-scripts/u-boot +#set extended-prompt \[\e[30;1m\](\[\e[34;1m\]gdb\[\e[30;1m\]) \[\e[0m\]