diff --git a/svf/include/Graphs/CDG.h b/svf/include/Graphs/CDG.h index e75e4c4fdb..dcae5b9f4a 100644 --- a/svf/include/Graphs/CDG.h +++ b/svf/include/Graphs/CDG.h @@ -420,35 +420,35 @@ struct DOTGraphTraits : public DOTGraphTraits std::stringstream rawstr(str); const SVF::ICFGNode *icfgNode = node->getICFGNode(); + rawstr << "shape=record"; + if (SVF::SVFUtil::isa(icfgNode)) { - rawstr << "color=black"; + rawstr << ",color=black"; } else if (SVF::SVFUtil::isa(icfgNode)) { - rawstr << "color=yellow"; + rawstr << ",color=yellow"; } else if (SVF::SVFUtil::isa(icfgNode)) { - rawstr << "color=green"; + rawstr << ",color=green"; } else if (SVF::SVFUtil::isa(icfgNode)) { - rawstr << "color=red"; + rawstr << ",color=red"; } else if (SVF::SVFUtil::isa(icfgNode)) { - rawstr << "color=blue"; + rawstr << ",color=blue"; } else if (SVF::SVFUtil::isa(icfgNode)) { - rawstr << "color=purple"; + rawstr << ",color=purple"; } else assert(false && "no such kind of node!!"); - rawstr << ""; - return rawstr.str(); } @@ -479,4 +479,4 @@ struct DOTGraphTraits : public DOTGraphTraits }; } // End namespace SVF -#endif //SVF_CONTROLDG_H \ No newline at end of file +#endif //SVF_CONTROLDG_H diff --git a/svf/include/Graphs/GraphWriter.h b/svf/include/Graphs/GraphWriter.h index 60795adc59..08dcd54911 100644 --- a/svf/include/Graphs/GraphWriter.h +++ b/svf/include/Graphs/GraphWriter.h @@ -171,7 +171,7 @@ class GraphWriter { std::string NodeAttributes = DTraits.getNodeAttributes(Node, G); - O << "\tNode" << static_cast(Node) << " [shape=record,"; + O << "\tNode" << static_cast(Node) << " ["; if (!NodeAttributes.empty()) O << NodeAttributes << ","; O << "label=\"{"; diff --git a/svf/lib/Graphs/CallGraph.cpp b/svf/lib/Graphs/CallGraph.cpp index 42b7df73a2..c8893f51ae 100644 --- a/svf/lib/Graphs/CallGraph.cpp +++ b/svf/lib/Graphs/CallGraph.cpp @@ -449,7 +449,7 @@ struct DOTGraphTraits : public DefaultDOTGraphTraits const FunObjVar* fun = node->getFunction(); if (!SVFUtil::isExtCall(fun)) { - return "shape=box"; + return "shape=record"; } else return "shape=Mrecord"; diff --git a/svf/lib/Graphs/ICFG.cpp b/svf/lib/Graphs/ICFG.cpp index 1238bb8e69..698b0ffb5e 100644 --- a/svf/lib/Graphs/ICFG.cpp +++ b/svf/lib/Graphs/ICFG.cpp @@ -516,35 +516,35 @@ struct DOTGraphTraits : public DOTGraphTraits std::string str; std::stringstream rawstr(str); + rawstr << "shape=record"; + if(SVFUtil::isa(node)) { - rawstr << "color=black"; + rawstr << ",color=black"; } else if(SVFUtil::isa(node)) { - rawstr << "color=yellow"; + rawstr << ",color=yellow"; } else if(SVFUtil::isa(node)) { - rawstr << "color=green"; + rawstr << ",color=green"; } else if(SVFUtil::isa(node)) { - rawstr << "color=red"; + rawstr << ",color=red"; } else if(SVFUtil::isa(node)) { - rawstr << "color=blue"; + rawstr << ",color=blue"; } else if(SVFUtil::isa(node)) { - rawstr << "color=purple"; + rawstr << ",color=purple"; } else assert(false && "no such kind of node!!"); - rawstr << ""; - return rawstr.str(); } diff --git a/svf/lib/Graphs/IRGraph.cpp b/svf/lib/Graphs/IRGraph.cpp index a23ca70373..225220adaf 100644 --- a/svf/lib/Graphs/IRGraph.cpp +++ b/svf/lib/Graphs/IRGraph.cpp @@ -440,71 +440,79 @@ struct DOTGraphTraits : public DefaultDOTGraphTraits template static std::string getEdgeAttributes(SVFVar*, EdgeIter EI, IRGraph*) { + std::string str; + std::stringstream rawstr(str); + + rawstr << "shape=record"; + const SVFStmt* edge = *(EI.getCurrent()); assert(edge && "No edge found!!"); if (SVFUtil::isa(edge)) { - return "color=green"; + rawstr << ",color=green"; } else if (SVFUtil::isa(edge)) { - return "color=black"; + rawstr << ",color=black"; } else if (SVFUtil::isa(edge)) { - return "color=purple"; + rawstr << ",color=purple"; } else if (SVFUtil::isa(edge)) { - return "color=blue"; + rawstr << ",color=blue"; } else if (SVFUtil::isa(edge)) { - return "color=red"; + rawstr << ",color=red"; } else if (SVFUtil::isa(edge)) { - return "color=grey"; + rawstr << ",color=grey"; } else if (SVFUtil::isa(edge)) { - return "color=grey"; + rawstr << ",color=grey"; } else if (SVFUtil::isa(edge)) { - return "color=grey"; + rawstr << ",color=grey"; } else if (SVFUtil::isa(edge)) { - return "color=grey"; + rawstr << ",color=grey"; } else if (SVFUtil::isa(edge)) { - return "color=grey"; + rawstr << ",color=grey"; } else if (SVFUtil::isa(edge)) { - return "color=grey"; + rawstr << ",color=grey"; } else if (SVFUtil::isa(edge)) { - return "color=Turquoise"; + rawstr << ",color=Turquoise"; } else if (SVFUtil::isa(edge)) { - return "color=Turquoise"; + rawstr << ",color=Turquoise"; } else if (SVFUtil::isa(edge)) { - return "color=black,style=dashed"; + rawstr << ",color=black,style=dashed"; } else if (SVFUtil::isa(edge)) { - return "color=black,style=dotted"; + rawstr << ",color=black,style=dotted"; + } + else + { + assert(false && "No such kind edge!!"); } - assert(false && "No such kind edge!!"); - exit(1); + return rawstr.str(); } template diff --git a/svf/lib/Graphs/SVFG.cpp b/svf/lib/Graphs/SVFG.cpp index b154a2fe94..b271ffba9e 100644 --- a/svf/lib/Graphs/SVFG.cpp +++ b/svf/lib/Graphs/SVFG.cpp @@ -1010,98 +1010,99 @@ struct DOTGraphTraits : public DOTGraphTraits std::string str; std::stringstream rawstr(str); + rawstr << "shape=record"; + if(StmtSVFGNode* stmtNode = SVFUtil::dyn_cast(node)) { const SVFStmt* edge = stmtNode->getSVFStmt(); if (SVFUtil::isa(edge)) { - rawstr << "color=green"; + rawstr << ",color=green"; } else if (SVFUtil::isa(edge)) { - rawstr << "color=black"; + rawstr << ",color=black"; } else if (SVFUtil::isa(edge)) { - rawstr << "color=black,style=dotted"; + rawstr << ",color=black,style=dotted"; } else if (SVFUtil::isa(edge)) { - rawstr << "color=purple"; + rawstr << ",color=purple"; } else if (SVFUtil::isa(edge)) { - rawstr << "color=blue"; + rawstr << ",color=blue"; } else if (SVFUtil::isa(edge)) { - rawstr << "color=red"; + rawstr << ",color=red"; } else { assert(0 && "No such kind edge!!"); } - rawstr << ""; } else if(SVFUtil::isa(node)) { - rawstr << "color=black"; + rawstr << ",color=black"; } else if(SVFUtil::isa(node)) { - rawstr << "color=black"; + rawstr << ",color=black"; } else if(SVFUtil::isa(node)) { - rawstr << "color=grey"; + rawstr << ",color=grey"; } else if(SVFUtil::isa(node)) { - rawstr << "color=yellow,penwidth=2"; + rawstr << ",color=yellow,penwidth=2"; } else if(SVFUtil::isa(node)) { - rawstr << "color=yellow,penwidth=2"; + rawstr << ",color=yellow,penwidth=2"; } else if(SVFUtil::isa(node)) { - rawstr << "color=yellow,penwidth=2"; + rawstr << ",color=yellow,penwidth=2"; } else if(SVFUtil::isa(node)) { - rawstr << "color=yellow,penwidth=2"; + rawstr << ",color=yellow,penwidth=2"; } else if(SVFUtil::isa(node)) { - rawstr << "color=yellow,penwidth=2"; + rawstr << ",color=yellow,penwidth=2"; } else if(SVFUtil::isa(node)) { - rawstr << "color=yellow,penwidth=2"; + rawstr << ",color=yellow,penwidth=2"; } else if (SVFUtil::isa(node)) { - rawstr << "color=yellow,penwidth=2"; + rawstr << ",color=yellow,penwidth=2"; } else if (SVFUtil::isa(node)) { - rawstr << "color=yellow,penwidth=2"; + rawstr << ",color=yellow,penwidth=2"; } else if (SVFUtil::isa(node)) { - rawstr << "color=black,penwidth=2"; + rawstr << ",color=black,penwidth=2"; } else if (SVFUtil::isa(node)) { - rawstr << "color=black,penwidth=2"; + rawstr << ",color=black,penwidth=2"; } else if (SVFUtil::isa(node)) { - rawstr << "color=black,penwidth=2"; + rawstr << ",color=black,penwidth=2"; } else if (SVFUtil::isa(node)) { - rawstr << "color=gold,penwidth=2"; + rawstr << ",color=gold,penwidth=2"; } else assert(false && "no such kind of node!!"); @@ -1122,8 +1123,6 @@ struct DOTGraphTraits : public DOTGraphTraits else if(graph->getStat()->inForwardSlice(node)) rawstr << ",style=filled, fillcolor=gray"; - rawstr << ""; - return rawstr.str(); } diff --git a/svf/lib/Graphs/VFG.cpp b/svf/lib/Graphs/VFG.cpp index bc7293154f..6f43db0b47 100644 --- a/svf/lib/Graphs/VFG.cpp +++ b/svf/lib/Graphs/VFG.cpp @@ -1224,32 +1224,34 @@ struct DOTGraphTraits : public DOTGraphTraits std::string str; std::stringstream rawstr(str); + rawstr << "shape=record"; + if(StmtVFGNode* stmtNode = SVFUtil::dyn_cast(node)) { const SVFStmt* edge = stmtNode->getSVFStmt(); if (SVFUtil::isa(edge)) { - rawstr << "color=green"; + rawstr << ",color=green"; } else if (SVFUtil::isa(edge)) { - rawstr << "color=black"; + rawstr << ",color=black"; } else if (SVFUtil::isa(edge)) { - rawstr << "color=black,style=dotted"; + rawstr << ",color=black,style=dotted"; } else if (SVFUtil::isa(edge)) { - rawstr << "color=purple"; + rawstr << ",color=purple"; } else if (SVFUtil::isa(edge)) { - rawstr << "color=blue"; + rawstr << ",color=blue"; } else if (SVFUtil::isa(edge)) { - rawstr << "color=red"; + rawstr << ",color=red"; } else { @@ -1259,53 +1261,51 @@ struct DOTGraphTraits : public DOTGraphTraits } else if (SVFUtil::isa(node)) { - rawstr << "color=grey"; + rawstr << ",color=grey"; } else if (SVFUtil::isa(node)) { - rawstr << "color=grey"; + rawstr << ",color=grey"; } else if (SVFUtil::isa(node)) { - rawstr << "color=grey"; + rawstr << ",color=grey"; } else if(SVFUtil::isa(node)) { - rawstr << "color=black"; + rawstr << ",color=black"; } else if(SVFUtil::isa(node)) { - rawstr << "color=grey"; + rawstr << ",color=grey"; } else if(SVFUtil::isa(node)) { - rawstr << "color=yellow,penwidth=2"; + rawstr << ",color=yellow,penwidth=2"; } else if(SVFUtil::isa(node)) { - rawstr << "color=yellow,penwidth=2"; + rawstr << ",color=yellow,penwidth=2"; } else if (SVFUtil::isa(node)) { - rawstr << "color=yellow,penwidth=2"; + rawstr << ",color=yellow,penwidth=2"; } else if (SVFUtil::isa(node)) { - rawstr << "color=yellow,penwidth=2"; + rawstr << ",color=yellow,penwidth=2"; } else if (SVFUtil::isa(node)) { - rawstr << "color=orange,penwidth=2"; + rawstr << ",color=orange,penwidth=2"; } else if (SVFUtil::isa(node)) { - rawstr << "color=gold,penwidth=2"; + rawstr << ",color=gold,penwidth=2"; } else assert(false && "no such kind of node!!"); - rawstr << ""; - return rawstr.str(); } diff --git a/svf/lib/MTA/TCT.cpp b/svf/lib/MTA/TCT.cpp index 70d138c49a..7bf6e1d713 100644 --- a/svf/lib/MTA/TCT.cpp +++ b/svf/lib/MTA/TCT.cpp @@ -612,11 +612,11 @@ struct DOTGraphTraits : public DefaultDOTGraphTraits std::string attr; if (node->isInloop()) { - attr.append(" style=filled fillcolor=red"); + attr.append("shape=record,style=filled,fillcolor=red"); } else if (node->isIncycle()) { - attr.append(" style=filled fillcolor=yellow"); + attr.append("shape=record,style=filled,fillcolor=yellow"); } return attr; }