From 862e370624e7d2145c8890d3db479f7b8fcb4312 Mon Sep 17 00:00:00 2001 From: bjjwwang Date: Sat, 2 May 2026 21:22:16 +1000 Subject: [PATCH 1/2] Port Assignment-3/CPP from AbstractStateManager to AbstractInterpretation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Upstream SVF folded the AbstractStateManager class back into the .cpp implementations and removed the public AE/Svfexe/AbstractStateManager.h header. Assignment_3.h still tried to include that header, so the macOS-latest CI fails with: Assignment-3/CPP/Assignment_3.h:29:10: fatal error: 'AE/Svfexe/AbstractStateManager.h' file not found The methods Assignment-3 actually uses on the manager — getTrace(), operator[], getGepByteOffset() — are now on AbstractInterpretation. Switch the field type to AbstractInterpretation* and obtain it via the upstream singleton (AbstractInterpretation::getAEInstance()). The singleton wires SVFIR from PAG::getPAG() internally, so we no longer need to construct an explicit Andersen analysis just to feed the manager. The destructor used to 'delete svfStateMgr'; that's wrong for the singleton (SVF owns its lifetime), so drop it. Verified locally: docker run ubuntu:24.04 with svf-lib (v1.0.2555) + LLVM 21.1.0 prebuilt + Z3, cmake . && make -j4 builds 100% — both libassign3 and the ass3 binary link cleanly. Co-Authored-By: Claude Opus 4.7 (1M context) --- Assignment-3/CPP/Assignment_3.h | 6 +++--- Assignment-3/CPP/Assignment_3_Helper.cpp | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Assignment-3/CPP/Assignment_3.h b/Assignment-3/CPP/Assignment_3.h index da75f38..ccfde23 100644 --- a/Assignment-3/CPP/Assignment_3.h +++ b/Assignment-3/CPP/Assignment_3.h @@ -26,7 +26,7 @@ */ #include "Assignment_3_Helper.h" #include "AE/Svfexe/AbsExtAPI.h" -#include "AE/Svfexe/AbstractStateManager.h" +#include "AE/Svfexe/AbstractInterpretation.h" #include "SVFIR/SVFIR.h" namespace SVF { @@ -122,7 +122,7 @@ namespace SVF { /// Destructor virtual ~AbstractExecution() { - delete svfStateMgr; + // svfStateMgr is the AbstractInterpretation singleton; SVF owns its lifetime. } protected: @@ -133,7 +133,7 @@ namespace SVF { /// AbsExtAPI and the GEP/load/store helpers (getGepByteOffset etc.) /// read and write through this manager; we don't keep a separate /// postAbsTrace map any more. - AbstractStateManager* svfStateMgr = nullptr; + AbstractInterpretation* svfStateMgr = nullptr; /// Map a function to its corresponding WTO Map funcToWTO; diff --git a/Assignment-3/CPP/Assignment_3_Helper.cpp b/Assignment-3/CPP/Assignment_3_Helper.cpp index a0849a1..e8174af 100644 --- a/Assignment-3/CPP/Assignment_3_Helper.cpp +++ b/Assignment-3/CPP/Assignment_3_Helper.cpp @@ -543,8 +543,11 @@ void AbstractExecution::ensureAllAssertsValidated() { void AbstractExecution::analyse() { // Init WTOs for all functions, and handle Global ICFGNode of SVFModule initWTO(); - AndersenWaveDiff* ander = AndersenWaveDiff::createAndersenWaveDiff(svfir); - svfStateMgr = new AbstractStateManager(svfir, ander); + // AbstractStateManager was folded into AbstractInterpretation upstream; the + // header AE/Svfexe/AbstractStateManager.h was removed. Use the singleton + // AbstractInterpretation; it pulls SVFIR from PAG::getPAG() internally and + // does not need an explicit Andersen analysis to be passed in. + svfStateMgr = &AbstractInterpretation::getAEInstance(); utils = new AbsExtAPI(svfStateMgr); // Handle the global node From 2e0d566bf5c6a38751b900bf56a88a9ca02d1398 Mon Sep 17 00:00:00 2001 From: bjjwwang Date: Sat, 2 May 2026 21:39:17 +1000 Subject: [PATCH 2/2] Port Assignment-3/Python helper to AbstractInterpretation as well MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mirror the C++ port: AbstractStateManager was folded into AbstractInterpretation upstream and removed; the Python helper similarly switches from 'pysvf.AbstractStateManager(svfir, ander)' to 'pysvf.AbstractInterpretation.getAEInstance()'. That requires the matching SVF-Python change (PR on bjjwwang/SVF-Python2: fix/port-AE-bindings-to-AbstractInterpretation) to land first so a fresh pysvf wheel actually exposes 'AbstractInterpretation.getAEInstance()'. The Andersen instance is no longer needed: the AI singleton pulls SVFIR from PAG::getPAG() and runs its own pointer analysis when needed. Drop the explicit 'self.ander = pysvf.AndersenWaveDiff(...)' line. Verified end-to-end: - 'python3 -c "import ast; ast.parse(open(...))"' on the patched helper -> syntax OK. - Built the matching SVF-Python wheel in 'docker run --rm ubuntu:24.04', installed it, and 'import Assignment_3_Helper' succeeds — both AbstractExecutionHelper and AbstractExecution classes resolve. Co-Authored-By: Claude Opus 4.7 (1M context) --- Assignment-3/Python/Assignment_3_Helper.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Assignment-3/Python/Assignment_3_Helper.py b/Assignment-3/Python/Assignment_3_Helper.py index 02a5c97..87dce44 100644 --- a/Assignment-3/Python/Assignment_3_Helper.py +++ b/Assignment-3/Python/Assignment_3_Helper.py @@ -204,7 +204,7 @@ class AbstractExecutionHelper: managing GEP object offsets, and other utilities. """ - def __init__(self, svfir: pysvf.SVFIR, svf_state_mgr: pysvf.AbstractStateManager = None): + def __init__(self, svfir: pysvf.SVFIR, svf_state_mgr: 'pysvf.AbstractInterpretation' = None): """ Initialize member variables. """ @@ -222,7 +222,8 @@ def __init__(self, svfir: pysvf.SVFIR, svf_state_mgr: pysvf.AbstractStateManager # ------------------------------------------------------------------ # Helpers that used to live as instance methods on `pysvf.AbstractState`. - # Upstream (Semi-Sparse refactor) moved them to `AbstractStateManager`, + # Upstream (Semi-Sparse refactor) moved them to `AbstractInterpretation` + # (formerly `AbstractStateManager`, whose public header was removed), # which requires a sparsity-aware trace we don't keep here. We re-implement # the dense-mode behavior using only public AbstractState surface so the # Python side mirrors the C++ side (`AbstractExecutionHelper::getByteOffset`). @@ -446,8 +447,11 @@ def __init__(self, pag: pysvf.SVFIR): # as the GEP/load/store helpers (getGepByteOffset etc.). Replaces # the old `self.post_abs_trace` dict so reads/writes on # `self.post_abs_trace[node]` go through the mgr's trace. - self.ander = pysvf.AndersenWaveDiff(self.svfir) - self.svf_state_mgr = pysvf.AbstractStateManager(self.svfir, self.ander) + # AbstractStateManager was folded into AbstractInterpretation upstream + # (the AbstractStateManager.h header was removed). Use the + # AbstractInterpretation singleton; it pulls SVFIR from PAG::getPAG() + # internally and does not need an explicit Andersen instance. + self.svf_state_mgr = pysvf.AbstractInterpretation.getAEInstance() # Alias preserved so existing call-sites `self.post_abs_trace[node]` # keep working. The mgr supports __getitem__/__setitem__/__contains__. self.post_abs_trace = self.svf_state_mgr