-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix exception propagation over HW exception frame on macOS arm64 (#63596
) * Fix exception propagation over HW exception frame on macOS arm64 There is a problem unwinding over the PAL_DispatchExceptionWrapper to the actual hardware exception location. The unwinder is unable to get distinct LR and PC in that frame and sets both of them to the same value. This is caused by the fact that the PAL_DispatchExceptionWrapper is just an injected fake frame and there was no real call. Calls always return with LR and PC set to the same value. The fix unifies the hardware exception frame unwinding with Linux where we had problems unwinding over signal handler trampoline, so PAL_VirtualUnwind skips the trampoline and now also the PAL_DispatchExceptionWrapper frame by copying the context of the exception as the unwound context. * Reenable DllImportGenerator.Unit.Tests
- Loading branch information
Showing
7 changed files
with
90 additions
and
30 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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,60 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
|
||
public class Program | ||
{ | ||
private interface IFoo | ||
{ | ||
bool IsValid { get; } | ||
} | ||
|
||
private class Foo : IFoo | ||
{ | ||
public bool IsValid { get; set; } | ||
} | ||
|
||
public static int Main(string[] args) | ||
{ | ||
bool warmup = new Foo().IsValid; | ||
CatchIgnore(() => | ||
CatchRethrow(() => | ||
{ | ||
IFoo[] foos = {new Foo(), null}; | ||
foreach (var foo in foos) | ||
{ | ||
bool check = foo.IsValid; | ||
} | ||
})); | ||
|
||
return 100; | ||
} | ||
|
||
public static void CatchRethrow(Action action) | ||
{ | ||
try | ||
{ | ||
action.Invoke(); | ||
} | ||
catch (Exception e) | ||
{ | ||
Console.Out.WriteLine("catch"); | ||
Console.Out.Flush(); | ||
throw new Exception("catch", e); | ||
} | ||
} | ||
|
||
public static void CatchIgnore(Action action) | ||
{ | ||
try | ||
{ | ||
action.Invoke(); | ||
} | ||
catch (Exception) | ||
{ | ||
Console.Out.WriteLine("ignore"); | ||
Console.Out.Flush(); | ||
} | ||
} | ||
} |
This file contains 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,9 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<CLRTestPriority>1</CLRTestPriority> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="test62058.cs" /> | ||
</ItemGroup> | ||
</Project> |