dotnet / runtime

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

How to check if someone reduce/breaks debug info for optimized code #2090

Open BrianBohe opened 4 years ago

BrianBohe commented 4 years ago

After merging this PR, we will obtain some improvements debugging optimized code. It would be great to have checks we can run on every new PR to be sure no one breaks/downgrades this changes. I open this issue in order to debate about different ways of accomplishing this. Some ideas are listed below:

  1. Add more information to jit dump, indicating when a variable goes live/dead/spill/unspill and use a diff tool to compare this dump between two different versions.

      • It's on JIT code (easy to run).
      • No pdb is loaded so variable names have format "VXX" with XX an integer (V01, .. V04 ...)
  2. Consume Variable Live Range in diagnostic repo and offer allow windbg extensions to print variable location data with each respective name as interleaving is proposed on this issue.

      • Variable names are the ones they have on code so is easier to understand.
      • Each a PR open on runtime repo would need to run some diagnostic code on windbg and print it on a PR.
  3. Statistical analysis: adding to JIT dump an analysis about code coverage by VariableLiveRange per variable.

      • On jit side+ Need less check by eye of variable liveness/location changing examples on dumps
      • A threshold should be established to accept or reject a change

category:testing theme:debug-info skill-level:intermediate cost:medium

BrianBohe commented 4 years ago

@BruceForstall

BrianBohe commented 4 years ago

There is an open PR to turn of the changes.

BrianBohe commented 4 years ago

An approach @BruceForstall said we can follow is to add variable liveness information to jit-dasm tool