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)) class B(gdb.Breakpoint): def __init__(self): super().__init__("*0x%x" % (base + 0xA12DDF), internal=False) self.silent = True; self.done = False def stop(self): if self.done: return True self.done = True try: rdi = int(gdb.parse_and_eval("$rdi")) rsi = int(gdb.parse_and_eval("$rsi")) rdx = int(gdb.parse_and_eval("$rdx")) print("POLL nfds=%d timeout=%d arr=0x%x" % (rsi, rdx, rdi)) fd = int(gdb.parse_and_eval("*(int*)0x%x" % rdi)) ev = int(gdb.parse_and_eval("*(unsigned short*)0x%x" % (rdi + 4))) rv = int(gdb.parse_and_eval("*(unsigned short*)0x%x" % (rdi + 6))) print("FDPOLL fd=%d events=0x%x revents=0x%x" % (fd, ev, rv)) except Exception as e: print("fail %s" % e) return True try: B(); print("BP-SET") gr("continue") except Exception as e: print("bpfail %s" % e) print("T96-DONE")