-
Notifications
You must be signed in to change notification settings - Fork 382
[SOS/DAC] Add tests for DAC GC bugs #5562
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
fdde4bf
add (failing) test to verify DumpGCData which runs on both server and…
max-charlamb c90d18c
fix
max-charlamb 60bee30
modify unix configs as well
max-charlamb c970566
add test for findroots older generation
max-charlamb 1f6be93
update script
max-charlamb 8835d94
fix switching threads in the script
max-charlamb 57c4053
remove gc configs
max-charlamb ad44213
add support for GCName
max-charlamb 6a880ca
convert to use code conifg
max-charlamb f3e2b2e
remove space
max-charlamb 944e35d
only run tests on .NET10+
max-charlamb 1e234b1
Merge remote-tracking branch 'origin/main' into add-dumpgcdata-test
max-charlamb 68aaaf4
Merge remote-tracking branch 'origin/main' into add-dumpgcdata-test
max-charlamb 0019505
Merge remote-tracking branch 'origin/main' into add-dumpgcdata-test
max-charlamb 3443401
add csproj to sln
max-charlamb 267cacd
Merge remote-tracking branch 'origin/main' into add-dumpgcdata-test
max-charlamb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <TargetFramework Condition="'$(BuildProjectFramework)' != ''">$(BuildProjectFramework)</TargetFramework> | ||
| <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">$(SupportedSubProcessTargetFrameworks)</TargetFrameworks> | ||
| </PropertyGroup> | ||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System; | ||
| using System.Diagnostics; | ||
| using System.Runtime.InteropServices; | ||
|
|
||
| namespace DumpGCData; | ||
|
|
||
| internal class Program | ||
| { | ||
| private static void Main() | ||
| { | ||
| Debugger.Break(); | ||
|
|
||
| byte[] data = new byte[1024 * 1024]; | ||
|
|
||
| GCHandle handle = GCHandle.Alloc(data, GCHandleType.Pinned); | ||
| GC.Collect(); | ||
| Debugger.Break(); | ||
| Console.WriteLine(handle.ToString()); | ||
| } | ||
| } |
7 changes: 7 additions & 0 deletions
7
src/SOS/SOS.UnitTests/Debuggees/FindRootsOlderGeneration/FindRootsOlderGeneration.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <TargetFramework Condition="'$(BuildProjectFramework)' != ''">$(BuildProjectFramework)</TargetFramework> | ||
| <TargetFrameworks Condition="'$(BuildProjectFramework)' == ''">$(SupportedSubProcessTargetFrameworks)</TargetFrameworks> | ||
| </PropertyGroup> | ||
| </Project> |
41 changes: 41 additions & 0 deletions
41
src/SOS/SOS.UnitTests/Debuggees/FindRootsOlderGeneration/Program.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System; | ||
| using System.Diagnostics; | ||
| using System.Runtime; | ||
| using System.Runtime.InteropServices; | ||
|
|
||
| namespace FindRootsOlderGeneration; | ||
|
|
||
| internal class Program | ||
| { | ||
| private static void Main() | ||
| { | ||
| Debugger.Break(); | ||
|
|
||
| // Allocate a large object to ensure it goes on the LOH | ||
| Thing[] data = new Thing[1024 * 1024 * 3]; | ||
| int dataGen = GC.GetGeneration(data); | ||
| data[0] = new Thing() { Name = "First" }; | ||
| int thingGen = GC.GetGeneration(data[0]); | ||
|
|
||
| Console.WriteLine("Enable CLRN notifications: SXE CLRN"); | ||
| Debugger.Break(); | ||
|
|
||
| Console.WriteLine("Forcing GC..."); | ||
| GC.Collect(0, GCCollectionMode.Forced, true); | ||
| GC.Collect(0, GCCollectionMode.Forced, true); | ||
| Console.WriteLine("GC complete."); | ||
| Console.WriteLine("Disable CLRN notifications: SXN CLRN"); | ||
| Debugger.Break(); | ||
|
|
||
| Console.WriteLine(data[0].Name); | ||
| Console.WriteLine($"Array Gen: {dataGen}, Thing Gen: {thingGen}"); | ||
| } | ||
| } | ||
|
|
||
| internal class Thing | ||
| { | ||
| public string Name { get; set; } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # | ||
| # Verifies DumpGCData command | ||
| # | ||
|
|
||
| # Continue to the DebugBreak | ||
| CONTINUE | ||
| IFDEF:CDB | ||
| VERIFY:Break instruction exception - code 80000003 | ||
| ENDIF:CDB | ||
|
|
||
| LOADSOS | ||
|
|
||
| # At start of main, there should be no pinned objects | ||
| SOSCOMMAND:DumpGCData | ||
| VERIFY: pre and post pin: 0 | ||
|
|
||
| CONTINUE | ||
|
|
||
| # At second break, there should be a single pinned object | ||
| SOSCOMMAND:DumpGCData | ||
| VERIFY: pre and post pin: 1 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found this bug while working on the tests. In some cases, this is not initialized before referencing.