runtime icon indicating copy to clipboard operation
runtime copied to clipboard

Stack unwinding for exception handling

Open hseok-oh opened this issue 10 years ago • 3 comments

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 avatar Jul 01 '16 05:07 hseok-oh

@hseok-oh It seems that you already knew a similar issue dotnet/runtime#6246.

hqueue avatar Jul 01 '16 05:07 hqueue

This is a regression. This was successful until around mid May. Something wrong was merged around 5/15~25

myungjoo avatar Jul 01 '16 06:07 myungjoo

fixed by 597e160

hseok-oh avatar Jul 01 '16 10:07 hseok-oh