-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdump_variable_tables.gdb
More file actions
55 lines (41 loc) · 1.28 KB
/
Copy pathdump_variable_tables.gdb
File metadata and controls
55 lines (41 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#
# Copyright (c) 2026 Rocco Corsi <5201151+rcorsi@users.noreply.github.com>
#
define dump-tables
dont-repeat
dump-basic-variable-table
dump-basic-array-table
end
define dump-basic-variable-table
dont-repeat
set $start = *(unsigned short*)0x1B
set $end = *(unsigned short*)0x1D
set $ptr = $start
printf "Dumping Variable Table (0x%x - 0x%x)\n", $start, $end
if ($start == $end)
printf "No variables found in the table.\n"
end
while ($ptr < $end)
set $c1 = *(char*)($ptr)
set $c2 = *(char*)($ptr+1)
printf "Var: %c%c%c\n", $c1, $c2 & 0x7f, $c2 & 0x80 ? '$' : 0x0
set $ptr = $ptr + 7
end
end
define dump-basic-array-table
dont-repeat
set $start = *(unsigned short*)0x1D
set $end = *(unsigned short*)0x1F
set $ptr = $start
printf "Dumping Array Table (0x%x - 0x%x)\n", $start, $end
if ($start == $end)
printf "No arrays found in the table.\n"
end
while ($ptr < $end)
set $c1 = *(char*)($ptr)
set $c2 = *(char*)($ptr+1)
set $array_space = *(unsigned short*)($ptr+2)
printf "Arr: %c%c%c storage: 0x%x (%d)\n", $c1, $c2 & 0x7f, $c2 & 0x80 ? '$' : 0x0, $array_space, $array_space
set $ptr = $ptr + $array_space
end
end