cargo subcommand showing the assembly or llvm-ir generated for Rust code
Clone or download
dependabot-bot and gnzlbg Bump lazy_static from 1.1.0 to 1.2.0
Bumps [lazy_static](https://github.com/rust-lang-nursery/lazy-static.rs) from 1.1.0 to 1.2.0.
- [Release notes](https://github.com/rust-lang-nursery/lazy-static.rs/releases)
- [Commits](rust-lang-nursery/lazy-static.rs@1.1.0...1.2.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
Latest commit 81ddc04 Dec 1, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cargo-asm-test/lib_crate add support for cargo --features Apr 3, 2018
ci update ci to rust 1.25.0 Apr 10, 2018
src
tests Applied rustfmt Nov 2, 2018
.appveyor.yml allow windows builds to fail Aug 23, 2018
.gitignore Do not use `--debug` flag when calling to `cargo` Apr 10, 2018
.travis.yml upgrade dependencies and rust version Aug 23, 2018
Cargo.lock Bump lazy_static from 1.1.0 to 1.2.0 Dec 2, 2018
Cargo.toml Bump lazy_static from 1.1.0 to 1.2.0 Dec 2, 2018
ISSUE_TEMPLATE.md Simplify issue template Aug 4, 2018
license-apache.md first working prototype Feb 8, 2018
license-mit.md
license.md add license.md and cargo.toml badges Feb 21, 2018
readme.md add symbol searching docs to the readme Feb 24, 2018
rustfmt.toml refactor building the project and cli argument options Feb 8, 2018

readme.md

cargo-asm

crates.io version Travis build status Appveyor build status License

A cargo subcommand that displays the assembly or llvm-ir generated for Rust source code.

Install

cargo install cargo-asm

Example

To view the assembly of the function double_n in the module bar of the crate lib_crate annotated with its corresponding Rust code, go to the crate's root directory

git clone git@github.com:gnzlbg/cargo-asm.git
cd cargo-asm/cargo-asm-test/lib_crate

and type:

cargo asm lib_crate::bar::double_n --rust

which outputs:

screenshot

(note: the source-code mapping information emitted by rustc after optimizations is sometimes far from perfect, like in this case. Take it with a grain of salt.)

To view the LLVM IR type

cargo llvm-ir lib_crate::bar::double_n

Features

  • Platform support:

    • OS: Linux, Windows, and MacOSX.
    • Rust: nightly and stable.
    • Architectures: x86, x86_64, arm, aarch64, powerpc, mips, sparc.
  • Displaying:

    • Assembly in Intel or AT&T syntax.
    • Corresponding Rust source code alongside assembly.
    • JSON AST for further processing.
    • LLVM-IR.
  • Querying:

    • functions, for example: foo:
    cargo asm crate::path::to::foo
    
    • inherent method, for example: foo of a type Foo (that is, Foo::foo):
    cargo asm crate::path::to::Foo::foo
    
    • trait method implementations, for example: bar of the trait Bar for the type Foo:
    cargo asm "<crate::path::to::Foo as crate::path::to::Bar>::bar"
    
    • generic functions, methods, ...

To search for a function named foo in some path, one can just type cargo asm foo. The command will return a list of all similarly named functions independently of the path.

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.