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

Hosting SOS under ClrMd for ELF dumps. #124

Merged
merged 6 commits into from
Feb 22, 2019
Merged

Conversation

mikem8361
Copy link
Member

Add interactive dump "analyze" dump support to dotnet-dump project.

Use the System.CommandLine CommandProcessor for the new commands.

Add "sos", "exit", "help", native "modules" and "setthread" commands.

Hosting SOS under ClrMd for ELF dumps.

Add Microsoft.Diagnostic.Utilities containing console, command and help functions.

Strike.cpp/util.cpp clean and fixes.

Cleanup GetCoreClrDirectory service function. No need to have separate GetModuleDirectory method.

DacpGetModuleData.Request fails on some modules. Skip them in GetModuleFromAddress.

Cleanup some spurious error messages in stack trace commands.

Cleanup ILLDBServices2 interface before it gets shipped.

Add runtineOnly option to LoadNativeSymbols to use to get DAC/DBI module name.

Use LoadNativeSymbols(true) to get the DAC/DBI modules when don't exist locally.

Upgrade to clrmd 1.0.3.

Change SOS.NETCore to the "netstandard2.0" framework.

Change SOS.NETCore to the "netstandard2.0" framework.
Add runtineOnly option to LoadNativeSymbols to use to get DAC/DBI module name.

Use LoadNativeSymbols(true) to get the DAC/DBI modules when don't exist locally.
Cleanup GetCoreClrDirectory service function. No need to have separate GetModuleDirectory method.

DacpGetModuleData.Request fails on some modules. Skip them in GetModuleFromAddress.

Cleanup some spurious error messages in stack trace commands.
@mikem8361 mikem8361 added this to the v3.0 milestone Feb 17, 2019
@mikem8361 mikem8361 self-assigned this Feb 17, 2019
@mikem8361 mikem8361 changed the title Soshost Hosting SOS under ClrMd for ELF dumps. Feb 17, 2019
@mikem8361
Copy link
Member Author

@jonsequitur if you have time, could you take a quick look how I used System.CommandLine in the "Add Microsoft.Diagnostic.Utilities containing console, command and help functions." commit.

Thanks.

@jonsequitur
Copy link

A good deal of the usage of System.CommandLine here covers territory that either I'm working to make easier with my binding PR (dotnet/command-line-api#408) or that Kathleen is working to make easier with her app model work (currently no open PR). We should chat this week.

@mikem8361
Copy link
Member Author

When your and Kathleen's work is finished and in, I'll look at using at some point. We don't want to wait or depend on this future work (just for now).

Copy link
Member

@noahfalk noahfalk left a comment

Choose a reason for hiding this comment

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

A few odds and ends I noticed, but mostly looks fine.

One big open question, what is the plan for testing? I don't think we need to re-test the details of SOS commands that are tested elsewhere, but there are thousands of new lines of code showing up and no corresponding testing so far. That makes me nervous.

src/Microsoft.Diagnostic.Utilities/AssemblyResolver.cs Outdated Show resolved Hide resolved
src/Microsoft.Diagnostic.Utilities/Command/Attributes.cs Outdated Show resolved Hide resolved
src/SOS/SOS.Hosting/LLDBServicesWrapper.cs Show resolved Hide resolved
src/Tools/dotnet-dump/Analyzer.cs Outdated Show resolved Hide resolved
src/Tools/dotnet-dump/Analyzer.cs Outdated Show resolved Hide resolved
src/Tools/dotnet-dump/Commands/SOSCommand.cs Outdated Show resolved Hide resolved
src/Tools/dotnet-dump/Commands/SOSCommand.cs Outdated Show resolved Hide resolved
src/Tools/dotnet-dump/Commands/SOSCommand.cs Outdated Show resolved Hide resolved
src/Tools/dotnet-dump/Program.cs Outdated Show resolved Hide resolved
@mikem8361
Copy link
Member Author

For testing, I plan to modify the SOS runner to run dotnet-debug analyze with the scripts/core dumps that make sense. This isn't to test the native SOS as much as to test the SOS hosting infrastructure including the keyboard/console support.

@noahfalk
Copy link
Member

How would you feel about shifting some of the emphasis from scenario tests to unit tests, and putting those unit tests in this repo that will run as part of the CI? The old SOS tests were awkward because it was difficult to run anything without being hosted in a debugger, and then it was difficult to interact with SOS other than through the command-line interface. But now that we own all the layers and it is primarily C# libraries, I think we could align with standard conventions much more closely.

@mikem8361
Copy link
Member Author

I do like the idea of unit tests without having to deal with a debugger like lldb or cdb. That is one reason I tried to put the actual SOS hosting functionality in a separate assembly (same with the SOS.Installer). Writing a xunit test directly without having the input script, etc would make it easier to test even more of the SOS commands.

Given all that plumbing the dotnet-dump analyze repl into the current SOS runner would exercise the infrastructure better (the interop layer, command processor and even the console provider a little). I don't think it would take that much time to change the SOS runner.

If we have time to both, that would be even better.

@mikem8361
Copy link
Member Author

Actually now that I think about this more, testing the native SOS commands through the SOSHost directly in a xunit test would exercise most of the infrastructure and the native SOS command itself. Using the SOS runner probably wouldn't give us that much coverage of the command processor/repl code.

@mikem8361
Copy link
Member Author

@noahfalk Thanks for all the feedback. I really appreciate the effort it takes for these reviews. I filed some follow up issues. Do you think this PR is ready to merge?

Copy link
Member

@noahfalk noahfalk left a comment

Choose a reason for hiding this comment

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

Go for it.

One suggestion either in this PR or a near future one. If that assembly resolver is only supposed to deal with SOS.NetCore.dll, I would add comments to that effect and ideally add checks in the code to ensure that you don't inadvertently start affecting the resolutions of other assemblies.

Use the System.CommandLine CommandProcessor for the new commands.

Add "sos", "exit", "help", native "modules" and "setthread" commands.
@mikem8361 mikem8361 merged commit e432864 into dotnet:master Feb 22, 2019
@mikem8361 mikem8361 deleted the soshost branch February 22, 2019 23:13
@github-actions github-actions bot locked and limited conversation to collaborators Jan 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants