diff --git a/Contributing.md b/Contributing.md index 20f32e90..17729f69 100644 --- a/Contributing.md +++ b/Contributing.md @@ -154,7 +154,7 @@ public: * Be sure to change the status column from `U` (undecompiled) to `O` (OK). * Example: `0x00000071010c0d60,O,136,_ZN4ksys4util13TaskQueueBaseD1Ev` -7. **Compare the assembly** with `./diff.py --source ` +7. **Compare the assembly** with `botw-check --source ` * This will bring up a two-column diff. The code on the left is the original code; the code on the right is your version of the function. * You may ignore address differences (which often show up in adrp+ldr pairs or bl or b). @@ -170,7 +170,7 @@ public: * If there are still minor differences left, wrap the function in an `#ifdef NON_MATCHING`, add a comment to explain what is wrong, and change the status to `m` (minor difference) in the CSV. * For major differences (lots of entirely red/green/blue lines in the diff), use a capital `M` (major difference) in place of `m`. -10. Before opening a PR, reformat the code with clang-format and run `tools/check.py`. +10. Before opening a PR, reformat the code with clang-format and run `botw-check`. ## Non-inlined functions @@ -199,8 +199,8 @@ This project sometimes uses small hacks to force particular code to be generated ## Project tools -* Check all decompiled functions for issues: `tools/check.py` -* To compare assembly: `./diff.py ` +* Check all decompiled functions for issues: `botw-check` +* To compare assembly: `botw-check ` * The function **must be listed in data/uking_functions.csv first**. * To do so, search for the name or the address of function you have decompiled, and add the mangled function name to the last column. * Pass the `--source` flag to show source code interleaved with assembly code. diff --git a/tools/diff.py b/tools/diff.py deleted file mode 100755 index 666fccd1..00000000 --- a/tools/diff.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env python3 -import argparse -import subprocess - -import cxxfilt -from colorama import Fore, Style - -from util import utils - -parser = argparse.ArgumentParser(description="Diff assembly") -parser.add_argument( - "function", help="Name of the function to diff. Pass | to get a WIP function", nargs="?", default="|") -args, unknown = parser.parse_known_args() - -find_wip = args.function == "|" - - -def find_function_info(name: str): - for info in utils.get_functions(): - if info.decomp_name == name or (find_wip and info.status == utils.FunctionStatus.Wip): - return info - - for info in utils.get_functions(): - if name in cxxfilt.demangle(info.decomp_name): - return info - - return None - - -info = find_function_info(args.function) -if info is not None: - if not info.decomp_name: - utils.fail(f"{args.function} has not been decompiled") - - print( - f"diffing: {Style.BRIGHT}{Fore.BLUE}{cxxfilt.demangle(info.decomp_name)}{Style.RESET_ALL} {Style.DIM}({info.decomp_name}){Style.RESET_ALL}") - addr_end = info.addr + info.size - subprocess.call(["tools/asm-differ/diff.py", "-I", "-e", info.decomp_name, "0x%016x" % - info.addr, "0x%016x" % addr_end] + unknown) - - if info.status == utils.FunctionStatus.NonMatching: - utils.warn( - f"{info.decomp_name} is marked as non-matching and possibly NOT functionally equivalent") - elif info.status == utils.FunctionStatus.Equivalent: - utils.warn(f"{info.decomp_name} is marked as functionally equivalent but non-matching") - -else: - if find_wip: - utils.fail("no WIP function") - - utils.fail( - f"unknown function '{args.function}'\nfor constructors and destructors, list the complete object constructor (C1) or destructor (D1)")