From 40839945b8a8a302e87b6feed7322144ff0c0a58 Mon Sep 17 00:00:00 2001 From: jumormt Date: Tue, 17 Oct 2023 15:19:22 +1100 Subject: [PATCH] CFBasicBlockEdge can have empty icfg edge --- svf/include/Graphs/CFBasicBlockG.h | 31 ++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/svf/include/Graphs/CFBasicBlockG.h b/svf/include/Graphs/CFBasicBlockG.h index f198d7072..309c12514 100644 --- a/svf/include/Graphs/CFBasicBlockG.h +++ b/svf/include/Graphs/CFBasicBlockG.h @@ -84,7 +84,10 @@ class CFBasicBlockEdge : public GenericCFBasicBlockEdgeTy virtual const std::string toString() const { - return _icfgEdge->toString(); + std::string str; + std::stringstream rawstr(str); + rawstr << "CFBBGEdge: [CFBBGNode" << getDstID() << " <-- CFBBGNode" << getSrcID() << "]\t"; + return rawstr.str(); } inline const ICFGEdge *getICFGEdge() const @@ -574,13 +577,16 @@ struct DOTGraphTraits : public DOTGraphTraits(edge->getICFGEdge())) - return "style=solid,color=red"; - else if (SVFUtil::isa(edge->getICFGEdge())) - return "style=solid,color=blue"; - else + if (edge->getICFGEdge()) { + if (SVFUtil::isa(edge->getICFGEdge())){ + return "style=solid,color=red";} + else if (SVFUtil::isa(edge->getICFGEdge())) + return "style=solid,color=blue"; + else + return "style=solid"; + } else { return "style=solid"; - return ""; + } } template @@ -591,11 +597,12 @@ struct DOTGraphTraits : public DOTGraphTraits(edge->getICFGEdge())) - rawstr << dirCall->getCallSite(); - else if (const RetCFGEdge* dirRet = SVFUtil::dyn_cast(edge->getICFGEdge())) - rawstr << dirRet->getCallSite(); - + if (edge->getICFGEdge()) { + if (const CallCFGEdge* dirCall = SVFUtil::dyn_cast(edge->getICFGEdge())) + rawstr << dirCall->getCallSite(); + else if (const RetCFGEdge* dirRet = SVFUtil::dyn_cast(edge->getICFGEdge())) + rawstr << dirRet->getCallSite(); + } return rawstr.str(); } };