profiler icon indicating copy to clipboard operation
profiler copied to clipboard

Missing source code in the source view

Open mstange opened this issue 3 years ago • 5 comments

At the moment, the source view is only able to show source code in a small number of cases and only for native code (i.e. code compiled from C/C++/Rust). Over time, we should add support for more cases.

This issue tracks the implementation status of the various cases.

  • In profiles from official Firefox builds, captured within Firefox:
    • [x] Source code for native code (C/C++/Rust) hosted on hg.mozilla.org
    • [x] Source code for native code (C/C++/Rust) hosted on github (Rust standard library)
    • [x] Generated sources for native code (C/C++/Rust) stored in an S3 bucket
    • [x] Generated sources for macOS arm64 Firefox builds specifically (bug 1728882)
    • [ ] Source code for Firefox-internal JavaScript code (chrome:// etc.) which is hosted on hg.mozilla.org
    • [ ] Source code for JavaScript code from web pages
    • [ ] Source code for WebAssembly code from web pages
  • In profiles from local Firefox builds, captured within Firefox:
    • [x] Source code for native code (C/C++/Rust) which is stored on the local file system (#3755)
    • [ ] Source code for Firefox-internal JavaScript code which is stored on the local file system
    • [ ] Source code for JavaScript code from web pages
  • In profiles symbolicated with profiler-symbol-server or perfrecord:
    • [x] Source code for native code (C/C++/Rust) which is stored on the local file system (#3754)
    • [ ] Source code for native code (C/C++/Rust) which is hosted on a debuginfod server (Linux system libraries)
  • In uploaded / published profiles, regardless of capturing tool:
    • [x] Source code for Rust dependencies which are hosted on crates.io (#3756)
    • [ ] Source code which was only stored on the local file system, would need to be uploaded together with the profile (#4018)

The various "native code" cases will be handled first. For anything involving JavaScript, we're still lacking the line number information in many cases (see bug 1441689).

┆Issue is synchronized with this Jira Task

mstange avatar Dec 11 '21 17:12 mstange

This comment has been removed because it was offtopic.

IngridMi avatar Apr 26 '22 01:04 IngridMi

The profiler also seems to be unable to show source code for webpack-bundled files (Firefox 103.0, files bundled in development mode).

Edit: Nevermind! This would be included in Source code for JavaScript code from web pages.

Hi, sorry for spam: The message I get when trying to view .wasm or .js for entries in the profiler is as follows:

Source code not available
See [issue #3741](https://github.com/firefox-devtools/profiler/issues/3741) for supported scenarios and planned improvements.
    There is no known cross-origin-accessible URL for this file.

I have CORS fully configured for the host and wide open, and I don't see failed network requests to retrieve it. Is this message misleading, and showing js/wasm source just isn't supported in the profiler yet? From looking at the tasks list I see "Source code for JavaScript code from web pages" isn't checked, and I assume that also encompasses webassembly code.

kg avatar Mar 19 '24 19:03 kg

Hi Katelyn, I've filed #4940 for the case where the JS file is available via CORS - this is not something I had considered before so thank you for pointing it out. For WebAssembly, what would you expect to see in the source view? Formatted "WebAssembly text format" code? If you file an issue about the wasm case I can link it in the list above.

mstange avatar Mar 19 '24 19:03 mstange

Hi Katelyn, I've filed #4940 for the case where the JS file is available via CORS - this is not something I had considered before so thank you for pointing it out. For WebAssembly, what would you expect to see in the source view? Formatted "WebAssembly text format" code? If you file an issue about the wasm case I can link it in the list above.

Thank you very much! My point of reference for this is Chrome's devtools, which show formatted webassembly text format. They don't have line or instruction level time information, so it just shows the raw text with no annotations whatsoever and groups samples by function.

If there is no line/instruction-level information for wasm, I think the lack of wasm source appearing in the profiler is not terribly significant, to the point that I wouldn't ask for it - knowing the names of the hot functions is probably enough. The JS-level information could be very helpful though so I am happy to see an issue filed for it. It's nice that even without the source displayed, the line-level breakdown appears on the left side of the source pane.

I can also imagine there being challenges related to minified JS sources and sources with source maps, but that's mostly speculative until the feature works.

kg avatar Mar 19 '24 19:03 kg