Code Monkey home page Code Monkey logo

cargo-asm's Introduction

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 [email protected]: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.

cargo-asm's People

Contributors

gnzlbg avatar dependabot-support avatar dependabot-preview[bot] avatar therealprof avatar regexident avatar atul9 avatar haronk avatar hcpl avatar petr-tik avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.