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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Thu Aug 12 14:49:36 CEST 2010


Revision: 52037
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52037&view=rev
Author:   fingolfin
Date:     2010-08-12 12:49:36 +0000 (Thu, 12 Aug 2010)

Log Message:
-----------
DECOMPILER: Assert out when indent level underflows

This easily happens when working on a new decompiler engine,
e.g. if Engine::getDestAddress has not been implemented correctly.
Maybe an exception would be even better than an assert, but at
least it does not crash in weird places now.

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

Modified: tools/branches/gsoc2010-decompiler/decompiler/codegen.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/codegen.cpp	2010-08-12 12:46:57 UTC (rev 52036)
+++ tools/branches/gsoc2010-decompiler/decompiler/codegen.cpp	2010-08-12 12:49:36 UTC (rev 52037)
@@ -181,8 +181,10 @@
 		GroupPtr p = GET(entryPoint);
 		while (p != NULL) {
 			for (std::vector<CodeLine>::iterator it = p->_code.begin(); it != p->_code.end(); ++it) {
-				if (it->_unindentBefore)
+				if (it->_unindentBefore) {
+					assert(_indentLevel > 0);
 					_indentLevel--;
+				}
 				_output << boost::format("%08X: %s") % p->_start->_address % indentString(it->_line) << std::endl;
 				if (it->_indentAfter)
 					_indentLevel++;


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