Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support disassembling bytes from memoryview #1758

Closed
wants to merge 76 commits into from

Conversation

huettenhain
Copy link
Contributor

Hey there! I am not sure about the rules for contributing, please let me know if this should go to a different branch. I am working on a project where I want to create a lot of memoryview slices and pass them to the disassembler; slicing bytearrays is always an O(n) copy, while slicing the memoryviews is O(1). This simple adjustment for the type check adds support for that.

catenacyber and others added 30 commits February 15, 2019 22:36
* Avoids overflow in getRegisterName for TMS320C64x

* Revert "Avoids overflow in getRegisterName for TMS320C64x"

This reverts commit 18acee6.

* Checks register in DecodeMemOperandSc
For the peace and tranquility of the earth.
* Fix typos

* make test_mos65xx.py and test_mos65xx.c have same output format

* mox65xx -> mos65xx
* respect libsuffix in pkgconfig

discovered in https://bugs.gentoo.org/677946

* Update CMakeLists.txt

* Update CMakeLists.txt

* Update CMakeLists.txt
* add xenial tests

* add cmocka remove reminder
* normalize tab character in cs

* normalize in issue mode
…engine#1423)

* AArch64: fixes register access flags for loads

* AArch64: fixes register access flags for ORR

* AArch64: fixes register access flags for stores
Signed-off-by: Sebastian Macke <sebastian@macke.de>
Pass bytearrays by reference instead of copying to bytes.
…default (capstone-engine#1463)

* Add cmake option to disable architectures by default

* Add cmake option to disable architectures by default

* Remove CAPSTONE_X86_ONLY cmake variable, and update build scripts to use the CAPSTONE_ARCHITECUTRE_DEFAULT option, which can be used with any architecture.

* Updated cmake and nmake files to replace cmake-x86 and nmake-x86

* Simplified cmake wrapper scripts

* Updated cmake build instructions

* Tab to space in doc
* Fix user data alignment in MEMBLOCK

Kernel memory allocations on Windows should be aligned on MEMORY_ALLOCATION_ALIGNMENT (16 bytes on x64 and 8 bytes on x86).

* Fix user data alignment in CS_WINKERNEL_MEMBLOCK
Leo Neat and others added 25 commits February 24, 2020 10:20
Apple Clang 11.0.0 error:
```
capstone/include/capstone/m68k.h:160:3: error: anonymous types declared in an anonymous union are an extension [-Werror,-Wnested-anon-types]
                struct {                    ///< register pair in one operand
                ^
```
Co-authored-by: Romain Lesteven <romain.lesteven@armaturetech.com>
* 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
$(PYTHON2) and/or $(PYTHON3) might differ from python and/or python3,
accordingly. Allow to override these variables by user choice.
…1659)

On x86_64-linux gentoo system capstone was installing
it's files to 'lib64' libdir, but was referring 'lib' libdir:

```
$ cat /usr/lib64/pkgconfig/capstone.pc
...
libdir=${prefix}/lib
...
```

On radare2 built it means injecting -L/usr/lib into a 64-build
and pulling in 32-bit libraries. 'ld.lld' is not able to resolve
the ambiguity.

It happens because @LIBSUFFIX@ is not present in cmake-3.17.3.

Let's fix the paths by using @CMAKE_INSTALL_LIBDIR@.
This variable is already used in capstone's build system,
thus should be safe to rely on.

Reported-by: Agostino Sarubbo
Bug: https://bugs.gentoo.org/730722
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
instructions could be 2, 4 or 6 bytes so pad accordingly as it
was done on the other CISC architecture.
if integer is 32-bit, and numeric literals default to int type,
the following applies (from The C Standard, 6.5.7, paragraph 4
[ISO/IEC 9899:2011]):

If E1 has a signed type and nonnegative value, and E1 × 2^E2 is
representable in the result type, then that is the resulting value;
otherwise, the behavior is undefined.

which means that the only way to safely shift is unsigned, so
use 1U to indicate the shifted bit is unsigned.
Co-authored-by: meme <meme@users.noreply.github.com>
Otherwise python setup.py install from bindings/python
will fail with
SyntaxError: Non-ASCII character '\xe2' in file setup.py on line 223,
but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
Co-authored-by: Michal Schulz <michal@Michals-iMac-Pro.local>
Co-authored-by: Raffaele Meyer <Raffaele Meyer>
* Update solution, remove non-existent test_basic

* Add property sheet to set platform toolset correctly

* use property sheet in all projects

* cast explicitly to avoid warnings

* make property sheet optional

* Conflcting options "Edit and continue" and "optref" caused warnings

Co-authored-by: Hauke Mönck <>
Signed-off-by: Tomasz 'CeDeROM' CEDRO <tomek@cedro.info>
With FreeBSD, OpenBSD, NetBSD verified we can simply use "bsd".

Signed-off-by: Tomasz 'CeDeROM' CEDRO <tomek@cedro.info>
@aquynh
Copy link
Collaborator

aquynh commented Jun 30, 2021

can you pull req to the next branch?

@huettenhain huettenhain changed the base branch from master to next July 5, 2021 19:12
@huettenhain
Copy link
Contributor Author

Looks like I have to close this so I can open a new PR from my own next branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet