63 Commits

Author SHA1 Message Date
Paweł Kołodziejski ebbfd826d5 ALL: Upgrade tools licence to GPLv3+ 2022-06-26 19:14:49 +02:00
Eugene Sandulenko 16f96eb5d8 TOOLS: Fix few warnings and memory leaks 2019-09-10 16:21:10 +02:00
Thierry Crozat d5c8077933 JANITORIAL: Move copyright notice to a separate file 2014-01-19 18:13:09 +00:00
Thierry Crozat fe2d3c2d71 JANITORIAL: Remove now useless SVN tags 2014-01-06 22:54:34 +00:00
Michael Madsen 63927ee50a DECOMPILER: Pure grouping option
The existing grouping algorithm doesn't work with non-stack-based
engines. Because dot is unable the large amount of vertices you get as a
result, this prevents visualization of the code flow. To get around
that, pure grouping provides an alternative which only considers
branches. This creates the minimal amount of vertices in the graph,
making it much easier for dot to layout the graph.

svn-id: r55832
2011-02-08 22:17:39 +00:00
Jordi Vilalta Prat 6521c96445 DECOMPILER: Improve an error output formatting.
svn-id: r54971
2010-12-20 02:25:17 +00:00
Michael Madsen 4e9914f57e DECOMPILER: Objectify Instruction
*Major* restructuring in this revision.
All other disassemblers will require updates.
Documentation for all of this is coming soon.

svn-id: r54904
2010-12-14 03:14:11 +00:00
Michael Madsen b3a79b748c DECOMPILER: Use pointers to Instructions
svn-id: r54873
2010-12-12 00:15:52 +00:00
Michael Madsen ed2572b845 DECOMPILER: Add typedef for vector of instructions
svn-id: r54848
2010-12-09 22:02:02 +00:00
Michael Madsen 7b4e649ad7 DECOMPILER: Mass enum member renaming
svn-id: r52094
2010-08-14 22:11:24 +00:00
Michael Madsen 8ce1530d03 DECOMPILER: Explain why short-circuit detection
is disabled

svn-id: r52050
2010-08-12 23:50:20 +00:00
Michael Madsen 2460cad3ef DECOMPILER: Prevent segfault if no functions
defined when calling createGroups

svn-id: r52035
2010-08-12 12:35:46 +00:00
Michael Madsen db48f271be DECOMPILER: Add explanatory comments
svn-id: r52023
2010-08-12 00:54:04 +00:00
Michael Madsen b224940c8f DECOMPILER: Bugfix in grouping
svn-id: r51998
2010-08-11 19:40:58 +00:00
Michael Madsen cbabf171bb DECOMPILER: Use iteration to set stack level
svn-id: r51962
2010-08-10 23:57:25 +00:00
Michael Madsen 21bdbed0ce DECOMPILER: Remove useless check in else detection
svn-id: r51848
2010-08-08 00:20:57 +00:00
Michael Madsen 3a771ebe78 DECOMPILER: Code generation for KYRA
svn-id: r51824
2010-08-07 02:39:11 +00:00
Michael Madsen 61209d5f62 Pass in instruction vector to disassemblers
Properly fix function detection

svn-id: r51774
2010-08-06 00:11:27 +00:00
Michael Madsen 4f9e152ddc Only designate full script as single function if
CFG-based function detection not requested

svn-id: r51761
2010-08-05 18:36:28 +00:00
Michael Madsen bebd947439 Re-insert check for existing function
svn-id: r51760
2010-08-05 17:33:06 +00:00
Michael Madsen 4bc908294e Fix segfault in function detection
svn-id: r51759
2010-08-05 17:29:16 +00:00
Michael Madsen 93d6359813 Rewrite function detection
The KYRA-specific function detection has been replaced with a generic,
opt-in function detection which converts unreachable code into
functions.

A post-processing step will be required to fill in metadata for code
generation; this has not yet been implemented.

svn-id: r51748
2010-08-05 01:14:31 +00:00
Michael Madsen 99d32e8f46 Ignore unreachable nodes for expected stack level
svn-id: r51737
2010-08-04 13:00:58 +00:00
Michael Madsen 97e24333a2 Start adapting CFG analysis to KYRA
Basic structure seems to mostly be there, but there are still a few
hitches with functions - probably in the detection.

svn-id: r51719
2010-08-04 02:30:22 +00:00
Michael Madsen e21f61e8d2 Add option to output unreachable groups
svn-id: r51652
2010-08-02 19:26:46 +00:00
Michael Madsen bfdfcff1a2 Remove some unnecessary debug output
svn-id: r51633
2010-08-02 17:11:10 +00:00
Michael Madsen 92c6d8e5b2 Minor fix to else detection
svn-id: r51629
2010-08-02 17:04:14 +00:00
Michael Madsen c66bd1ccfa Major overhaul of else detection
The else detection was horribly, horribly broken, leading to incorrect
and unbalanced output. This has now been revamped entirely, and all
SCUMMv6 scripts are at least balanced now. Additionally, various output
enhancements have been added.

Note: Short-circuit detection has been temporarily disabled, pending
proper handling. Consequently, one test, testShortCircuitDetection, is
currently *expected* to fail.

svn-id: r51621
2010-08-02 14:38:45 +00:00
Michael Madsen 920eb3983c Fix bug in else detection
svn-id: r51262
2010-07-24 21:55:10 +00:00
Michael Madsen cd0bba4fcc Store the corresponding GraphVertex in Group
svn-id: r50898
2010-07-14 22:21:12 +00:00
Michael Madsen e58eec8aaf Annotate edges telling whether or not they represent a jump
In graph output, show jumps using empty arrowheads

svn-id: r50717
2010-07-06 00:05:37 +00:00
Michael Madsen 73364f13d3 Improve graph output
svn-id: r50715
2010-07-05 23:05:12 +00:00
Michael Madsen 6aad611d5d Attempt at using smart pointers for Group properties - committing to
test with valgrind on other machine

svn-id: r50699
2010-07-05 18:45:34 +00:00
Michael Madsen 2b583ed9b7 Constify instruction vector in ControlFlow
svn-id: r50697
2010-07-05 18:02:54 +00:00
Michael Madsen 80338f3abd Remove excess whitespace
svn-id: r50682
2010-07-05 15:22:01 +00:00
Michael Madsen ef57e16343 Fix memory leaks
svn-id: r50680
2010-07-05 14:51:22 +00:00
Michael Madsen f53a6c6b5a Style fixes.
svn-id: r50663
2010-07-05 00:04:18 +00:00
Michael Madsen 8ec35987b4 Only detect breaks in undetermined blocks
svn-id: r50662
2010-07-05 00:02:59 +00:00
Michael Madsen 913c037d77 Refactor break/continue validation into new method
svn-id: r50661
2010-07-04 23:59:14 +00:00
Michael Madsen 5d7249632e Fix bug in continue detection
svn-id: r50655
2010-07-04 21:58:42 +00:00
Michael Madsen 9b86a47ce5 Verify break and continue candidates go to correct loop
svn-id: r50653
2010-07-04 20:40:27 +00:00
Michael Madsen 4d03825684 Don't treat jumps to the while condition as a continue if it's the last
block in the loop

svn-id: r50637
2010-07-03 22:54:46 +00:00
Michael Madsen 83560266ed Detection of the end of an else block
svn-id: r50636
2010-07-03 22:22:07 +00:00
Michael Madsen 9c9a1626ba Add detection of if and else, including test
Still need to find a proper way of detecting when an else ends
Fix incorrect while detection

svn-id: r50635
2010-07-03 21:57:56 +00:00
Michael Madsen 2e1e03af96 Add detection of break and continue, including tests
Small fix to while loop detection (ingoing edge must not be from do-while)

svn-id: r50632
2010-07-03 21:07:30 +00:00
Michael Madsen 9f127464d1 Reorder method calls in CFG analysis - do ifs last
svn-id: r50630
2010-07-03 19:56:24 +00:00
Michael Madsen 6247a85a84 Add detection of do-while conditions, including a test
svn-id: r50629
2010-07-03 19:53:52 +00:00
Michael Madsen 7fc3e714c2 Rename EdgeRange to OutEdgeRange
Add some explanatory comments

svn-id: r50628
2010-07-03 19:51:18 +00:00
Michael Madsen 4c23aae385 Declare methods for construct detection
Add detection of while loops, including a test
Prepare Group for storing information about else blocks

svn-id: r50627
2010-07-03 19:37:50 +00:00
Michael Madsen 286e382705 Fix whitespace
svn-id: r50579
2010-07-01 22:52:06 +00:00