feat(tracker): signatures and per-type validity from method facts
Original entries carry the signature read from the method body and the per-type verdict of shared runners: a method the original skips for a type via obj.getType() is no longer attributed to it, and a trivial virtual is flagged as a no-op. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
5f3006cdf0
commit
edae0929d7
@@ -31,9 +31,9 @@ function detail(t,m){$('detail-title').textContent=`${typeName(t.name)} · ${m.n
|
||||
const section=(title,text)=>{body.append(el('h3',title));if(text !== undefined)body.append(el('pre',text));};
|
||||
section('Implementacja emulatora',m.source?`${m.source.path}:${m.source.line}\nWłaściciel: ${m.source.owner || '—'}\nHash treści: ${m.source.body_sha256 || '—'}`:'Nie znaleziono rejestracji w emulatorze.');
|
||||
section('Dowody z oryginału');const entries=original(m);if(!entries.length)body.append(el('p','Nieustalone — ekstrakcja nie dostarcza dopasowania w wybranym zakresie.'));
|
||||
for(const o of entries){const b=data.binaries.find(b=>b.id===o.binary_id);const a=el('article');a.append(el('strong',b?binaryName(b):o.binary_id));const dl=el('dl');for(const [key,value] of [['SHA-256',b?.sha256],['Silnik',typeof b?.engine==='object'?JSON.stringify(b.engine):b?.engine],['Właściciel',o.owner],['Id metody',o.method_id],['Implementacja',o.impl_addr],['Gałąź dispatchera',o.case_addr],['Funkcja rejestrująca',o.registration_addr],['Wywołanie rejestracji',o.registration_call_addr],['Przekazanie ID',o.id_push_addr],['Napis',o.string_addr],['Id dowodów',(o.evidence_ids||[]).join(', ')||'—'],['Dopasowanie',MAPPING[o.mapping]||o.mapping],['Dziedziczenie',o.inherited?'Tak':'Nie']]){dl.append(el('dt',key),el('dd',value===null || value===undefined?'—':String(value)));}a.append(dl);if(o.registration_addr || o.evidence_ids?.length)a.append(el('p','Dowód rejestracji ASM potwierdza rozpoznanie API; nie stanowi weryfikacji zachowania implementacji.','muted'));if(b?.limitations?.length){a.append(el('strong','Ograniczenia ekstrakcji'));a.append(el('pre',b.limitations.map(item=>typeof item==='string'?item:JSON.stringify(item,null,2)).join('\n')));}if(b?.coverage !== undefined)a.append(el('pre','Zakres ekstrakcji: '+(typeof b.coverage==='string'?b.coverage:JSON.stringify(b.coverage,null,2))));body.append(a);}
|
||||
for(const o of entries){const b=data.binaries.find(b=>b.id===o.binary_id);const a=el('article');a.append(el('strong',b?binaryName(b):o.binary_id));const dl=el('dl');for(const [key,value] of [['SHA-256',b?.sha256],['Silnik',typeof b?.engine==='object'?JSON.stringify(b.engine):b?.engine],['Właściciel',o.owner],['Id metody',o.method_id],['Sygnatura',o.signature],['Dla tego typu',o.per_type],['Implementacja',o.impl_addr],['Gałąź dispatchera',o.case_addr],['Funkcja rejestrująca',o.registration_addr],['Wywołanie rejestracji',o.registration_call_addr],['Przekazanie ID',o.id_push_addr],['Napis',o.string_addr],['Id dowodów',(o.evidence_ids||[]).join(', ')||'—'],['Dopasowanie',MAPPING[o.mapping]||o.mapping],['Dziedziczenie',o.inherited?'Tak':'Nie']]){dl.append(el('dt',key),el('dd',value===null || value===undefined?'—':String(value)));}a.append(dl);if(o.registration_addr || o.evidence_ids?.length)a.append(el('p','Dowód rejestracji ASM potwierdza rozpoznanie API; nie stanowi weryfikacji zachowania implementacji.','muted'));if(b?.limitations?.length){a.append(el('strong','Ograniczenia ekstrakcji'));a.append(el('pre',b.limitations.map(item=>typeof item==='string'?item:JSON.stringify(item,null,2)).join('\n')));}if(b?.coverage !== undefined)a.append(el('pre','Zakres ekstrakcji: '+(typeof b.coverage==='string'?b.coverage:JSON.stringify(b.coverage,null,2))));body.append(a);}
|
||||
section('Przeglądy i testy');body.append(el('p','Poniżej wszystkie zapisane przeglądy metody. Zbiorczy status weryfikacji nie oznacza potwierdzenia każdego wariantu; zakres dowodu określają jego dane.'));if(!(m.reviews||[]).length)body.append(el('p','Brak zapisanych dowodów weryfikacji zachowania.'));for(const review of m.reviews||[])body.append(el('pre',typeof review==='string'?review:JSON.stringify(review,null,2)));
|
||||
const notes=[...(t.mapping_notes||[]),...(m.notes||[])];if(notes.length)section('Uwagi',notes.map(n=>typeof n==='string'?n:JSON.stringify(n,null,2)).join('\n'));
|
||||
if(m.signatures?.length)section('Sygnatura w oryginale',m.signatures.join('\n'));const notes=[...(t.mapping_notes||[]),...(m.notes||[])];if(notes.length)section('Uwagi',notes.map(n=>typeof n==='string'?n:JSON.stringify(n,null,2)).join('\n'));
|
||||
$('details').showModal();
|
||||
}
|
||||
$('close').onclick=()=>$('details').close();$('all-types').onclick=()=>{selected=null;render();};for(const id of ['search','family','binary','status','gaps'])$(id).addEventListener(id==='search'?'input':'change',()=>{if(data){if(id==='family')variants();render();}});
|
||||
|
||||
+30
-1
@@ -165,6 +165,18 @@ def owner_name(owner: str) -> str:
|
||||
return canonical(owner.removeprefix("CMC_"))
|
||||
|
||||
|
||||
def signature(dispatch_row: dict) -> str | None:
|
||||
"""`(int, string/int, …) → double` from the argument getters and result allocator the
|
||||
extractor saw in the method body; None when the body was not analysed."""
|
||||
if "params" not in dispatch_row:
|
||||
return None
|
||||
args = ["/".join(p["types"]) for p in dispatch_row["params"]]
|
||||
if dispatch_row.get("variadic"):
|
||||
args.append("…")
|
||||
returns = "/".join(dispatch_row["returns"]) or "—"
|
||||
return f"({', '.join(args)}) → {returns}"
|
||||
|
||||
|
||||
BASE_SCOPE = "*"
|
||||
# getRunner(0) is the runner behind `@IF`, `@LOOP`, ... statements, not an object type.
|
||||
BUILTIN_SCOPE, BUILTIN_TYPE_ID = "@", 0
|
||||
@@ -218,6 +230,7 @@ def build_tracker(snapshots: list[Snapshot], emulator: dict, reviews: list[dict]
|
||||
"source": None, "original": [], "reviews": [], "notes": [],
|
||||
})
|
||||
|
||||
excluded = defaultdict(set) # (type, method) -> binaries whose code skips it for that type
|
||||
seen = set()
|
||||
for snap in snapshots:
|
||||
sha = snap.binary.get("sha256")
|
||||
@@ -279,6 +292,11 @@ def build_tracker(snapshots: list[Snapshot], emulator: dict, reviews: list[dict]
|
||||
type_row(name).setdefault("inherits", []).append(BASE_SCOPE)
|
||||
return
|
||||
for m in owners[current]:
|
||||
d = dispatch.get((current, m.get("id")), {}) if m.get("id") is not None else {}
|
||||
verdict = {canonical(k): v for k, v in (d.get("per_type") or {}).items()}.get(name)
|
||||
if verdict == "excluded_by_type_check":
|
||||
excluded[(name, m["name"].upper())].add(bid)
|
||||
continue
|
||||
row = method_row(name, m["name"].upper())
|
||||
if len(name_ids[(current, m["name"].upper())]) > 1:
|
||||
note = "Oryginał rejestruje tę nazwę z różnymi ID; skuteczny wybór wymaga sprawdzenia hashtable/dispatchera."
|
||||
@@ -291,9 +309,13 @@ def build_tracker(snapshots: list[Snapshot], emulator: dict, reviews: list[dict]
|
||||
# Child declarations override names from ancestors for this binary.
|
||||
if any(o["binary_id"] == bid and o["owner"] != current for o in row["original"]):
|
||||
continue
|
||||
d = dispatch.get((current, m.get("id")), {}) if m.get("id") is not None else {}
|
||||
if verdict == "trivial_virtual":
|
||||
note = "W oryginale bez efektu dla tego typu: jego vftable zostawia wywoływane metody wirtualne puste."
|
||||
if note not in row["notes"]:
|
||||
row["notes"].append(note)
|
||||
row["original"].append({"binary_id": bid, "owner": current, "method_id": m.get("id"),
|
||||
"impl_addr": d.get("impl_addr"), "case_addr": d.get("case_addr"),
|
||||
"signature": signature(d), "per_type": verdict,
|
||||
"mapping": mapping, "inherited": inherited,
|
||||
"registration_addr": m.get("registration_addr"), "string_addr": m.get("string_addr"),
|
||||
"registration_call_addr": m.get("registration_call_addr"),
|
||||
@@ -318,6 +340,11 @@ def build_tracker(snapshots: list[Snapshot], emulator: dict, reviews: list[dict]
|
||||
if row["source"] is None and method in globals_:
|
||||
row.update(globals_[method])
|
||||
row["notes"] = row["notes"] + ["Obsługa przez globalny fallback Variable."]
|
||||
for (name, method), binaries_ in excluded.items():
|
||||
row = rows.get(name, {}).get("methods", {}).get(method)
|
||||
if row is not None:
|
||||
row["notes"].append(f"Oryginał ({len(binaries_)} binarek) pomija tę metodę dla tego typu: "
|
||||
"warunek obj.getType() we wspólnym runnerze.")
|
||||
base_verbs = {m for m, row in rows.get(BASE_SCOPE, {}).get("methods", {}).items() if row["original"]}
|
||||
for name, t in rows.items():
|
||||
for method, row in t["methods"].items():
|
||||
@@ -350,6 +377,8 @@ def build_tracker(snapshots: list[Snapshot], emulator: dict, reviews: list[dict]
|
||||
row["status"] = "partial"
|
||||
elif row["reviews"] and not current:
|
||||
row["verification"] = "stale"
|
||||
for row in t["methods"].values():
|
||||
row["signatures"] = sorted({o["signature"] for o in row["original"] if o.get("signature")})
|
||||
t["methods"] = sorted(t["methods"].values(), key=lambda m: m["name"])
|
||||
t["mapping_notes"] = sorted(set(t["mapping_notes"]))
|
||||
if "inherits" in t:
|
||||
|
||||
Reference in New Issue
Block a user