[Scummvm-cvs-logs] SF.net SVN: scummvm:[51759] tools/branches/gsoc2010-decompiler/decompiler/ control_flow.cpp

pidgeot at users.sourceforge.net pidgeot at users.sourceforge.net
Thu Aug 5 19:29:17 CEST 2010


Revision: 51759
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51759&view=rev
Author:   pidgeot
Date:     2010-08-05 17:29:16 +0000 (Thu, 05 Aug 2010)

Log Message:
-----------
Fix segfault in function detection

Modified Paths:
--------------
    tools/branches/gsoc2010-decompiler/decompiler/control_flow.cpp

Modified: tools/branches/gsoc2010-decompiler/decompiler/control_flow.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/control_flow.cpp	2010-08-05 16:58:59 UTC (rev 51758)
+++ tools/branches/gsoc2010-decompiler/decompiler/control_flow.cpp	2010-08-05 17:29:16 UTC (rev 51759)
@@ -159,21 +159,10 @@
 }
 
 void ControlFlow::detectFunctions() {
-	uint32 nextFunc = 0;
 	for (ConstInstIterator it = _insts.begin(); it != _insts.end(); ++it) {
 		GraphVertex v = find(it);
 		GroupPtr gr = GET(v);
 
-		// If this is already a function, skip it
-		if (_engine->_functions.find(gr->_start->_address) != _engine->_functions.end()) {
-			nextFunc = _engine->_functions[gr->_start->_address]._endIt->_address;
-			continue;
-		}
-
-		// If a function has already been found here, skip it
-		if (gr->_start->_address < nextFunc)
-			continue;
-
 		InEdgeRange ier = boost::in_edges(v, _g);
 		bool isEntryPoint = true;
 		for (InEdgeIterator e = ier.first; e != ier.second; ++e) {
@@ -204,14 +193,14 @@
 			}
 
 			ConstInstIterator endInst;
-			if (endPoint->_next)
+			if (endPoint->_next) {
 				endInst = endPoint->_next->_start;
-			else
+			} else {
 				endInst = _insts.end();
+			}
 			Function f(gr->_start, endInst);
 			f._v = find(it);
 			_engine->_functions[gr->_start->_address] = f;
-			nextFunc = endInst->_address;
 		}
 	}
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list