dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.95k stars 4.65k forks source link

Profiles of Single File Exes Cannot Resolve R2R Symbols #99082

Open brianrob opened 6 months ago

brianrob commented 6 months ago

Description

R2R symbols for code contained in a single file exe cannot be resolved by native profilers (e.g. Visual Studio, WPA, PerfView). This is because the single file exe only points to singlefilehost.pdb. This allows for the native runtime symbols to be resolved, but no managed code R2R symbols.

Reproduction Steps

  1. Build a single file exe with R2R enabled. (Disabling TieredCompilation will make the repro easier.)
  2. Take a PerfView profile of the single file exe running.
  3. Load the profile in PerfView and open the single file exe process's CPU stacks.
  4. Attempt to resolve symbols for any R2R code. If TieredCompilation=false, then this is all managed code.

Expected behavior

R2R symbols are resolvable.

Actual behavior

R2R symbols cannot be resolved.

Regression?

No.

Known Workarounds

  1. Do not compile the single file exe with R2R enabled.
  2. If the binary is built with R2R, you can disable it at runtime for profiling by setting DOTNET_ReadyToRun=0.

Configuration

No response

Other information

No response

ghost commented 6 months ago

Tagging subscribers to this area: @agocke, @vitek-karas, @vsadov See info in area-owners.md if you want to be subscribed.

Issue Details
### Description R2R symbols for code contained in a single file exe cannot be resolved by native profilers (e.g. Visual Studio, WPA, PerfView). This is because the single file exe only points to singlefilehost.pdb. This allows for the native runtime symbols to be resolved, but no managed code R2R symbols. ### Reproduction Steps 1. Build a single file exe with R2R enabled. (Disabling TieredCompilation will make the repro easier.) 2. Take a PerfView profile of the single file exe running. 3. Load the profile in PerfView and open the single file exe process's CPU stacks. 4. Attempt to resolve symbols for any R2R code. If TieredCompilation=false, then this is all managed code. ### Expected behavior R2R symbols are resolvable. ### Actual behavior R2R symbols cannot be resolved. ### Regression? No. ### Known Workarounds 1. Do not compile the single file exe with R2R enabled. 2. If the binary is built with R2R, you can disable it at runtime for profiling by setting `DOTNET_ReadyToRun=0`. ### Configuration _No response_ ### Other information _No response_
Author: brianrob
Assignees: -
Labels: `area-Single-File`, `untriaged`
Milestone: -