Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions pybind/MTA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ void bind_multi_thread_analysis(py::module& m) {
public:
using MTA::MTA;
using MTA::runOnModule;
void detect() { reportRaces(); }
};

py::class_<PublicMTA, std::shared_ptr<PublicMTA>>(m, "MTA", "Multi-Thread Analysis class")
Expand All @@ -38,19 +39,25 @@ 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<CallGraph*>(tct->getThreadCallGraph()));
}, "Analyze entry")
Comment on lines +42 to +45
.def("mayHappenInParallelInst", &MHP::mayHappenInParallelInst,
py::arg("node1"), py::arg("node2"),
"Check if two ICFG nodes may happen in parallel");

py::class_<LockAnalysis, std::shared_ptr<LockAnalysis>>(m, "LockAnalysis", "Lock Set Analysis class")
.def(py::init([](std::shared_ptr<TCT> tct){
return std::make_shared<LockAnalysis>(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<CallGraph*>(tct->getThreadCallGraph()));
}, "Analysis entry")
.def("isProtectedByCommonLock", &LockAnalysis::isProtectedByCommonLock,
py::arg("node1"), py::arg("node2"),
"Check if two ICFG nodes are protected by common locks");

Expand Down
2 changes: 1 addition & 1 deletion pysvf/pysvf.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Loading