runtime
runtime copied to clipboard
Stack unwinding for exception handling
Environment: Linux, ARM
Some unit tests failed because of exception handling. These unit tests have similar feature.
For example,
// JIT/Regression/CLR-x86-JITV1-M11-Beta1/b36332/b36332/b36332.cs
namespace Test
{
using System;
class BB
{
public static BB[] m_axField4 = new BB[7];
public double m_dField3 = 0.0d;
public static object Method1()
{
return ((object)(m_axField4[2].m_dField3));
}
static int Main()
{
try
{
Method1();
}
catch (NullReferenceException)
{
Console.WriteLine("Exception handled.");
}
return 100;
}
}
}
exception occurs in Method1(), and exception handler is in caller method, Main().
by using gdb,
b exceptionhandling.cpp:4532
Breakpoint 1, UnwindManagedExceptionPass1 (ex=..., frameContext=0x7effd748)
at /home/hseok82/git/coreclr/src/vm/exceptionhandling.cpp:4532
4532 /home/hseok82/git/coreclr/src/vm/exceptionhandling.cpp: No such file or directory.
(gdb) p dispatcherContext.ControlPcIsUnwound
$1 = 0 '\000'
(gdb) p/x frameContext->ContextFlags
$2 = 0x8200007
(gdb) c
Continuing.
Breakpoint 1, UnwindManagedExceptionPass1 (ex=..., frameContext=0x7effd748)
at /home/hseok82/git/coreclr/src/vm/exceptionhandling.cpp:4532
4532 in /home/hseok82/git/coreclr/src/vm/exceptionhandling.cpp
(gdb) p dispatcherContext.ControlPcIsUnwound
$3 = 0 '\000'
(gdb) p/x frameContext->ContextFlags
$4 = 0x28200007
I think ControlPcIsUnwound have to set 1 in 2nd break for correct exception handling.
@hseok-oh It seems that you already knew a similar issue dotnet/runtime#6246.
This is a regression. This was successful until around mid May. Something wrong was merged around 5/15~25
fixed by 597e160