import gdb, sys inf = gdb.selected_inferior() pid = inf.pid cands = [] for line in open("/proc/%d/maps" % pid): if "nvidiactl" in line and "rw-s" in line: parts = line.split() try: lo, hi = [int(x,16) for x in parts[0].split('-')] except Exception: continue if hi - lo == 0x4000: cands.append(lo + 0x80) print("CANDIDATES %s" % ["0x%x" % c for c in cands]) class W(gdb.Breakpoint): def __init__(self, addr): super().__init__("*(unsigned int*)0x%x" % addr, gdb.BP_WATCHPOINT, gdb.WP_READ, internal=False) self.addr = addr self.silent = True def stop(self): print("READWORD 0x%x" % self.addr) return True armed = 0 for c in cands: try: W(c); armed += 1 except Exception as e: print("watchfail 0x%x: %s" % (c, e)) print("ARMED %d" % armed) if armed: gdb.execute("continue") print("T80R-DONE")