Created
April 27, 2015 16:57
-
-
Save nmcv/212250dc8eb865a5282e to your computer and use it in GitHub Desktop.
Examine memory with ASCII view in GDB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Taken from http://stackoverflow.com/a/25813099/588966