Skip to content

Commit

Permalink
Merge branch 'capstone-engine:next' into next-update
Browse files Browse the repository at this point in the history
  • Loading branch information
FinnWilkinson authored May 13, 2024
2 parents 743a2a4 + 2ef45f2 commit 937175b
Show file tree
Hide file tree
Showing 390 changed files with 11,886 additions and 1,109 deletions.
58 changes: 58 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report_asm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
name: Bug report - Incorrect disassembly
about: Create a report about incorrect disassembly.
---

<!-- This template is meant for disassembly related bug reports, please be as descriptive as possible -->

### Work environment

<!-- Filling this table is mandatory -->

| Questions | Answers
|------------------------------------------|--------------------
| OS/arch/bits | Debian arm 64, MacOS AArch64, MacOS x86, Windows x86 etc.
| Architecture | ppc, x86, cortexm, armv8 etc.
| Source of Capstone | `git clone`, brew, pip, release binaries etc.
| Version/git commit | v5.0.1, <commit hash>

<!-- INCORRECT DISASSEMBLY BUGS -->

### Instruction bytes giving faulty results

```
0x00,0x00,0x00,0x00
```

### Expected results

It should be:
```
<this or that>
```

### Steps to get the wrong result

With `cstool`:

```sh
cstool arm -d 0x00,0x00,0x00,0x00
```

or with `Python`

```python
CODE = b'\x90\x90\x90\x90'

md = Cs(CS_ARCH_ARM, CS_MODE_THUMB)
md.detail = True
for insn in md.disasm(CODE, 0x1000):
# Print the faulty disassembly
```

<!-- ADDITIONAL CONTEXT -->

### Additional Logs, screenshots, source code, configuration dump, ...

Drag and drop zip archives containing the Additional info here, don't use external services or link.
Screenshots can be directly dropped here.
40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report_general.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: Bug report - Other bugs
about: Create a report to help us improve

---

<!-- This template is meant for GENERAL bug reports.
For bugs regarding incorrect disassembly,
please use the "Bug report - Incorrect disassembly" template.
Please be as descriptive as possible
-->

### Work environment

<!-- Filling this table is mandatory -->

| Questions | Answers
|------------------------------------------|--------------------
| OS/arch/bits | Debian arm 64, MacOS AArch64, MacOS x86, Windows x86 etc.
| Architecture | ppc, x86, cortexm, armv8 etc.
| Source of Capstone | `git clone`, brew, pip, release binaries etc.
| Version/git commit | v5.0.1, <commit hash>

<!-- OTHER BUGS -->

### Expected behavior

### Actual behavior

### Steps to reproduce the behavior

- Use code markdown `CODE` to make your code visible

<!-- ADDITIONAL CONTEXT -->

### Additional Logs, screenshots, source code, configuration dump, ...

Drag and drop zip archives containing the Additional info here, don't use external services or link.
Screenshots can be directly dropped here.
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Feature request
about: Suggest an idea for this project

---

### Feature

- [ ] New architecture module
- [ ] Support for processor extension
- [ ] Add more instruction details (elaborated below)
- [ ] Binding support for: `language`
- [ ] Other (elaborated below)

**Describe the feature you'd like**
A clear and concise description of what you want to happen.

**Additional context**
Add any other context about the feature request here.
23 changes: 23 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!-- Filling this template is mandatory -->

**Your checklist for this pull request**
- [ ] I've documented or updated the documentation of every API function and struct this PR changes.
- [ ] I've added tests that prove my fix is effective or that my feature works (if possible)

**Detailed description**

<!-- Explain the **details** for making this change. Is a new feature implemented? What existing problem does the pull request solve? How does the pull request solve these issues? Please provide enough information so that others can review your pull request. -->

...

**Test plan**

<!-- What steps should the reviewer take to test your pull request? Demonstrate the code is solid. Or what test cases you added. Disassembly tests should be added in suite/cs_test/issues.cs -->

...

**Closing issues**

<!-- put "closes #XXXX" in your comment to auto-close the issue that your PR fixes (if any). -->

...
7 changes: 7 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ EVM:
- include/capstone/evm.h
- tests/test_evm.c

HPPA:
- arch/HPPA/*
- cstool/cstool_hppa.c
- include/capstone/hppa.h
- suite/MC/HPPA/*
- tests/test_hppa.c

M680X:
- arch/M680X/*
- cstool/cstool_m680x.c
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/auto-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Auto-Sync
on:
push:
paths:
- "suite/auto-sync/**"
pull_request:

jobs:
check:
runs-on: ubuntu-latest
defaults:
run:
working-directory: suite/auto-sync/
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Check out repository
uses: actions/checkout@v4
with:
submodules: true

- name: Install auto-sync package
run: |
pip install .
- name: Check formatting
run: |
python3.11 -m black --check src/autosync
- name: Build llvm-tblgen
run: |
git clone https://github.com/capstone-engine/llvm-capstone.git vendor/llvm_root
cd vendor/llvm_root
mkdir build
cd build
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug ../llvm
cmake --build . --target llvm-tblgen --config Debug
cd ../../../
- name: Test generation of inc files
run: |
./src/autosync/ASUpdater.py -d -a AArch64 -s IncGen
./src/autosync/ASUpdater.py -d -a Alpha -s IncGen
./src/autosync/ASUpdater.py -d -a ARM -s IncGen
./src/autosync/ASUpdater.py -d -a PPC -s IncGen
- name: CppTranslator - Patch tests
run: |
python -m unittest src/autosync/cpptranslator/Tests/test_patches.py
- name: CppTranslator - Differ tests
run: |
python -m unittest src/autosync/cpptranslator/Tests/test_differ.py
- name: CppTranslator - Test translation
run: |
./src/autosync/ASUpdater.py --ci -d -a AArch64 -s Translate
./src/autosync/ASUpdater.py --ci -d -a ARM -s Translate
./src/autosync/ASUpdater.py --ci -d -a PPC -s Translate
- name: Test Header patcher
run: |
python -m unittest src/autosync/Tests/test_header_patcher.py
34 changes: 34 additions & 0 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Run clang-tidy
on:
push:
paths:
- '**.c'
- '**.h'
pull_request:

jobs:
analyze:
runs-on: ubuntu-latest

name: clang-tidy
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install clang-tidy
run: |
sudo apt install clang-tidy
- name: Build
run: |
mkdir build && cd build
CC=clang cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBUILD_SHARED_LIBS=1 ..
CC=clang sudo cmake --build . --config Release
cd ..
- name: Check for warnings
env:
base_sha: ${{ github.event.pull_request.base.sha }}
head_sha: ${{ github.event.pull_request.head.sha }}
run: |
./run-clang-tidy.sh build
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ tests/test_bpf
tests/test_sh
tests/test_riscv
tests/test_sh
tests/test_alpha
tests/test_hppa

# regress binaries
suite/regress/invalid_read_in_print_operand
Expand Down Expand Up @@ -129,7 +131,7 @@ fuzz_bindisasm
fuzz_disasm
fuzz_decode_platform
capstone_get_setup
suite/fuzz/
suite/fuzz/corpus
suite/cstest/cmocka/

*.s
Expand All @@ -141,3 +143,6 @@ android-ndk-*

# python virtual env
.venv/

# Auto-sync files
suite/auto-sync/src/autosync.egg-info
20 changes: 20 additions & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: CapstoneEngine
Source: https://github.com/capstone-engine/capstone

Files: src/autosync/cpptranslator/Tests/test_config.json
Copyright: 2022 Rot127 <[email protected]>
License: BSD-3

Files: src/autosync/cpptranslator/arch_config.json
Copyright: 2022 Rot127 <[email protected]>
License: BSD-3

Files: src/autosync/cpptranslator/saved_patches.json
Copyright: 2022 Rot127 <[email protected]>
License: BSD-3

Files: src/autosync/path_vars.json
Copyright: 2022 Rot127 <[email protected]>
License: BSD-3

9 changes: 9 additions & 0 deletions .reuse/templates/license-template.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% for copyright_line in copyright_lines %}
{{ copyright_line }}
{% endfor %}
{% for contributor_line in contributor_lines %}
SPDX-FileContributor: {{ contributor_line }}
{% endfor %}
{% for expression in spdx_expressions %}
SPDX-License-Identifier: {{ expression }}
{% endfor %}
Loading

0 comments on commit 937175b

Please sign in to comment.