Uh oh!
There was an error while loading. Please reload this page.
Add -Z instrument-mcount - #57220
Conversation
This flag inserts `mcount` function call to the beginning of every function after inline processing. So tracing tools like uftrace [1] (or ftrace for Linux kernel modules) have a chance to examine function calls. It is similar to the `-pg` flag provided by gcc or clang, but without generating a `__gmon_start__` function for executables. If a program runs without being traced, no `gmon.out` will be written to disk. Under the hood, it simply adds `"instrument-function-entry-inlined"="mcount"` attribute to every function. The `post-inline-ee-instrument` LLVM pass does the actual job. [1]: https://github.com/namhyung/uftrace
rust-highfive
commented
Dec 30, 2018
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @estebank (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
estebank
commented
Dec 31, 2018
@bors r+ CC @rust-lang/compiler |
bors
commented
Dec 31, 2018
📌 Commit 31a5066 has been approved by |
bors
commented
Dec 31, 2018
Add `-Z instrument-mcount` This flag inserts `mcount` function call to the beginning of every function after inline processing. So tracing tools like uftrace [1] (or ftrace for Linux kernel modules) have a chance to examine function calls. It is similar to the `-pg` flag provided by gcc or clang, but without generating a `__gmon_start__` function for executables. If a program runs without being traced, no `gmon.out` will be written to disk. Under the hood, it simply adds `"instrument-function-entry-inlined"="mcount"` attribute to every function. The `post-inline-ee-instrument` LLVM pass does the actual job. [1]: https://github.com/namhyung/uftrace
bors
commented
Dec 31, 2018
☀️ Test successful - status-appveyor, status-travis |
nagisa
commented
Dec 31, 2018
Is it known that all the tools use specifically the |
Good question. EDIT: uftrace also uses different names on different platforms. |
Hi all, I have tried the "-Z instrument-mcount" with rustc compiler ( |
dwlsalmeida
commented
Jul 2, 2022
@eddie9712 same here! |
honggyukim
commented
Jul 2, 2022
Hi, @quark-zju already analyzed this problem before at namhyung/uftrace#1392 (comment). There must be some changes in LLVM 13. @tlambertz found a workaround at namhyung/uftrace#1392 (comment) as follows. For now, we have to add |
This flag inserts
mcountfunction call to the beginning of every functionafter inline processing. So tracing tools like uftrace 1 (or ftrace for
Linux kernel modules) have a chance to examine function calls.
It is similar to the
-pgflag provided by gcc or clang, but withoutgenerating a
__gmon_start__function for executables. If a programruns without being traced, no
gmon.outwill be written to disk.Under the hood, it simply adds
"instrument-function-entry-inlined"="mcount"attribute to every function. The
post-inline-ee-instrumentLLVM pass doesthe actual job.