Perftrace
Trace instruction execution using perf breakpoints in Python
Install / Use
/learn @trishume/PerftraceREADME
perftrace
This is a tiny Python library which compiles a C helper that lets it use the perf_event_open syscall to use hardware breakpoints to trace a small set of addresses in any program and capture their registers when the breakpoints are hit.
child = StoppedChild(lambda: os.execv("./cache", ["./cache"]))
bp = Breakpoint(child.pid, 0x402720, ["SI", "DI"], one_time=False)
bp2 = Breakpoint(child.pid, 0x402ff0, ["SI", "DI"], one_time=True)
child.resume()
# Process is running at this time...
child.wait()
events = sorted(itertools.chain(bp.results(), bp2.results()), key=lambda x: x.time)
for sample in events:
print(sample)
Related Skills
node-connect
342.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
85.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
342.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
342.5kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
