Changeset 807
- Timestamp:
- 2011-04-27T07:56:54+02:00 (2 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
Decompiler.class.php (modified) (1 diff)
-
decompilesample.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Decompiler.class.php
r806 r807 782 782 // }}} 783 783 // {{{ try/catch 784 if (!empty($firstOp['jmpins']) && $opcodes[$firstOp['jmpins'][0]]['opcode'] == XC_JMP 785 && $lastOp['opcode'] == XC_JMP && !empty($lastOp['jmpouts']) && $lastOp['jmpouts'][0] <= $firstOp['jmpins'][0] 786 && !empty($opcodes[$range[1] + 1]['jmpins']) && $opcodes[$opcodes[$range[1] + 1]['jmpins'][0]]['opcode'] == XC_JMPZNZ 787 ) { 788 $nextRange = array($lastOp['jmpouts'][0], $firstOp['jmpins'][0]); 789 $conditionRange = array($range[0], $nextRange[0] - 1); 790 $this->removeJmpInfo($EX, $conditionRange[1]); 791 $bodyRange = array($nextRange[1], $range[1]); 792 $this->removeJmpInfo($EX, $bodyRange[1]); 793 794 $initial = ''; 795 $this->dasmBasicBlock($EX, $conditionRange, $indent . INDENT); 796 $conditionCodes = array(); 797 for ($i = $conditionRange[0]; $i <= $conditionRange[1]; ++$i) { 798 if (isset($opcodes[$i]['php'])) { 799 $conditionCodes[] = str($opcodes[$i]['php'], $EX); 800 } 801 } 802 $conditionCodes[] = str($this->getOpVal($opcodes[$conditionRange[1]]['op1'], $EX), $EX); 803 if (implode(',', $conditionCodes) == 'true') { 804 $conditionCodes = array(); 805 } 806 807 $this->dasmBasicBlock($EX, $nextRange, $indent . INDENT); 808 $nextCodes = array(); 809 for ($i = $nextRange[0]; $i <= $nextRange[1]; ++$i) { 810 if (isset($opcodes[$i]['php'])) { 811 $nextCodes[] = str($opcodes[$i]['php'], $EX); 812 } 813 } 814 $this->beginComplexBlock($EX); 815 echo $indent, 'for (', str($initial, $EX), '; ', implode(', ', $conditionCodes), '; ', implode(', ', $nextCodes), ') ', '{', PHP_EOL; 816 $this->recognizeAndDecompileClosedBlocks($EX, $bodyRange, $indent . INDENT); 817 echo $indent, '}', PHP_EOL; 818 $this->endComplexBlock($EX); 819 return; 820 } 821 // }}} 822 // {{{ try/catch 784 823 if (!empty($firstOp['jmpins']) && !empty($opcodes[$firstOp['jmpins'][0]]['isCatchBegin'])) { 785 824 $catchBlocks = array(); -
trunk/decompilesample.php
r805 r807 302 302 } while (false); 303 303 304 for ($i = 1; $i < 10; ++$i) { 304 $i = 1; 305 306 for (; $i < 10; ++$i) { 305 307 echo $i; 306 308 break; … … 427 429 goto a; 428 430 429 for ($i = 1; $i <= 2; ++$i) { 431 $i = 1; 432 433 for (; $i <= 2; ++$i) { 430 434 goto a; 431 435 }
Note: See TracChangeset
for help on using the changeset viewer.

