Add AnalysisEngine and PlatformOps to core library#1062
Add AnalysisEngine and PlatformOps to core library#1062
Conversation
Refactor backward slicing to expose a general-purpose compute_slice_from_label() method on AnalysisResult that accepts an arbitrary label and seed relevance. The existing compute_failure_slices() now delegates to it, iterating error labels and extracting initial relevance from assertions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Michael Agun <danielagun@microsoft.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Merge per-label relevance instead of overwriting when a label is revisited from a different successor, preserving registers and stack offsets from earlier visits. Only fall back to aggregating all assertion registers when the failing assertion was not identified. When it was found but has no register deps, leave the seed empty so compute_slice_from_label enters conservative mode. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Michael Agun <danielagun@microsoft.com>
Move the analysis engine (session management, caching, re-analysis on
file change) and platform abstraction into the core library so both
prevail CLI and MCP frontends can share it.
Changes from the original src/mcp/ versions:
- Replace prevail_headers.hpp with direct includes
- Add [[nodiscard]] to PlatformOps virtual methods
- Fix option overrides persisting across calls (init from defaults)
- Remove no-op catch (...) { throw; } in analyze()
- Fix stale 'check.exe' reference in PrevailPlatformOps (now 'prevail')
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Michael Agun <danielagun@microsoft.com>
90cd682 to
c1cee96
Compare
Replace the 3 optional<bool> parameters on analyze() with a pointer to ebpf_verifier_options_t, giving callers full control over verbosity, conformance groups, and all other verifier settings. When null, platform defaults are used. Remove the VerificationOptions struct (subset of ebpf_verifier_options_t that is no longer needed). Store the full options in AnalysisSession so callers can inspect them. Stop hardcoding verbosity flags in analyze() — each frontend (CLI, MCP) sets its own verbosity before calling the engine. Accept ebpf_platform_t by value in PrevailPlatformOps so callers can configure conformance groups before constructing the ops object. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Michael Agun <danielagun@microsoft.com>
|
Now #1061 is merged; however, I'd postpone this refactor to after most of the 107* design issues are addressed. |
Add AnalysisEngine — a session-managing wrapper around the PREVAIL pipeline that handles ELF loading, caching, re-analysis on file change, and live access to AnalysisResult for constraint checking and backward slicing.
PlatformOps is an abstract interface that decouples the engine from platform-specific operations (ELF validation, program enumeration, TLS management, verifier options). PrevailPlatformOps is the portable implementation using only PREVAIL's public API.
These live in src/ (the core library) with no JSON or protocol dependencies, so both the CLI and any server frontend can share them.
Depends on #1061 (compute_slice_from_label).
Files changed: