blob: 759d97476930318e11672b89bd29e62e274dab0a (
plain)
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
|
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 PID %d" % (base or 0, pid))
try:
pc = int(gdb.parse_and_eval("$pc"))
print("PC 0x%x off=0x%x" % (pc, pc - base if base else 0))
except Exception as e:
print("pcfail %s" % e)
try:
C = base + 0x2070B7C
print("A8COUNT %u" % int(gdb.parse_and_eval("*(unsigned int*)0x%x" % C)))
except Exception as e:
print("countfail %s" % e)
try:
print(gr("bt 6", to_string=True))
except Exception as e:
print("btfail %s" % e)
gr("detach")
gr("quit")
print("T102-DONE")
|