aboutsummaryrefslogtreecommitdiffstats
path: root/psp_out/verify_idbs.py
blob: ef3ac3ea9598c9faedcadcc098d1e6f11c0027a9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""Verify every IDB opens cleanly; report the broken ones.

Learned the hard way: killing a run mid-write (timeout) leaves a corrupted .i64
that still LOOKS fine on disk and whose stale outputs silently persist. This
check must run after any interrupted batch.
"""
import glob, os, sys, idapro
bad=[]
for elf in sorted(glob.glob('handover/elf/versions/*/*.elf')):
    tag=os.path.basename(elf)
    try:
        rc=idapro.open_database(elf, run_auto_analysis=False)
        if rc!=0: bad.append((tag,'rc=%s'%rc)); continue
        idapro.close_database(save=False)
    except Exception as e:
        bad.append((tag, repr(e)[:60]))
print("checked %d IDBs; broken: %d"%(len(glob.glob('handover/elf/versions/*/*.elf')), len(bad)))
for t,e in bad: print("  BROKEN %-44s %s"%(t,e))
open('broken_idbs.txt','w').write("\n".join(t for t,_ in bad))