Skip to content

Behavioral Evidence

Ryan Cole edited this page Nov 14, 2026 · 1 revision

Structural checks say a candidate looks like the old function. Behavioral checks run it. They're independent of every structural check, and high-criticality hooks require one (How It Works). Details: design §7.3 in docs/design.md.

There are two kinds.

Scenario traces

Run the same scenario on the old build with the original hooks and on the new build with the candidates, and compare the calls hook by hook.

  1. Repair with --trial-out: hooks in review whose only missing evidence is behavioral get trial bindings to their candidate.

    pbeta repair --old old.json --new new.json --hooks hooks.toml --new-binary new\app.exe --out hooks.new.toml --trial-out hooks.trial.toml --store store.json
  2. Run the scenario on both builds with a tracing hook DLL, producing old.jsonl and new.jsonl. The corpus's hook DLL (corpus/hooks/hookdll) is the reference implementation.

  3. Repair again with the traces:

    pbeta repair --old old.json --new new.json --hooks hooks.toml --new-binary new\app.exe --out hooks.new.toml --store store.json --old-trace old.jsonl --new-trace new.jsonl

pbeta trace-diff --old old.jsonl --new new.jsonl --hooks hooks.trial.toml shows the comparison on its own: a hook that behaved differently, didn't fire, wasn't attached, or was applied while in review.

A trial manifest is for test runs only: repair refuses one as input and header won't emit one.

Recorded calls, replayed by emulation

Record real calls on the old build, then replay each recorded case on the candidate in the new binary.

  1. pbeta harness-spec --hooks hooks.toml --analysis old.json --out record-spec.json writes what to capture per hook: argument slots and what pointers point to (struct layouts from analyze --pdb). --redact hook.param keeps a parameter out of the recording.

  2. Run the old build with the recording hook DLL (PBETA_RECORD directory).

  3. Replay:

    pbeta repair ... --new-binary new\app.exe --cases <recording dir>
    pbeta replay --cases <recording dir> --binary new\app.exe --old-rva 0x1600 --new-rva 0x2900 --old-analysis old.json --new-analysis new.json

Replay needs the emulator feature (Installation). Recorded structs are translated by field name between the builds' layouts, and globals are placed by PDB name, so both builds' PDBs help a lot. replay --others replays the cases on every other function as a control: only identical code should pass.

Limits are listed in FAQ.

Clone this wiki locally