~aleteoryx/muditaos

fd03146e978ba7d1a4b8fe37c784e226f4fa9a70 — Marek Niepieklo 4 years ago f28d8cf
[EGD-6219] Add GDB macro to print memory

Added GDB macro to print out the content
of the memory range in hex/ASCII format.
3 files changed, 34 insertions(+), 0 deletions(-)

A .gdb_macros
M .gdbinit
M .gdbinit-1051
A .gdb_macros => .gdb_macros +30 -0
@@ 0,0 1,30 @@
define xac
    dont-repeat
    set $addr = (char *)($arg0)
    set $endaddr = $addr + $arg1
    while $addr < $endaddr
        printf "%p: ", $addr
        set $lineendaddr = $addr + 8
        if $lineendaddr > $endaddr
            set $lineendaddr = $endaddr
        end
        set $a = $addr
        while $a < $lineendaddr
            printf "0x%02x ", *(unsigned char *)$a
            set $a++
        end
        printf "'"
        set $a = $addr
        while $a < $lineendaddr
            printf "%c", *(char *)$a
            set $a++
        end
        printf "'\n"
        set $addr = $addr + 8
    end
end

document xac
usage: xac address count
end


M .gdbinit => .gdbinit +2 -0
@@ 1,2 1,4 @@
source .gdb_macros

handle all nostop pass
handle SIGUSR1 nostop noprint

M .gdbinit-1051 => .gdbinit-1051 +2 -0
@@ 1,3 1,5 @@
source .gdb_macros

set pagination off
target remote localhost:2331
source tools/gdb_crash_extend.py