- Notifications
You must be signed in to change notification settings - Fork31
A local diffing tool for decompilation projects
License
Apache-2.0, MIT licenses found
Licenses found
encounter/objdiff
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A local diffing tool for decompilation projects. Inspired bydecomp.me andasm-differ.
Features:
- Compare entire object files: functions and data.
- Built-in symbol demangling for C++. (CodeWarrior, Itanium & MSVC)
- Automatic rebuild on source file changes.
- Project integration viaconfiguration file.
- Search and filter all of a project's objects and quickly switch.
- Click to highlight all instances of values and registers.
Supports:
- ARM (GBA, DS, 3DS)
- ARM64 (Switch)
- MIPS (N64, PS1, PS2, PSP)
- PowerPC (GameCube, Wii, Xbox 360)
- SuperH (Saturn, Dreamcast)
- x86, x86_64 (PC)
SeeUsage for more information.
To build from source, seeBuilding.
For Linux and macOS, runchmod +x objdiff-*
to make the binary executable.
CLI binaries can be found on thereleases page.
objdiff works by comparing two relocatable object files (.o
). The objects are expected to have the same relative pathfrom the "target" and "base" directories.
For example, if the target ("expected") object is located atbuild/asm/MetroTRK/mslsupp.o
and the base ("actual")object is located atbuild/src/MetroTRK/mslsupp.o
, the following configuration would be used:
- Target build directory:
build/asm
- Base build directory:
build/src
- Object:
MetroTRK/mslsupp.o
objdiff will then execute the build system from the project directory to build both objects:
$ make build/asm/MetroTRK/mslsupp.o# Only if "Build target object" is enabled$ make build/src/MetroTRK/mslsupp.o
The objects will then be compared and the results will be displayed in the UI.
SeeConfiguration for more information.
Whilenot required (most settings can be specified in the UI), projects can add anobjdiff.json
file to configure the tool automatically. The configuration file must be located inthe root project directory.
If your project has a generator script (e.g.configure.py
), it's recommended to generate the objdiff configurationfile as well. You can then addobjdiff.json
to your.gitignore
to prevent it from being committed.
{"$schema":"https://raw.githubusercontent.com/encounter/objdiff/main/config.schema.json","custom_make":"ninja","custom_args": ["-d","keeprsp" ],"build_target":false,"build_base":true,"watch_patterns": ["*.c","*.cp","*.cpp","*.cxx","*.h","*.hp","*.hpp","*.hxx","*.s","*.S","*.asm","*.inc","*.py","*.yml","*.txt","*.json" ],"units": [ {"name":"main/MetroTRK/mslsupp","target_path":"build/asm/MetroTRK/mslsupp.o","base_path":"build/src/MetroTRK/mslsupp.o","metadata": {} } ]}
Viewconfig.schema.json for all available options. The below list is a summary of the most important options.
custom_make
(optional): By default, objdiff will usemake
to build the project.
If the project uses a different build system (e.g.ninja
), specify it here.
The build command will be[custom_make] [custom_args] path/to/object.o
.
custom_args
(optional): Additional arguments to pass to the build command prior to the object path.
build_target
: If true, objdiff will tell the build system to build the target objects before diffing (e.g.make path/to/target.o
).
This is useful if the target objects are not built by default or can change based on project configuration or editsto assembly files.
Requires the build system to be configured properly.
build_base
: If true, objdiff will tell the build system to build the base objects before diffing (e.g.make path/to/base.o
).
It's unlikely you'll want to disable this, unless you're using an external tool to rebuild the base object on source file changes.
watch_patterns
(optional): A list of glob patterns to watch for changes.(Supported syntax)
If any of these files change, objdiff will automatically rebuild the objects and re-compare them.
If not specified, objdiff will use the default patterns listed above.
units
(optional): If specified, objdiff will display a list of objects in the sidebar for easy navigation.
name
(optional): The name of the object in the UI. If not specified, the object'spath
will be used.
target_path
: Path to the "target" or "expected" object from the project root.
This object is theintended result of the match.
base_path
: Path to the "base" or "actual" object from the project root.
This object is built from thecurrent source code.
metadata.auto_generated
(optional): Hides the object from the object list, but still includes it in reports.
metadata.complete
(optional): Marks the object as "complete" (or "linked") in the object list.
This is useful for marking objects that are fully decompiled. A value offalse
will mark the object as "incomplete".
Install Rust viarustup.
$ git clone https://github.com/encounter/objdiff.git$cd objdiff$ cargo run --release
Or usingcargo install
.
$ cargo install --locked --git https://github.com/encounter/objdiff.git objdiff-gui objdiff-cli
The binaries will be installed to~/.cargo/bin
asobjdiff
andobjdiff-cli
.
When contributing, it's recommended to installpre-commit
to automatically run the linter and formatter before a commit.
uv
is recommended to manage Python version and tools.
Rust nightly is required forcargo +nightly fmt
andcargo +nightly clippy
.
$ cargo install --locked cargo-deny$ rustup toolchain install nightly$ uv tool install pre-commit$ pre-commit install
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE orhttp://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT orhttp://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, asdefined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
About
A local diffing tool for decompilation projects
Topics
Resources
License
Apache-2.0, MIT licenses found
Licenses found
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.