1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-05 01:06:37 +00:00
oot/tools/asm-differ
Dragorn421 17f08788aa
subrepo and update asm-differ (#1664)
* git subrepo clone git@github.com:simonlindholm/asm-differ.git tools/asm-differ

subrepo:
  subdir:   "tools/asm-differ"
  merged:   "11eee5916"
upstream:
  origin:   "git@github.com:simonlindholm/asm-differ.git"
  branch:   "main"
  commit:   "11eee5916"
git-subrepo:
  version:  "0.4.6"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "110b9eb"

* ln -s ./tools/asm-differ/diff.py diff.py
2024-01-30 15:25:15 -05:00
..
.github/workflows subrepo and update asm-differ (#1664) 2024-01-30 15:25:15 -05:00
.gitignore subrepo and update asm-differ (#1664) 2024-01-30 15:25:15 -05:00
.gitrepo subrepo and update asm-differ (#1664) 2024-01-30 15:25:15 -05:00
.pre-commit-config.yaml subrepo and update asm-differ (#1664) 2024-01-30 15:25:15 -05:00
diff-stylesheet.css subrepo and update asm-differ (#1664) 2024-01-30 15:25:15 -05:00
diff.py subrepo and update asm-differ (#1664) 2024-01-30 15:25:15 -05:00
diff_settings.py subrepo and update asm-differ (#1664) 2024-01-30 15:25:15 -05:00
LICENSE subrepo and update asm-differ (#1664) 2024-01-30 15:25:15 -05:00
mypy.ini subrepo and update asm-differ (#1664) 2024-01-30 15:25:15 -05:00
poetry.lock subrepo and update asm-differ (#1664) 2024-01-30 15:25:15 -05:00
pyproject.toml subrepo and update asm-differ (#1664) 2024-01-30 15:25:15 -05:00
README.md subrepo and update asm-differ (#1664) 2024-01-30 15:25:15 -05:00
screenshot.png subrepo and update asm-differ (#1664) 2024-01-30 15:25:15 -05:00
test.py subrepo and update asm-differ (#1664) 2024-01-30 15:25:15 -05:00

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

/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 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:

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:

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:

pip install pre-commit black
pre-commit install

Type annotations are used for all Python code. mypy should pass without any errors.

PRs that skip the above are still welcome, however.

The targeted Python version is 3.6. There are currently no tests.