Prints various binary symbols in your crate. Also experimentally disassembles.
This uses capstone for disassembly, so it will compile faster if you have capstone installed as a system library.
First install:
cargo install cargo-sym
or via git:
cargo install --git https://github.com/m4b/cargo-sym -f
Then:
cargo sym
will print every debugging symbol it finds in the first valid binary target intarget/<target>/debug
. This can be, for example:
a.target/debug
(this is used if it doesn't find a special target, like the following)
b. target/x86_64-unknown-linux-musl/debug
cargo sym -C
will print every debugging symbol demangledcargo sym -e
will print every exported symbol importable by other binariescargo sym -Ce
will do-C
and-e
together :]cargo sym -d
will disassemble your binary, objdump style. experimentalcargo sym -d -C /bin/ls
will disassemble the binaryls
at/bin/
(actually most distros strip/bin/ls
so it actually won't)cargo sym -Cd --target=aarch64-linux-android
will disassemble your crates binary attarget/aarch64-linux-android/debug/<crate_name>
cargo sym -C --release -x example
will print the symbols from the example binary you compiled in release mode (attarget/release/examples/example
)cargo sym -Cd --target=debug -x main
will disassemble the example binarymain
in the regular debug locationtarget/debug/examples/main
Try cargo sym --help
for more information!
- Target selector is not. There are a few fixmes to make it nicer. (easy)
- ARM 32-byte printer not completely correct when in thumb mode, should reverse second 8 byte block. (easy)
- Need to properly print got, plt, and plt.got and iterate through sections in a more principled manner. (not to easy)
- When goblin gets a mach and PE backend (which I keep saying will be soon), update the various backends (tedious, hard, requires knowledge of backend formats)
PRs welcome of course :)