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

104 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 and MIR code, support all sorts of crosscompilation, should work on Linux, Windows and MacOS at least.

Notable changes from the last announcement include options to simplify the output - stripping unused labels, optional stripping of the directives, support for custom profiles, numerous bugfixes. Also should be faster to compile since now it calls cargo instead of including it.

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