Skip to content

Instantly share code, notes, and snippets.

@nmcv
Created April 27, 2015 16:57
Show Gist options
  • Save nmcv/212250dc8eb865a5282e to your computer and use it in GitHub Desktop.
Save nmcv/212250dc8eb865a5282e to your computer and use it in GitHub Desktop.
Examine memory with ASCII view in GDB
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 "%#02x ", *(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
@nmcv
Copy link
Author

nmcv commented Apr 27, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment