diff --git a/pybind/MTA.cpp b/pybind/MTA.cpp index 1500574..0d64ef0 100644 --- a/pybind/MTA.cpp +++ b/pybind/MTA.cpp @@ -22,6 +22,7 @@ void bind_multi_thread_analysis(py::module& m) { public: using MTA::MTA; using MTA::runOnModule; + void detect() { reportRaces(); } }; py::class_>(m, "MTA", "Multi-Thread Analysis class") @@ -38,7 +39,10 @@ void bind_multi_thread_analysis(py::module& m) { }), py::arg("tct"), "Initialize MHP analysis", py::keep_alive<1, 2>()) - .def("analyze", &MHP::analyze, "Analyze entry") + .def("analyze", [](MHP& self) { + TCT* tct = self.getTCT(); + self.analyze(tct->getPTA()->getICFG(), static_cast(tct->getThreadCallGraph())); + }, "Analyze entry") .def("mayHappenInParallelInst", &MHP::mayHappenInParallelInst, py::arg("node1"), py::arg("node2"), "Check if two ICFG nodes may happen in parallel"); @@ -46,11 +50,14 @@ void bind_multi_thread_analysis(py::module& m) { py::class_>(m, "LockAnalysis", "Lock Set Analysis class") .def(py::init([](std::shared_ptr tct){ return std::make_shared(tct.get()); - ;}) + }) , py::arg("tct"), "Initialize Lock Set analysis", py::keep_alive<1, 2>()) - .def("analyze", &LockAnalysis::analyze, "Analysis entry") - .def("isProtectedByCommandLock", &LockAnalysis::isProtectedByCommonLock, + .def("analyze", [](LockAnalysis& self) { + TCT* tct = self.getTCT(); + self.analyze(tct->getPTA()->getICFG(), static_cast(tct->getThreadCallGraph())); + }, "Analysis entry") + .def("isProtectedByCommonLock", &LockAnalysis::isProtectedByCommonLock, py::arg("node1"), py::arg("node2"), "Check if two ICFG nodes are protected by common locks"); diff --git a/pysvf/pysvf.pyi b/pysvf/pysvf.pyi index dafc5ee..f4ae35e 100644 --- a/pysvf/pysvf.pyi +++ b/pysvf/pysvf.pyi @@ -2076,4 +2076,4 @@ class MHP: class LockAnalysis: def __init__(self, tct: 'TCT') -> None: ... def analyze(self) -> None: ... - def isProtectedByCommandLock(self, icfg_node_id1: int, icfg_node_id2: int) -> bool: ... + def isProtectedByCommonLock(self, icfg_node_id1: int, icfg_node_id2: int) -> bool: ...