Xcode Instruments can not read Rust source code automatically.

5dcd919
Opened by ICHIKAWA, Yuji at 2024-06-17 20:40:22

Since I almost completely misunderstood the issue, I update it. I am not quite sure if it is related with rustc or not...

In the past, adding debug = true into Cargo.toml seemed to enable Rust source code profiling on Xcode Instruments (on macOS). But at present, it does not work. Instruments seems to read dSYM file correctly (you can check it via File->Symbols...), but Instruments seems not to know source code path.

Who has a responsibility about the source code path?

[ORIGINAL] Hi.

In the past, adding debug = true into Cargo.toml seemed to enable Rust source code profiling on Xcode Instruments (on macOS). But at present, it does not work. Trying to add dSYM path causes the following error.

No new libraries to symbolicate
The specified path didn't locate a dSYM for any of the selected libraries.

I will appreciate very much if anyone let me know workarounds or Rust team resolves it kindly. Thanks.

  1. I'm also running into this issue trying to profile rust in Gecko. It appears the AT_decl_file entries for C++ code have absolute pathnames while the entries for Rust have relative pathnames. Is there anyway to force rust to output the absolute path to the source code in the DWARF info?

    Dan Glastonbury at 2018-11-27 05:12:39

  2. Visiting for wg-debugging triage

    Its been so long since this issue was touched, we should have someone go and confirm that it still reproduces. I'm adding E-help-wanted to reflect that.

    @rustbot label: E-help-wanted

    Felix S Klock II at 2022-09-19 14:40:28

  3. I have definitely profiled rust code in Instruments in the last few months, and it worked. I can check again later today though.

    I will note that I believe it worked for me back in 2017 as well.

    EDIT: Oh, it can't find the source path? Hm, that might not work.

    Thom Chiovoloni at 2022-09-19 14:42:13

  4. It would be nice to have this fully working. It is much easier to narrow down what needs to be optimized when you can see the anotated source code. Flamegraphs are just useful enough to not be completely useless.

    Petar Dambovaliev at 2024-04-08 10:03:00

  5. Hi- It's my first time trying, but confirming all the above, that is showing Rust source code currently doesn't work on Instruments 15.3 and that as a result seeing only the disassembly and callstack is "just useful enough to be completely useless" (I know where the problem roughly is, I can't figure out exactly what part of the function).

    Jerome Humbert at 2024-06-17 20:27:21

  6. Note: as a useful workaround, grabbed from here, you can go into the folder of your binary and run dsymutil <binary>. This produces a new <binary>.dSYM file which Instruments then finds automatically. dsymutil was installed already, I think comes alongside Xcode.

    Jerome Humbert at 2024-06-17 20:40:22