Skip to content
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

Fix Linux NGEN/R2R symbols #436

Merged
merged 2 commits into from
Nov 10, 2017
Merged

Fix Linux NGEN/R2R symbols #436

merged 2 commits into from
Nov 10, 2017

Conversation

brianrob
Copy link
Member

As of .NET Core 2.0, crossgen no longer includes the .ni.dll suffix for native images. PerfView still expects the .ni.dll suffix, and so it is not able to resolve any NGEN or R2R image symbols.

This PR fixes the issue in a backwards compatible way, allowing resolution of the image with or without the ni suffix.

@brianrob brianrob requested a review from vancem November 10, 2017 00:13
@vancem
Copy link
Contributor

vancem commented Nov 10, 2017

Note that there is a break in the tests that looks like it is caused by this change. (ArgumentOutOfRange in the ZipDump test).

at System.String.Substring(Int32 startIndex, Int32 length)
   at Diagnostics.Tracing.StackSources.LinuxPerfScriptEventParser.GetFileNameWithoutExtension(String path, Boolean stripNiSuffix) in C:\projects\perfview\src\PerfView\OtherSources\Linux\LinuxPerfScriptEventParser.cs:line 275
   at Diagnostics.Tracing.StackSources.LinuxPerfScriptMapper.PopulateSymbolMapperAndGuids(ZipArchive archive) in C:\projects\perfview\src\PerfView\OtherSources\Linux\LinuxPerfScriptEventParser.cs:line 703
   at Diagnostics.Tracing.StackSources.LinuxPerfScriptMapper..ctor(ZipArchive archive, LinuxPerfScriptEventParser parser) in C:\projects\perfview\src\PerfView\OtherSources\Linux\LinuxPerfScriptEventParser.cs:line 653
   at Diagnostics.Tracing.StackSources.LinuxPerfScriptEventParser.SetSymbolFile(ZipArchive archive) in C:\projects\perfview\src\PerfView\OtherSources\Linux\LinuxPerfScriptEventParser.cs:line 116
   at Diagnostics.Tracing.StackSources.LinuxPerfScriptStackSource..ctor(String path, Boolean doThreadTime) in C:\projects\perfview\src\PerfView\OtherSources\Linux\LinuxPerfScriptStackSource.cs:line 279
   at Diagnostics.Tracing.StackSources.ParallelLinuxPerfScriptStackSource..ctor(String path, Boolean doThreadTime) in C:\projects\perfview\src\PerfView\OtherSources\Linux\LinuxPerfScriptStackSource.cs:line 19
   at LinuxTracing.Tests.XmlWriting.Write(String source) in C:\projects\perfview\src\LinuxEvent.Tests\XMLWriting.cs:line 20
   at LinuxTracing.Tests.XmlWriting.ZipDump() in C:\projects\perfview\src\LinuxEvent.Tests\XMLWriting.cs:line 28

var suffixStart = name.IndexOf(NISuffix);
var suffixEnd = suffixStart + NISuffix.Length - 1; // Leave the trailing '.' from ".ni."
start = 0;
end = name.Length;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assignments of start and end are dead at this point. You should remove them.

@codecov-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@d457feb). Click here to learn what that means.
The diff coverage is 100%.

@@            Coverage Diff            @@
##             master     #436   +/-   ##
=========================================
  Coverage          ?   17.54%           
=========================================
  Files             ?      213           
  Lines             ?   122889           
  Branches          ?    11839           
=========================================
  Hits              ?    21557           
  Misses            ?   100474           
  Partials          ?      858
Flag Coverage Δ
#2017 17.54% <100%> (?)
#Debug 17.54% <100%> (?)
Impacted Files Coverage Δ
...w/OtherSources/Linux/LinuxPerfScriptEventParser.cs 77.96% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d457feb...c2a14c3. Read the comment docs.

@brianrob
Copy link
Member Author

Thanks for the review @vancem. These should be fixed now.


if (stripNiSuffix)
{
var suffixStart = name.IndexOf(NISuffix);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am surprised this works as you intend because NISuffix =".ni." (that is it has a trailing dot).

I would have expected that typically you would have a path = Foo.ni.dll and name would be Foo.ni (that is no trailing dot), and thus name.IndexOf(NISuffix) would FAIL, and the new code will never do anything.

Are we sure that actually works (it puts both Foo AND Foo.ni in the table)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The input path is for the map file and not for the NI. An example path looks like "traces/perfdemo.trace/System.Console.ni.{d2de1c76-d19d-4c52-8ff5-70e88349ea91}.map" Originally, this function reduced this to "System.Console.ni.{d2de1c76-d19d-4c52-8ff5-70e88349ea91}". If you specify true for stripNiSuffix then you get "System.Console.{d2de1c76-d19d-4c52-8ff5-70e88349ea91}". For .NET Core 2.0, the perfinfo-$pid.map file no longer contains the ".ni" and that's where things were breaking.

I have confirmed that it does work, and that we do put both Foo and Foo.ni in the table. You can see where we put both into the table here: https://github.com/Microsoft/perfview/pull/436/files#diff-151b5622877b35646b2ea5e3c9466af6R701

@vancem vancem merged commit 7fc8b94 into microsoft:master Nov 10, 2017
@brianrob brianrob deleted the fix_linux_ngen_symbols branch November 10, 2017 19:26
vancem added a commit that referenced this pull request Dec 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants