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

pidgeot at users.sourceforge.net pidgeot at users.sourceforge.net
Sat Jul 31 03:14:23 CEST 2010


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

Log Message:
-----------
Minor bugfixes in Kyra function detection

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

Modified: tools/branches/gsoc2010-decompiler/decompiler/engine.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/engine.h	2010-07-31 00:56:43 UTC (rev 51528)
+++ tools/branches/gsoc2010-decompiler/decompiler/engine.h	2010-07-31 01:14:22 UTC (rev 51529)
@@ -38,7 +38,7 @@
 	std::string _name;     ///< Function name.
 	GraphVertex _v;        ///< Graph vertex for the entry point to the function.
 	uint32 _args;          ///< Number of arguments to the function.
-	bool _retVal;           ///< Whether or not the function returns a value.
+	bool _retVal;          ///< Whether or not the function returns a value.
 	std::string _metadata; ///< Metadata for code generation.
 
 	/**

Modified: tools/branches/gsoc2010-decompiler/decompiler/kyra/disassembler.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/kyra/disassembler.cpp	2010-07-31 00:56:43 UTC (rev 51528)
+++ tools/branches/gsoc2010-decompiler/decompiler/kyra/disassembler.cpp	2010-07-31 01:14:22 UTC (rev 51529)
@@ -353,8 +353,6 @@
 
 	// Disassemble
 	std::set<uint16> jumpTargets;
-	// Map from addresses to instructions
-	std::map<uint16, InstIterator> addrMap;
 	uint16 numInsts = _dataChunk._size / 2;
 	for (uint16 i = 0; i < numInsts; ++i) {
 		uint16 address = i*2;
@@ -374,7 +372,7 @@
 			parameter = 0;
 		}
 
-#define ADD_INST addrMap[address] = _insts.insert(_insts.end(), Instruction());
+#define ADD_INST _insts.insert(_insts.end(), Instruction());
 #define LAST_INST (_insts[_insts.size()-1])
 #define OPCODE_MD(name, category, stackChange, hasParam, codeGenData) \
 		ADD_INST; \
@@ -546,6 +544,12 @@
 #undef ADD_INST
 	}
 
+	// Map from addresses to instructions
+	std::map<uint16, InstIterator> addrMap;
+
+	for (InstIterator it = _insts.begin(); it != _insts.end(); ++it)
+		addrMap[it->_address] = it;
+
 	// Function detection
 	uint16 nextFunc = 0;
 	// Process candidate entry points


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