[Scummvm-cvs-logs] SF.net SVN: scummvm:[50715] tools/branches/gsoc2010-decompiler/decompiler
pidgeot at users.sourceforge.net
pidgeot at users.sourceforge.net
Tue Jul 6 01:05:12 CEST 2010
Revision: 50715
http://scummvm.svn.sourceforge.net/scummvm/?rev=50715&view=rev
Author: pidgeot
Date: 2010-07-05 23:05:12 +0000 (Mon, 05 Jul 2010)
Log Message:
-----------
Improve graph output
Modified Paths:
--------------
tools/branches/gsoc2010-decompiler/decompiler/control_flow.cpp
tools/branches/gsoc2010-decompiler/decompiler/graph.h
tools/branches/gsoc2010-decompiler/decompiler/test/cfg_test.h
Modified: tools/branches/gsoc2010-decompiler/decompiler/control_flow.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/control_flow.cpp 2010-07-05 23:02:43 UTC (rev 50714)
+++ tools/branches/gsoc2010-decompiler/decompiler/control_flow.cpp 2010-07-05 23:05:12 UTC (rev 50715)
@@ -388,7 +388,7 @@
GroupPtr targetTargetGr = GET(boost::target(*toe, _g));
if (targetTargetGr->_start->_address > targetGr->_prev->_end->_address) {
targetGr->_startElse = true;
- targetTargetGr->_prev->_endElse = true;
+ targetTargetGr->_prev->_endElse = targetGr.get();
}
}
}
Modified: tools/branches/gsoc2010-decompiler/decompiler/graph.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/graph.h 2010-07-05 23:02:43 UTC (rev 50714)
+++ tools/branches/gsoc2010-decompiler/decompiler/graph.h 2010-07-05 23:05:12 UTC (rev 50715)
@@ -69,12 +69,12 @@
friend void ::boost::intrusive_ptr_release(Group *p);
public:
- ConstInstIterator _start; ///< First instruction in the group.
- ConstInstIterator _end; ///< Last instruction in the group.
- int _stackLevel; ///< Level of the stack upon entry.
- GroupType _type; ///< Type of the group.
- bool _startElse; ///< Group is start of an else block.
- bool _endElse; ///< Group is end of an else block.
+ ConstInstIterator _start; ///< First instruction in the group.
+ ConstInstIterator _end; ///< Last instruction in the group.
+ int _stackLevel; ///< Level of the stack upon entry.
+ GroupType _type; ///< Type of the group.
+ bool _startElse; ///< Group is start of an else block.
+ Group *_endElse; ///< Group is end of an else block.
Group *_prev; ///< Pointer to the previous group, when ordered by address. Used for short-circuit analysis.
Group *_next; ///< Pointer to the next group, when ordered by address.
@@ -97,7 +97,7 @@
_type = kNormal;
_prev = prev.get();
_startElse = false;
- _endElse = false;
+ _endElse = NULL;
if (_prev != NULL)
_prev->_next = this;
_next = NULL;
@@ -111,7 +111,7 @@
* @return The std::ostream used for output.
*/
friend std::ostream &operator<<(std::ostream &output, GroupPtr group) {
- output << "Block type: ";
+ output << "{Block type: ";
switch(group->_type) {
case kNormal:
output << "Normal";
@@ -136,7 +136,8 @@
if (group->_startElse)
output << "Start of else\\n";
if (group->_endElse)
- output << "End of else\\n";
+ output << boost::format("End of else at %08x\\n") % group->_endElse->_start->_address;
+ output << "|";
ConstInstIterator inst = group->_start;
do {
output << boost::format("%08x: %s") % inst->_address % inst->_name;
@@ -152,12 +153,19 @@
for (std::string::iterator it = s.begin(); it != s.end(); ++it)
if (*it == '"')
output << "\\\"";
+ else if (*it == '|')
+ output << "\\|";
+ else if (*it == '{')
+ output << "\\{";
+ else if (*it == '}')
+ output << "\\}";
else
output << *it;
}
}
output << boost::format(" (%d)") % inst->_stackChange << "\\n";
} while (inst++ != group->_end);
+ output << "}";
return output;
}
};
@@ -245,7 +253,7 @@
* @param out The std::ostream write_graphviz is writing to.
*/
void operator()(std::ostream& out) const {
- out << "node [shape=box]" << std::endl;
+ out << "node [shape=record]" << std::endl;
out << "XXX [shape=none, label=\"\", height=0]" << std::endl;
out << "XXX -> 0" << std::endl;
}
Modified: tools/branches/gsoc2010-decompiler/decompiler/test/cfg_test.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/test/cfg_test.h 2010-07-05 23:02:43 UTC (rev 50714)
+++ tools/branches/gsoc2010-decompiler/decompiler/test/cfg_test.h 2010-07-05 23:05:12 UTC (rev 50715)
@@ -502,7 +502,7 @@
case 0x8B:
TS_ASSERT(gr->_type == kNormal);
TS_ASSERT(gr->_startElse);
- TS_ASSERT(gr->_endElse);
+ TS_ASSERT(gr->_endElse->_start->_address == 0x8B);
break;
case 0x91:
TS_ASSERT(gr->_type == kNormal);
@@ -512,7 +512,7 @@
case 0xA6:
TS_ASSERT(gr->_type == kNormal);
TS_ASSERT(!gr->_startElse);
- TS_ASSERT(gr->_endElse);
+ TS_ASSERT(gr->_endElse->_start->_address == 0x91);
break;
default:
TS_ASSERT(gr->_type == kNormal);
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