Skip to content

Commit fd03146

Browse files
Marek Niepiekloniepiekm
Marek Niepieklo
authored andcommitted
[EGD-6219] Add GDB macro to print memory
Added GDB macro to print out the content of the memory range in hex/ASCII format.
1 parent f28d8cf commit fd03146

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

.gdb_macros

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
define xac
2+
dont-repeat
3+
set $addr = (char *)($arg0)
4+
set $endaddr = $addr + $arg1
5+
while $addr < $endaddr
6+
printf "%p: ", $addr
7+
set $lineendaddr = $addr + 8
8+
if $lineendaddr > $endaddr
9+
set $lineendaddr = $endaddr
10+
end
11+
set $a = $addr
12+
while $a < $lineendaddr
13+
printf "0x%02x ", *(unsigned char *)$a
14+
set $a++
15+
end
16+
printf "'"
17+
set $a = $addr
18+
while $a < $lineendaddr
19+
printf "%c", *(char *)$a
20+
set $a++
21+
end
22+
printf "'\n"
23+
set $addr = $addr + 8
24+
end
25+
end
26+
27+
document xac
28+
usage: xac address count
29+
end
30+

.gdbinit

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
source .gdb_macros
2+
13
handle all nostop pass
24
handle SIGUSR1 nostop noprint

.gdbinit-1051

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
source .gdb_macros
2+
13
set pagination off
24
target remote localhost:2331
35
source tools/gdb_crash_extend.py

0 commit comments

Comments
 (0)