Commit graph

685 commits

Author SHA1 Message Date
kabeor
0d4881ef14 add ci_test steps&&Fixed suite test for python3 2021-11-23 12:27:39 +08:00
jesko
25d898f9f5 adds test and bugfix for memoryview support 2021-11-13 11:32:18 +01:00
jesko
684187a27f invoke from_buffer only for writeable interfaces 2021-11-13 00:16:19 +01:00
jesko
d59c50f623 support disassembling bytes from memoryview 2021-07-05 22:40:07 +02:00
Mark Jansen
1703efd038
Always return the same type from regs_read (#1736) 2021-03-20 07:32:23 +08:00
Nguyen Anh Quynh
786a6b384f bindings: update Arm64 register enum 2020-11-25 16:18:50 +08:00
Tobias Faller
2f38802e0e
Added export for Python CS_MODE_RISCVC binding (#1691) 2020-09-18 22:34:35 +08:00
Nikita
34e5b16e18 Allow to override PYTHON[23] in Makefiles (#1639)
$(PYTHON2) and/or $(PYTHON3) might differ from python and/or python3,
accordingly. Allow to override these variables by user choice.
2020-05-30 10:51:54 +08:00
Disconnect3d
f34c3965ee Add __repr__ for capstone.CsInsn (#1625)
* Add __repr__ for capstone.CsInsn

Currently, a `print(instruction)` displays a not very useful string like `<capstone.CsInsn object at 0x7f3759d88128>`.

This PR enhances adds a `__repr__` magic method to the `capstone.CsInsn` class so it displays as follows:
```
<cs.CsInsn: address=0x5555555545fa, size=1, mnemonic=push, op_str=rbp>
```

* Update __init__.py
2020-05-05 01:54:28 +08:00
Nguyen Anh Quynh
74136cab65 python: classifier Python3 for setup.py 2020-01-26 13:26:58 +08:00
naq
5809774f62 bindings: update after the last header fix 2019-10-08 10:42:47 +08:00
ksherlock
05b3fbf2d7 updated 6502 support. (#1498)
* updated 6502 support. some improvements to the base 6502 support but also adds support for 65c02, w65c02, and 65816.

* add CS_OPT_SYNTAX_MOTOROLA.

This will use "$" as a hex prefix instead of "0x"

* remove excess blank lines
2019-06-03 23:20:51 +08:00
Nguyen Anh Quynh
b41a66f921 python: add PPC modes CS_MODE_SPE & CS_MODE_BOOKE 2019-05-08 14:03:10 +08:00
Nguyen Anh Quynh
11206deb78 ppc: sync with llvm 7.0.1 2019-04-30 13:50:42 +08:00
Nguyen Anh Quynh
25b6704978 merge next-arm64 to next 2019-04-10 17:46:07 +08:00
Nguyen Anh Quynh
9d292268a9 arm64: sync with LLVM 7.0.1 2019-04-10 14:17:08 +08:00
ChrisDenton
e07c1dd116 Update __init__.py (#1453)
Pass bytearrays by reference instead of copying to bytes.
2019-04-03 11:41:32 +08:00
Wolfgang Schwotzer
5607c03df9 M680X: Use same output style as other archs (#1439)
- Lowercase hex numbers.
- Use comma + space between instruction parameters.
2019-03-22 11:07:15 +08:00
Nguyen Anh Quynh
ba2c6a24da bindings: update ARM const after the last ARM update 2019-03-16 15:22:45 +08:00
z
a012f75754 RISCV support ISRV32/ISRV64 (#1401)
* Added RISCV dir to contain the RISCV architecture engine code. Adding the TableGen files generated from llvm-tblgen. Add Disassembler.h

* Started working on RISCVDisassembler.c - RISCV_init(), RISCVDisassembler_getInstruction, and RISCV_getInstruction

* Added all functions to RISCVDisassembler.c and needed modifications to RISCVGenDisassemblerTables.inc. Add and modified RISCVGenSubtargetInfo.inc. Start creation of RISCVInstPrinter.h

* Finished RISCVGenAsmWriter.inc. Finished RISCVGenRegisterInfo.inc. Minor fixes to RISCVDisassembler.c. Working on RISCVInstPrinter

* Finished RISCVInstPrinter, RISCVMapping, RISCVBaseInfo, RISCVGenInstrInfo.inc, RISCVModule.c. Working on riscv.h

* Backport it from: 0db412ce3b

* All RISCV files added. Compiled correctly and initial test for ADD, ADDI, AND works properly.

* Add refactored cs.c for RISCV

* Testing all I instructions in test_riscv.c

* Modify the orignal backport for RISCVGenRegisterInfo.inc, capstone.h and test_iter to work w/ the current code strcuture

* Fix issue with RISCVGenRegisterInfo.inc - RISCVRegDesc[] (Excess elements in struct initializer). Added RISCV tests to test_iter.c

* fixed bug related to incorrect initialization of memory after malloc

* fix compile bug

* Fix compile errors.

* move riscv.h to include/capstone

* fix indentation issues

* fix coding style issues

* Fix indentation issues

* fix coding style

* Move variable declaration to the top of the block

* Fix coding indentation

* Move some stuff into RISCVMappingInsn.inc

* Fix code sytle

* remove cs_mode support for RISCV

* update asmwriter-inc to LLVM upstream

* update the .inc files to riscv upstream

* update riscv disassembler function for suport 16bit instructions

* update printer & tablegen inc files which have fixed arguments mismatch

* update headers and mapping source

* add riscv architecture specific test code

* fix all RISCV tons of compiler errors

* pass final tests

* add riscv tablegen patchs

* merge with upstream/next

* fix cstool missing riscv file

* fix root Makefile

* add new TableGen patchs for riscv

* fix cmakefile.txt of missing one riscv file

* fix declaration conflict

* fix incompatible declaration type

* change riscvc from arch to mode

* fix test_riscv warnning

* fix code style and add riscv part of test_basic

* add RISCV64 mode

* add suite for riscv

* crack fuzz test

* fix getfeaturebits test add riscvc

* fix test missing const qualifier warnning

* fix testcase type mismatch

* fix return value missing

* change getfeaturebits test

* add test cs files

* using a winder type contain the decode string

* fix a copy typo

* remove useless mode for riscv

* change cs file blank type

* add repo for update_riscv & fix cstool missing riscv mode

* fix typo

* add riscv for cstool useage

* add TableGen patch for riscv asmwriter

* clean ctags file

* remove black comment line

* fix fuzz related something

* fix missing RISCV string of fuzz

* update readme, etc..

* add riscv *.s.cs file

* add riscv *.s.cs file & clear ctags

* clear useless array declarations at capstone_test

* update to 5e4069f

* update readme change name more formal

* change position of riscv after bpf and modify copyright more uniform

* clear useless ctags file

* change blank with tab in riscv.h

* add riscv python bindings

* add riscv in __init__.py

* fix riscv define value for python binding

* fix test_riscv.py typo

* add missing riscvc in __init__.py of python bindings

* fix alias-insn printer bug, remove useless newline

* change inst print delimter from tab to bankspace for travis

* add riscv tablegen patch

* fix inst output more consistency

* add TableGen patch which fix inst output formal

* crack the effective address output for detail and change register print function

* fix not detail crash bug

* change item declaration position at cs_riscv

* update riscv.py

* change function name more meaningfull

* update python binding makefile

* fix register enum sequence according to riscvgenreginfo.inc

* test function name

* add enum s0/fp in riscv.h & update riscv_const.py

* add register name enum
2019-03-09 08:41:12 +08:00
Nguyen Anh Quynh
d250f0671d bingdings: update X86 consts 2019-03-02 14:59:16 +08:00
Nguyen Anh Quynh
98cfc57873 Merge branch 'next' of github.com:aquynh/capstone into next 2019-03-01 01:12:50 +08:00
Sebastian Macke
fa4353d7db MOS65XX: Fix instruction length for indirect addressing modes (#1402)
Signed-off-by: Sebastian Macke <sebastian@macke.de>
2019-02-28 07:39:59 +08:00
Nguyen Anh Quynh
7aef24f63a bindings: update X86 consts 2019-02-27 23:04:14 +08:00
david942j
29e9b61ae2 fix conflicts 2019-02-18 20:04:30 +08:00
david942j
cac94ccee5 New architecture: BPF (#1388)
* Basic changes of new arch - BPF

* Define some constants

* defined some API methods

* Able to print MISC instruction

* Follow Linux coding style

* Ability to show ALU insn names

* decode return

* Add suite/MC/BPF

* decode jump

* decode store

* decode load

* print instruction done

* try to implement BPF_reg_access

* Implements explicit accessed registers and fix some tiny bugs

* Fix unhandled ja case

* Added BPF_REG_OFF do fix wrong display in jump class

* Great I'm able to decode cBPF with eyes

* Fix: misunderstood the 16-byte instruction's imm

* Add ldxdw

* Add extended-all.cs

* Implements cstest/bpf_getdetail.c

* Fix memory leak

* Add BPF to fuzz

* Implemented regs_read and regs_write

* Fix missing write-access on ALU's dst

* Updated cstool/, test_basic.c, test_detail.c, and test_iter.c

* Updated docs

* Fix type of cs_bpf#operands

* Implements python bindings

* Fix some bugs found by self code review

* Remove dummy tests

* remove typeof

* Address comments

* Fix MSVC's warnings and add test_bpf.py to bindings/python/Makefile

* Fix: call is not offset
2019-02-18 17:39:51 +08:00
Nguyen Anh Quynh
5021789b8f python: add test_evm.py to Makefile check target 2019-02-18 10:46:57 +08:00
Nguyen Anh Quynh
ba12645cdc python: make test_evm.py to output like test_evm.c 2019-02-17 23:19:56 +08:00
Семён Марьясин
64880d2493 Fix skipdata struct being destroyed (#1385) 2019-02-17 01:32:12 +08:00
Invincible
534194f3fc For the benefit of mankind. (#1386)
For the peace and tranquility of the earth.
2019-02-17 01:32:08 +08:00
Nguyen Anh Quynh
a3b5385aef wasm: add wasm to bindings/const_generator.py 2019-02-02 18:33:12 +08:00
Spike
4ae8645b43 Add webassembly arch (#1359)
* add wasm arch

* fix bug

* delete todo & add wasm into readme
2019-02-01 23:03:47 +08:00
Erik Hemming
cc2965bada Fix a couple of corner-cases with rarely used m68k instructions. (#1344)
* Bump the "cs_insn.bytes[]" size to 24 (from 16) to support M680x0 instructions with full EA (maximum 11 words)
Added a test for this in test_m68k.s

* Bump the "cs_detail.regs_read[]" size to 16 (from 12) to support M680x0 instructions with full REG_BITS (Dn+An = 16)

* m68k: use immediate mode syntax (#$0) for movem/fmovem instructions with empty register list

* update bindings to match changes to cs_insn and cs_detail
2019-01-21 17:42:01 +08:00
Benno Fünfstück
6800af85c1 bindings/python: fix install error due to old libname (#1338) 2019-01-11 00:10:25 +08:00
Nguyen Anh Quynh
7ede48cd90 python: temporarily comment out skipdata setup, which is still broken on MacOS. #1316 2019-01-02 10:11:48 +08:00
Nguyen Anh Quynh
90b90f9491 Merge branch 'master' into next 2019-01-02 10:01:28 +08:00
Nguyen Anh Quynh
472bd43fcf python: rename getter/setter skipdata_cb to skipdata_callback. Hello 2019 2019-01-01 00:22:45 +08:00
Nguyen Anh Quynh
a593f8d028 python: attempt to fix #1320 2018-12-31 15:51:50 +08:00
Семён Марьясин
6c54814d25 Fix skipdata setup (#1320)
* Fix skipdata_setup for when _cb is None

ctypes prototype does not accept None value,
so if we want to get a NULL function pointer
then we should either call it with no arguments
or pass zero as an argument.

Fixes #1316

* Do store and return skipdata_setup data

* Add convenience wrappers for skipdata_setup

* Uncomment skipdata_setup tests

* Add alternate usage variants to test_skipdata.py

* document getter
2018-12-31 15:42:44 +08:00
mephi42
d9b8079aba Update SystemZ to LLVM commit 5ad902a6 (#1306) 2018-12-16 21:48:51 +08:00
Nguyen Anh Quynh
5c634289b4 bump version to 4.1 2018-12-16 20:18:20 +08:00
Sebastian Macke
8663d75c56 MOS65XX: Add binding for python
Signed-off-by: Sebastian Macke <sebastian@macke.de>
2018-12-06 22:53:43 +01:00
Hugo
fbeffa489c Add python_requires and update Trove classifiers (#1251) 2018-10-02 17:45:45 +08:00
Nguyen Anh Quynh
2b4aec9c76 bindings: make bindings/const_generator.py compatible with recent reformat of C headers 2018-10-01 20:29:39 +08:00
Nguyen Anh Quynh
a732cb0ca1 bindings: update PPC constants 2018-09-17 21:01:01 +08:00
xambroz
5c168e515d introduce PYTHON2 and PYTHON3 variables in the makefiles (#1236)
This change makes it possible to be explicit during the build time
on what python version/binary use to compile.
2018-08-29 12:26:53 +08:00
Nguyen Anh Quynh
afffa5d741 merge next to master 2018-07-20 12:36:50 +08:00
Nguyen Anh Quynh
49950e4672 python: raise CsError(CS_ERR_SKIPDATA) when accessing irrelevant data in skipdata mode. this fixes issue #679 2018-07-18 13:43:32 +08:00
Nguyen Anh Quynh
d553dbf3eb python: raise CsError(CS_ERR_SKIPDATA) when accessing irrelevant data in skipdata mode. this fixes issue #679 2018-07-18 13:37:45 +08:00
Stephen Eckels
dce7da98f8 Merges encoding to next (#1194)
* merge encoding branch into next branch

* added python bindings and updated test to support encoding

* fix python import

* fix py binding fields

* fix disp size printing

* fixed py binding, again

* Update CREDITS.TXT

* fixed formatting and a cast

* Changed param from int to uint8_t, fixed warnings
2018-07-04 22:47:55 +08:00