-
Notifications
You must be signed in to change notification settings - Fork 478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Perhaps programs compiled with Rust also can be traced #594
Comments
|
How did you build your rust program? What was the version of uftrace? |
|
Did |
@namhyung Maybe he trace it (full-)dynamically. As I know, there is no support for instrumentation code in |
@taeguk thanks, it'd be nice if rust would support tracing officially. |
It seems we need to demangle rust symbols separately.. |
@namhyung There is very simple rustc demangler. (https://github.com/alexcrichton/rustc-demangle/blob/master/src/lib.rs) |
I'm trying to add mcount support to rustc: rust-lang/rust#57220. |
@quark-zju Looks great! Thanks for your work. |
@quark-zju Welcome to uftrace and thank you very much! |
Is there a quick way to determine a binary is a rust program? I checked the
|
C++ and Rust objects can be linked together. So it's not that easy. Perhaps There are ongoing efforts to change how Rust symbols are mangled. The new scheme has |
I added a simple demangle logic to handle rust symbols seamlessly but it'd be nice to know it's rust before loading symbols. Anyway new mangling scheme will help. |
I just tested a rust program tracing. $ cat fib.rs
fn fibonacci(n: u32) -> u32 {
match n {
0 => 1,
1 => 1,
_ => fibonacci(n - 1) + fibonacci(n - 2),
}
}
fn main() {
fibonacci(5);
} I compiled rust compiler from the master branch which rust-lang/rust#57220 is already committed.
Then tested it with a fibonacci example as follows:
It shows a lot more library calls if I run it without
Thanks a lot for doing this great work @quark-zju! |
Cool! :) |
@honggyukim Thanks for https://reviews.llvm.org/D22666 in the first place! Otherwise the change would have been less confident or elegant. Kudos of demangling improvement go to @namhyung. |
@quark-zju Thank you too :) |
Hi @quark-zju, I would like to ask you if there is a reason to choose |
Non- |
Understood. Thanks for the explanation! |
Finally, the |
I've analyzed $ git clone https://github.com/rust-lang/rust.git --depth=1
$ cd rust
$ git submodule update --init --recursive
$ ./x.py build -i --stage=1
$ RUSTFLAGS="-Z instrument-mcount -g" ./x.py build -i --keep-stage 0 --stage 2
$ cd build/x86_64-unknown-linux-gnu/stage2/bin
$ uftrace -a -t 100us ./rustc fib.rs
----Omit the full output because it is so huge---- The recored data by |
@taeguk Great! You can also use It will show how rust compiler works as a high level view. Please see https://uftrace.github.io/slide/#dump. |
#655 is related to this. |
I was also able to trace
The above TUI output shows some notable phases.
|
this is tested with #588
The text was updated successfully, but these errors were encountered: