Commit Graph

80 Commits

Author SHA1 Message Date
rocky
d32e67891b More 3.0 bug fixing and tollerance and...
add some 1.4 bytecode tests
2018-06-12 12:19:43 -04:00
rocky
78b8d1cd06 Python 3.0 fixes + administrivia 2018-06-12 08:29:13 -04:00
rocky
94251cd294 Tolerate bytecode < 1.5 2018-05-19 11:49:42 -04:00
rocky
e5f3d803a8 Start Python 1.4 decompilation ...
Tidy up test code for issue 162 and comments for some disassembly massaging.
2018-05-19 07:14:00 -04:00
rocky
1cd2d1e915 DRY scanner code more...
Expand 2.6 testing
2018-04-03 10:35:02 -04:00
rocky
fad43feb3d DRY instruction building code...
There is a little more that could be done with  self.offset2inst_index
2018-04-03 04:41:36 -04:00
rocky
f18ce71e91 Replace all_instrs with inst_matches...
which works on 3.6+. Still should write a pytest for this.
2018-03-29 21:23:26 -04:00
rocky
8d503682b3 Use get_inst and self.insts more..
needed more in 3.6 to handle EXTENDED_ARGS before JUMP_xxx
2018-03-02 07:15:23 -05:00
rocky
c43c9a19aa Move to GPL3 license 2018-02-27 06:40:36 -05:00
rocky
b584a0f6b0 More EXTENDED_ARGS woes on 3.6+ 2018-02-25 22:42:18 -05:00
rocky
2f6a85d538 Merge branch 'master' into extended_args 2018-02-25 19:19:32 -05:00
rocky
8c0f256b78 Sync python2 and python3 scanner/injest code more 2018-02-25 09:42:04 -05:00
rocky
c433d2d9a7 Fix extended_arg breakage from last commit 2018-01-29 21:43:15 -05:00
rocky
a8fe985ed3 Add a scanner next_offset() routine
Remove extended_arg_val() as that is now in xdis
2018-01-29 21:36:19 -05:00
rocky
ebb9f1a53f Python 2.6 compatibility 2018-01-18 01:25:38 -05:00
rocky
96ddef3920 Handle 3.5.2..3.5.2 magic...
And handle magic better overal by improved xdis use
2018-01-18 01:15:19 -05:00
rocky
15057bed1d Fix bugs in scanner.last_instr()...
And ave instruction stream self.insts like we do in Python 3 so we
can start simplifying code.
2017-12-15 20:34:34 -05:00
rocky
b6413b6e6e Skirt around control-flow problems...
Tag some of the weaknesses if we can't address them now
2017-12-07 08:55:45 -05:00
rocky
6746e5167d Add Python 3.6.3 scanner lookup 2017-11-04 11:13:55 -04:00
rocky
5df09540b5 Python 3.6-inspired instruction size cleanup
Revise and generalize for Python 3.6+ instructions vs < 3.6 instuctions.
Used more of the generalized methods in xdis and remove some (but not
all) of the magic numbers.

This is a lot of changes, but not all of the refactoring needed. Much
crap still remains. Also, there are still bugs in handling 3.6 bytecodes.
2017-10-29 11:46:28 -04:00
rocky
7b38d2f1f8 Adjust for xdis opcode JUMP_OPS. release 2.12.0 2017-09-25 20:01:31 -04:00
rocky
7844456e1e Skeletal support for Python 3.7
Largely failing though.
2017-08-31 10:12:09 -04:00
rocky
d1e02afb4b Misc cleanups...
remove code now in xdis
require at least xdis 3.5.4
PyPy tolerance in validate testing
2017-08-15 09:41:39 -04:00
rocky
f4ceb6304d Allow 3-part version string lookups, e.g 2.7.1
We allow a float here, but if passed a string like
'2.7'. or  '2.7.13', accept that in looking up
either a scanner or a parser.
2017-08-13 09:17:07 -04:00
rocky
27ab6fe2f5 Use xdis 3.5.0's opcode sets 2017-07-08 20:41:46 -04:00
rocky
af3d46b35c Use xdis' instruction offset calculation fns..
next_offset, op_size, has_argument
2017-06-24 06:43:04 -04:00
rocky
f8a40c1949 Reduce spurious "continue" statements 2017-05-07 13:15:26 -04:00
rocky
160ec0d9cc COME_FROM for 3.x POP_EXCEPT, DRY with op_name() ...
Start adding COME_FROMs for POP_EXCEPT in preparation for
getting tryelse blocks correct.

Simpler opname access functions:
  - self.op_name(op) is self.opc.opname[op]
  - self.op_name_from_offset(offset) is self.opc.opname[self.code[offset]]

verify.py: not all offsets are ints
2017-03-01 05:50:31 -05:00
rocky
3f40c16587 Fix 3.5, 3.6 while true if/break bug 2017-01-08 15:54:49 -05:00
rocky
7755563b65 Some Python 3.6 bytecode->wordcode fixes 2016-12-15 02:54:25 -05:00
rocky
d22931cb49 Get ready for release 2.9.7
Some of the many lint things. Linting is kind of stupid though.
2016-12-04 09:36:30 -05:00
rocky
7daec3352c Start to attack Python 3.1 def() -> xx construct
Start to localize make_function routines by Python version
2016-10-26 08:20:19 -04:00
rocky
d6f7ef4e17 DRY op_size
Move from scanner{2,3}.py to scanner.py
2016-10-21 07:40:35 -04:00
rocky
8b240a80e7 Get ready for release 2.9.0 ...
- Use xdis 3.0.0 protocol load_module. Needs bump in requirements.txt
  and _pkg_info_.py
- Start Python 1.5 decompiling - another round of work is needed to remove
  bugs
- small cleanups
2016-10-10 09:33:49 -04:00
rocky
056f600da1 Start Python 2.1 bytecode decompile 2016-10-07 22:42:30 -04:00
rocky
c7788e4545 disassemble -> ingest where appropriate
As part of tokenization for (de)parsing, we need to do something like a
disassembly, but is is really a little different.

Disassembly, strictly speaking, is done by the xdis module now.
What "ingestion" does is massage the instruction tokens to a form that is
more amenable for parsing.

In sum, ingestion is different than disassembly, although disassembly is
generally the first part of ingestion.
2016-09-04 11:43:02 -04:00
rocky
ddc5460030 Start to handle Python 3.1 bytecode 2016-08-26 20:50:08 -04:00
rocky
d8598f61e4 Start handling Python 2.2 bytecode and...
Fix some bugs in Python 2.3-2.5 bytecode handling
2016-08-13 07:16:50 -04:00
rocky
65a16327ce Moagstar's 3.6 wordcode + formattedValue rules 2016-08-01 03:16:26 -04:00
rocky
3a6f9d8f24 Fix 3.5 misclassifying RETURN_VALUE
We use location of SETUP_EXCEPT instructions to disambiguate.
2016-07-29 08:56:23 -04:00
rocky
f33f425692 Add is_pypy parameter to places that need it 2016-07-27 16:08:40 -04:00
rocky
1c50e34c30 PyPy support
* Use proper PYPY 32 opcodes
* handle opcodes LOOKUP_METHOD and CALL_METHOD
* Administrative stuff for PyPy
2016-07-24 18:54:51 -04:00
rocky
21683719e1 Start supporting PyPy 3.2
Add some PyPy 2.7 and PyPy 3.2 bytecode files
2016-07-24 04:17:54 -04:00
rocky
7c4316d4fb Start handling pypy 2.7
Need to understand whether we care compiling pypy.
Pypy 2.7 list comprehensions are different and use
its own opcode.
2016-07-21 02:58:50 -04:00
rocky
9c2f48ca4a DRY and clean up code a little 2016-07-10 08:39:50 -04:00
rocky
ac45e5757c Redo Python 2.3 to be more like the rest 2016-07-09 09:11:04 -04:00
rocky
d6b35d57e4 DRY scanner code. Allow 2.4 decompile from 3.x 2016-07-08 21:37:09 -04:00
rocky
62e60817f6 Start handling Pyton 2.4 bytecodes 2016-07-08 15:00:23 -04:00
rocky
1a83c849dc Python 3 needs Python2's RETURN_END_IF
Make python2 and python3 scanner look more the same
2016-06-20 22:12:29 -04:00
rocky
bdd8a9f2a0 Can't handle python 2.3 on 3.x for now 2016-06-03 10:55:13 -04:00