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
