Commit Graph

113 Commits

Author SHA1 Message Date
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
rocky
ebcb1d08f4 Limited support for Python 2.3 2016-06-03 10:20:52 -04:00
rocky
eefbc40eef option to show asm and DRY.
Get ready for some 2.3 support
2016-06-03 09:25:20 -04:00
rocky
20768266b4 use totally xdis's opcodes
Needs xdis 1.1.0 or greater
2016-05-31 19:53:17 -04:00
rocky
e70e7bfc16 Start to DRY Python 2 scanners...
Get 2.7 opcodes from xdis.
2016-05-28 19:34:12 -04:00
rocky
b18b3e5d47 xdis for Python 3 opcodes 2016-05-28 01:14:18 -04:00
rocky
64191aa2d3 use xdis 3.4-3.5 opcodes 2016-05-28 00:58:27 -04:00
rocky
4398b5b2e0 Use xdis for code, magics, and marshal 2016-05-27 19:18:06 -04:00
rocky
a08ece371e pydisassemble improvements; DRY scannners
disas.py:
 - disassembles *all* code objects found

scanner*.py:
 - no longer need to pass in version numbers; this
   is obtained from the class name
 - no longer pass in opcodes; this is done at
   initialization from the scanner name
 - all Pythoin 3 scanners support native disassembly
2016-05-18 10:58:48 -04:00
rocky
bdd7df6040 Python 2 loop scanner detection in Python 3
scanner*.py: Make scanner27 and scanner3 more aligned
Makefile: we can run py.test on Python 3.5
HISTORY.md: grammar changes
2016-05-16 13:40:55 -04:00
rocky
fe04b97c6b Remove one more old-style Python class 2016-05-03 03:55:43 -04:00
rocky
31ebe88b38 Start to DRY opcode code. Limited support for decopyling Python 3.5 2016-01-02 22:59:02 -05:00
rocky
52da6f4a8f Make ScannerXX() initialization the same on Python 2.x and 3.x 2016-01-02 07:54:21 -05:00
rocky
b82a8b90d5 Allow Python 3.5 to decomplyle other versions. No Python 3.5
bytecode support just yet though.
2015-12-30 23:46:29 -05:00
rocky
820fdb4771 Fix up Python 2.x's ability to get code from Python 3.x's bytecode 2015-12-27 19:36:02 -05:00
rocky
44cd349cc7 DRY Python3 scanner code. Some cross version handling fixed.
Some Python 3.2 and 3.3 deparse fixes.
2015-12-27 04:43:35 -05:00
rocky
008bd79719 Fix up Python 3.2, 3.3, and 3.4 cross-version scanners
Try travis 2.6 and 3.3
2015-12-26 10:19:26 -05:00
rocky
1456f820f2 Start Python3 slices. Split off token routine. 2015-12-21 12:17:57 -05:00