cargo-show-asm 0.2.10 - new and improved all over the place :)

83 points manpacket

Ever wondered what kind of asm code rustc generates behind your back? There is godbolt website but copying all the dependencies from a typical project is too much work. There is cargo rustc -- --emit asm but good luck finding exact piece of code you want to look at. And there's cargo-show-asm :)

Start with

cargo install cargo-show-asm

Pick a function from your project (you might need to specify a package for workspace projects or a binary/example/library)

cargo asm --lib

Pick something you want to see the asm code for from the list, you can type part of the name to ask it to filter things a bit:

cargo asm --lib "mini_std::math::lerp"

And get the results right in your terminal.

mini_std::math::lerp:
        .cfi_startproc
        movsd xmm3, qword ptr [rip + .LCPI25_0]

        subsd xmm3, xmm2
        mulsd xmm3, xmm0
        mulsd xmm1, xmm2

        addsd xmm3, xmm1
        movapd xmm0, xmm3

        ret

.Lfunc_end25:
        .size   mini_std::math::lerp, .Lfunc_end25-mini_std::math::lerp
        .cfi_endproc

Should support Intel and AT&T asm syntax, annotate asm with Rust code, dumping LLVM, Wasm and MIR code, support all sorts of crosscompilations, should work on Linux, Windows and MacOS at least.

Notable changes from the last announcement include better support for Windows, support for Wasm, some colorization changes and nightly -Z asm-comments which makes it easier to read generated code.

Check the --help for new flags.

You can also get colorful output from the command line parser if you like - see the docs.

https://crates.io/crates/cargo-show-asm

https://github.com/pacak/cargo-show-asm