blob: 5a1234839a3c86ed700bcd8ba4884a4ee5ee6963 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
import gdb
gr = gdb.execute
inf = gdb.selected_inferior()
pid = inf.pid
base = None
for line in open("/proc/%d/maps" % pid):
parts = line.split()
try:
lo, hi = [int(x,16) for x in parts[0].split('-')]
except Exception:
continue
if base is None and "libnvidia-eglcore" in line and int(parts[2],16) == 0:
base = lo
print("BASE 0x%x" % (base or 0))
C = base + 0x2070b7c
v = int(gdb.parse_and_eval("*(unsigned int*)0x%x" % C))
print("COUNT %u" % v)
print(gr("x/8wx 0x%x" % (C - 0x10), to_string=True))
if v:
gr("set {unsigned int}0x%x = 0" % C)
print("WROTE 0")
print("T97-DONE")
|