-
Hi, I'm using cargo asm --bench -p project .... function, as I'd like to analyze a benchmark in package or crate . However, this only works if "function" also exists in the same crate as the benchmark. If I try to define function which exists in a different crate, then asm cannot find it. I have tried only part of the name as well as full path. Is it possible to dump out the asm from a function in a different crate than the bench or executable? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
|
Beta Was this translation helpful? Give feedback.
-
Oh but the problem is I need to examine code in a bench which is only in a specific crate, and in a diff crate than the function. Sent from my iPhoneOn May 26, 2023, at 4:20 AM, pacak ***@***.***> wrote:
cargo-show-asm can dump asm of from a crate it is pointed at either implicitly (crate in a current directory) or explicitly with -p. If code from some other crate does not show up fully inlined this probably means code for that function is fully generated when cargo/rustc compile that other crate so to display it you can try looking at that crate with cargo asm -p other --lib function or something like that.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
If the function is inlined during compilation then you will see it when you look at the bench - this is likely if function is generic or marked with |
Beta Was this translation helpful? Give feedback.
-
To debug this kind of situation I find it useful to do something like cargo asm --everything <OTHER_OPTIONS> | grep <FUNCTION_NAME> It will show you where your function is called even if it's defined in another crate |
Beta Was this translation helpful? Give feedback.
-
In a recent version you can try passing |
Beta Was this translation helpful? Give feedback.
In a recent version you can try passing
--disasm
(needs "disasm" feature), possibly with--context N
- it should be able to list everything, including stuff coming from other crates.