[Scummvm-cvs-logs] SF.net SVN: scummvm:[51531] tools/branches/gsoc2010-decompiler/decompiler/ kyra/disassembler.cpp

pidgeot at users.sourceforge.net pidgeot at users.sourceforge.net
Sat Jul 31 03:29:57 CEST 2010


Revision: 51531
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51531&view=rev
Author:   pidgeot
Date:     2010-07-31 01:29:56 +0000 (Sat, 31 Jul 2010)

Log Message:
-----------
Classify jumps to calls if jump goes to function

Modified Paths:
--------------
    tools/branches/gsoc2010-decompiler/decompiler/kyra/disassembler.cpp

Modified: tools/branches/gsoc2010-decompiler/decompiler/kyra/disassembler.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/kyra/disassembler.cpp	2010-07-31 01:18:16 UTC (rev 51530)
+++ tools/branches/gsoc2010-decompiler/decompiler/kyra/disassembler.cpp	2010-07-31 01:29:56 UTC (rev 51531)
@@ -577,6 +577,7 @@
 		}
 	}
 
+	// Add metadata to newly found functions
 	for (FuncMap::iterator it = _engine->_functions.begin(); it != _engine->_functions.end(); ++it) {
 		std::stringstream s;
 		s << boost::format("sub0x%X") % it->second._startIt->_address;
@@ -600,4 +601,12 @@
 		else
 			_engine->_functions[funcAddrs[i]] = Function(addrMap[funcAddrs[i]], addrMap[funcAddrs[i+1]]);
 	}
+
+	// Correct jumps to functions so they're treated as calls
+	for (InstIterator it = _insts.begin(); it != _insts.end(); ++it) {
+		if (it->_type == kJump || it->_type == kCondJump) {
+			if (_engine->_functions.find(it->_address) != _engine->_functions.end())
+				it->_type = kCall;
+		}
+	}
 }


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