docs(huya): 模拟器存活闪退诊断报告与 Frida 探测脚本证据
- 诊断报告: attach 主进程静默退出/EGL 崩溃, 仅约 4s 窗口可抓帧 - scripts: attach/spawn/hook/emu 系列 Frida 脚本与抓帧/验证工具 - evidence: identity/reqchain/frame/inputbuf/magic_buf/propedge 抓取样本, emu_* 存活对比, diag_* 策略实验, baseline 裸测基准
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env python3
|
||||
"""可靠进程存活监控: 以 adb pidof + /proc/<pid> 为唯一事实来源.
|
||||
|
||||
不用 frida enumerate_processes 判断存活 (有延迟/漏报, 且 spawn 后枚举不稳定)。
|
||||
用法: python3 watch_proc.py <seconds> [label] -- 对当前 com.duowan.kiwi 进程做轮询
|
||||
输出: 每 2s 一行 pid/状态; 结束时报告存活与否与死亡精确时长。
|
||||
"""
|
||||
import subprocess, sys, time
|
||||
|
||||
ADB = ["adb", "-s", "127.0.0.1:5555"]
|
||||
PACKAGE = "com.duowan.kiwi"
|
||||
|
||||
def adb(*a):
|
||||
return subprocess.run(ADB + list(a), capture_output=True, text=True)
|
||||
|
||||
def pidof():
|
||||
r = adb("shell", "pidof", PACKAGE)
|
||||
out = r.stdout.strip()
|
||||
return [int(x) for x in out.split()] if out else []
|
||||
|
||||
def proc_ok(pid):
|
||||
r = adb("shell", "ls", f"/proc/{pid}/status")
|
||||
return r.returncode == 0
|
||||
|
||||
def main():
|
||||
seconds = int(sys.argv[1]) if len(sys.argv) > 1 else 60
|
||||
label = sys.argv[2] if len(sys.argv) > 2 else ""
|
||||
print(f"[watch:{label}] {seconds}s, 起点 pids={pidof()}", flush=True)
|
||||
t0 = time.time()
|
||||
seen = {}
|
||||
last_alive = t0
|
||||
last_dead = None
|
||||
while time.time() - t0 < seconds:
|
||||
pids = pidof()
|
||||
if pids:
|
||||
for p in pids:
|
||||
seen.setdefault(p, time.time())
|
||||
last_alive = time.time()
|
||||
last_dead = None
|
||||
print(f" +{time.time()-t0:5.1f}s ALIVE pids={pids}", flush=True)
|
||||
else:
|
||||
if last_dead is None:
|
||||
last_dead = time.time()
|
||||
print(f" +{time.time()-t0:5.1f}s DEAD (was alive={last_alive-t0:.1f}s)", flush=True)
|
||||
time.sleep(2)
|
||||
dur = time.time() - t0
|
||||
final = pidof()
|
||||
print(f"[watch:{label}] 结束: alive={bool(final)} final_pids={final} 存活时长={last_alive-t0:.1f}s 死亡时刻={last_dead-t0 if last_dead else '未死亡'} 总时长={dur:.1f}s", flush=True)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user