https://github.com/simonlindholm/asm-differ
Assembly diff script
https://github.com/simonlindholm/asm-differ
Last synced: 10 months ago
JSON representation
Assembly diff script
- Host: GitHub
- URL: https://github.com/simonlindholm/asm-differ
- Owner: simonlindholm
- License: unlicense
- Created: 2019-04-28T23:14:07.000Z (almost 7 years ago)
- Default Branch: main
- Last Pushed: 2025-03-24T19:55:23.000Z (12 months ago)
- Last Synced: 2025-05-12T11:52:20.209Z (10 months ago)
- Language: Python
- Homepage:
- Size: 633 KB
- Stars: 118
- Watchers: 10
- Forks: 53
- Open Issues: 32
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-n64-development - asm-differ - A `diff` script for MIPS assembly (Reverse Engineering / Tools and Disassemblers)
README
# asm-differ
Nice differ for assembly code. Currently supports MIPS, PPC, AArch64, ARM32, SH2, SH4, and m68k; should be easy to hack to support other instruction sets.

## Dependencies
- Python >= 3.6
- `python3 -m pip install --user colorama watchdog levenshtein cxxfilt` (also `dataclasses` if on 3.6)
## Usage
Create a file `diff_settings.py` in some directory (see the one in this repo for an example). Then from that directory, run
```bash
/path/to/diff.py [flags] (function|rom addr)
```
Recommended flags are `-mwo` (automatically run `make` on source file changes, and include symbols in diff). See `--help` for more details.
### Tab completion
[argcomplete](https://kislyuk.github.io/argcomplete/) can be optionally installed (with `python3 -m pip install argcomplete`) to enable tab completion in a bash shell, completing options and symbol names using the linker map. It also requires a bit more setup:
If invoking the script **exactly** as `./diff.py`, the following should be added to the `.bashrc` according to argcomplete's instructions:
```bash
eval "$(register-python-argcomplete ./diff.py)"
```
If that doesn't work, run `register-python-argcomplete ./diff.py` in your terminal and copy the output to `.bashrc`.
If setup correctly (don't forget to restart the shell), `complete | grep ./diff.py` should output:
```bash
complete -o bashdefault -o default -o nospace -F _python_argcomplete ./diff.py
```
Note for developers or for general troubleshooting: run `export _ARC_DEBUG=` to enable debug output during tab-completion, it may show otherwise silenced errors. Use `unset _ARC_DEBUG` or restart the terminal to disable.
### Contributing
Contributions are very welcome! Some notes on workflow:
`black` is used for code formatting. You can either run `black diff.py` manually, or set up a pre-commit hook:
```bash
pip install pre-commit black
pre-commit install
```
Type annotations are used for all Python code. `mypy` should pass without any errors. (This is all checked in CI.)
There are a handful of unit tests (test.py), however a comparison-based regression test suite is still missing.
There are loose plans on adding one using scratches from decomp.me as a corpus. Help on this front appreciated!
The targeted Python version is 3.7.