-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Fix Unix stack overflow trace logging for native failure locations #35667
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
janvorli
merged 2 commits into
dotnet:master
from
janvorli:fix-stackoverflow-report-at-native
May 4, 2020
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
152 changes: 152 additions & 0 deletions
152
src/coreclr/tests/src/baseservices/exceptions/stackoverflow/stackoverflow.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,152 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
| // See the LICENSE file in the project root for more information. | ||
| using System; | ||
| using System.Threading; | ||
|
|
||
| namespace TestStackOverflow | ||
| { | ||
| struct LargeStruct256 | ||
| { | ||
| Guid g0; | ||
| Guid g1; | ||
| Guid g2; | ||
| Guid g3; | ||
| Guid g4; | ||
| Guid g5; | ||
| Guid g6; | ||
| Guid g7; | ||
| Guid g8; | ||
| Guid g9; | ||
| Guid ga; | ||
| Guid gb; | ||
| Guid gc; | ||
| Guid gd; | ||
| Guid ge; | ||
| Guid gf; | ||
| } | ||
|
|
||
| struct LargeStruct4096 | ||
| { | ||
| LargeStruct256 s0; | ||
| LargeStruct256 s1; | ||
| LargeStruct256 s2; | ||
| LargeStruct256 s3; | ||
| LargeStruct256 s4; | ||
| LargeStruct256 s5; | ||
| LargeStruct256 s6; | ||
| LargeStruct256 s7; | ||
| LargeStruct256 s8; | ||
| LargeStruct256 s9; | ||
| LargeStruct256 sa; | ||
| LargeStruct256 sb; | ||
| LargeStruct256 sc; | ||
| LargeStruct256 sd; | ||
| LargeStruct256 se; | ||
| LargeStruct256 sf; | ||
| } | ||
|
|
||
| struct LargeStruct65536 | ||
| { | ||
| LargeStruct4096 s0; | ||
| LargeStruct4096 s1; | ||
| LargeStruct4096 s2; | ||
| LargeStruct4096 s3; | ||
| LargeStruct4096 s4; | ||
| LargeStruct4096 s5; | ||
| LargeStruct4096 s6; | ||
| LargeStruct4096 s7; | ||
| LargeStruct4096 s8; | ||
| LargeStruct4096 s9; | ||
| LargeStruct4096 sa; | ||
| LargeStruct4096 sb; | ||
| LargeStruct4096 sc; | ||
| LargeStruct4096 sd; | ||
| LargeStruct4096 se; | ||
| LargeStruct4096 sf; | ||
| } | ||
| class Program | ||
| { | ||
| static void InfiniteRecursionA() | ||
| { | ||
| InfiniteRecursionB(); | ||
| } | ||
|
|
||
| static void InfiniteRecursionB() | ||
| { | ||
| InfiniteRecursionC(); | ||
| } | ||
| static void InfiniteRecursionC() | ||
| { | ||
| InfiniteRecursionA(); | ||
| } | ||
|
|
||
| static void InfiniteRecursionA2() | ||
| { | ||
| LargeStruct65536 s; | ||
| InfiniteRecursionB2(); | ||
| } | ||
|
|
||
| static void InfiniteRecursionB2() | ||
| { | ||
| LargeStruct65536 s; | ||
| InfiniteRecursionC2(); | ||
| } | ||
|
|
||
| static void InfiniteRecursionC2() | ||
| { | ||
| LargeStruct65536 s; | ||
| InfiniteRecursionA2(); | ||
| } | ||
|
|
||
| static void MainThreadTest(bool smallframe) | ||
| { | ||
| if (smallframe) | ||
| { | ||
| InfiniteRecursionA(); | ||
| } | ||
| else | ||
| { | ||
| InfiniteRecursionA2(); | ||
| } | ||
| } | ||
|
|
||
| static void SecondaryThreadsTest(bool smallframe) | ||
| { | ||
| Thread[] threads = new Thread[32]; | ||
| for (int i = 0; i < threads.Length; i++) | ||
| { | ||
| threads[i] = new Thread(() => { | ||
| if (smallframe) | ||
| { | ||
| InfiniteRecursionA(); | ||
| } | ||
| else | ||
| { | ||
| InfiniteRecursionA2(); | ||
| } | ||
| }); | ||
| threads[i].Start(); | ||
| } | ||
|
|
||
| for (int i = 0; i < threads.Length; i++) | ||
| { | ||
| threads[i].Join(); | ||
| } | ||
| } | ||
|
|
||
| static void Main(string[] args) | ||
| { | ||
| bool smallframe = (args[0] == "smallframe"); | ||
| if (args[1] == "secondary") | ||
| { | ||
| SecondaryThreadsTest(smallframe); | ||
| } | ||
| else if (args[1] == "main") | ||
| { | ||
| MainThreadTest(smallframe); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
12 changes: 12 additions & 0 deletions
12
src/coreclr/tests/src/baseservices/exceptions/stackoverflow/stackoverflow.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,12 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <Optimize>false</Optimize> | ||
| <CLRTestKind>BuildOnly</CLRTestKind> | ||
| <CLRTestPriority>0</CLRTestPriority> | ||
| </PropertyGroup> | ||
| <ItemGroup> | ||
| <Compile Include="stackoverflow.cs" /> | ||
| </ItemGroup> | ||
| </Project> | ||
|
|
33 changes: 33 additions & 0 deletions
33
src/coreclr/tests/src/baseservices/exceptions/stackoverflow/stackoverflow3.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,33 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
| // See the LICENSE file in the project root for more information. | ||
| using System; | ||
|
|
||
| namespace TestStackOverflow3 | ||
| { | ||
| class Program | ||
| { | ||
| private const int MAX_RECURSIVE_CALLS = 1000000; | ||
| static int ctr = 0; | ||
|
|
||
| public static void Main() | ||
| { | ||
| Program ex = new Program(); | ||
| ex.Execute(); | ||
| } | ||
|
|
||
| private unsafe void Execute(string arg1 = "") | ||
| { | ||
| long* bar = stackalloc long [1000]; | ||
| ctr++; | ||
| if (ctr % 50 == 0) | ||
| Console.WriteLine("Call number {0} to the Execute method", ctr); | ||
|
|
||
| if (ctr <= MAX_RECURSIVE_CALLS) | ||
| Execute(string.Format("{0}", (IntPtr)bar)); | ||
|
|
||
| ctr--; | ||
| } | ||
| } | ||
| } | ||
|
|
13 changes: 13 additions & 0 deletions
13
src/coreclr/tests/src/baseservices/exceptions/stackoverflow/stackoverflow3.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,13 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <Optimize>false</Optimize> | ||
| <AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
| <CLRTestKind>BuildOnly</CLRTestKind> | ||
| <CLRTestPriority>0</CLRTestPriority> | ||
| </PropertyGroup> | ||
| <ItemGroup> | ||
| <Compile Include="stackoverflow3.cs" /> | ||
| </ItemGroup> | ||
| </Project> | ||
|
|
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.
Nit: License headers
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.
Oops, thank you for noticing that, fixed.