7 namespace VirtualBinCFG {
11 return "BinaryFunctionDefinition";
16 string CFGNode::toStringForDebugging()
const {
19 s <<
"End of procedure";
26 string CFGNode::id()
const {
28 s <<
"n_" << hex << uintptr_t(node) <<
"_" << dec ;
33 return toStringForDebugging();
36 string CFGEdge::toStringForDebugging()
const {
39 bool anyNonEmpty =
false;
42 if (anyNonEmpty) s <<
" ";
67 string CFGEdge::id()
const {
69 s << src.id() <<
"__" << tgt.id();
77 unsigned int srcIndex = src.getIndex();
79 unsigned int tgtIndex = tgt.getIndex();
80 if (isSgAsmMov(srcNode) ) {
81 SgAsmMov* ifs = isSgAsmMov(srcNode);
83 if (ifs->get_true_body() == tgtNode) {
85 }
else if (ifs->get_false_body() == tgtNode) {
87 }
else ROSE_ASSERT (!
"Bad successor in if statement");
92 if (srcNode == tgtNode) {
106 if (srcNode == tgtNode) {
122 }
else ROSE_ASSERT (!
"Bad successor in conditional expression");
123 }
else if (
isSgAndOp(srcNode) && srcIndex == 1) {
124 if (srcNode == tgtNode) {
130 }
else if (
isSgOrOp(srcNode) && srcIndex == 1) {
131 if (srcNode == tgtNode) {
153 unsigned int fromIndex = from.getIndex();
155 unsigned int toIndex = to.getIndex();
163 if (fromIndex == 1 || fromIndex == 0 && !rs->
get_expression())
return;
173 #ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
176 return node->cfgBinOutEdges(info);
181 return node->cfgBinInEdges(info);
185 const std::set<uint64_t>& AuxiliaryInformation::getPossibleSuccessors(
SgAsmInstruction* insn)
const {
186 static const std::set<uint64_t> emptySet;
187 std::map<SgAsmInstruction*, std::set<uint64_t> >::const_iterator succsIter = indirectJumpTargets.find(insn);
191 std::map<SgAsmStatement*, std::set<uint64_t> >::const_iterator retIter = returnTargets.find(
isSgAsmStatement(f));
192 if (retIter == returnTargets.end()) {
195 return retIter->second;
197 }
else if (succsIter == indirectJumpTargets.end()) {
201 return succsIter->second;
205 AuxiliaryInformation::AuxiliaryInformation(
SgNode* top)
206 : addressToInstructionMap(), indirectJumpTargets(), returnTargets(), incomingEdges()
212 virtual void visit(
SgNode* n) {
222 virtual void visit(
SgNode* n) {
246 virtual void visit(
SgNode* n) {
249 #ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
251 for (
size_t i = 0; i < outEdgesSoFar.size(); ++i) {
255 printf (
"This function is not supported in the ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT mode.\n");
261 AuxInfoTraversal trav(
this);
263 AuxInfoTraversal2 trav2(
this);
265 AuxInfoTraversal3 trav3(
this);