Closed
Description
Frame Support Matrix
x86 | x64 | arm | arm64 | |
---|---|---|---|---|
ResumableFrame | ✅ | ✅ | ✅ | ✅ |
TransitionFrame | ✅ | ✅ | ✅ | ✅ |
FaultingExceptionFrame | ✅ | ✅ | ✅ | ✅ |
SoftwareExceptionFrame | ✅ | ✅ | ✅ | ✅ |
FuncEvalFrame | ✅ | ✅ | ✅ | ✅ |
HijackFrame | ✅ | ✅ | ✅ | ✅ |
InlinedCallFrame | ✅ | ✅ | ✅ | ✅ |
TailCallFrame | ✅ | - | - | - |
InterpreterFrame |
Key
✅ | Verified |
- | Not applicable for platform |
Information on Frames
- Support all Frames with
NeedsUpdateRegDisplay()==true
-
ResumableFrame
[cDAC] Stack walk support more Frame types #112997- Stores a
PTR_CONTEXT
- Stores a
-
class RedirectedThreadFrame
{
public volatile bool flag;
public volatile int num;
public RedirectedThreadFrame()
{
}
// Configure WinDBG to break on clr exceptions
// (sxe clr)
[MethodImpl(MethodImplOptions.AggressiveOptimization)]
public void Test()
{
var cts = new CancellationTokenSource();
cts.CancelAfter(500);
// use ControlledExecution with a cancellation token to trigger a
// thread abort with a try/catch
ControlledExecution.Run(Work, cts.Token);
while (!flag)
{
TestLoop();
}
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)]
public void TestLoop()
{
for (int i = 0; i < 20; i++)
{
num++;
}
}
[MethodImpl(MethodImplOptions.AggressiveOptimization)]
public void Work()
{
try
{
while (!flag)
{
TestLoop();
}
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
}
-
TransitionFrame
[cDAC] Stack walk support more Frame types #112997- Stores data in
TransitionBlock
- Tested with
PrestubMethodFrame
- Testing notes: Happens when JITing, set breakpoint during JIT to create a dump.
- Stores data in
-
FaultingExceptionFrame
[cDAC] Stack walk support more Frame types #112997- On x86, stores specific registers, otherwise stores a
T_CONTEXT
- Testing notes: Set breakpoint in
ThrowControlForThread
after it callsInitAndLink
. Invoke with a two threaded process where one thread is doing work (loop checking volatile variable) and is cancelled using the following API: Implement ControlledExecution API #71661 - Invokation through: RedirectForThrowControl2 ASM macro.
THROW_CONTROL_FOR_THREAD_FUNCTION
- On x86, stores specific registers, otherwise stores a
class FaultingExceptionTest
{
public volatile bool flag;
public volatile int num;
public FaultingExceptionTest()
{
}
[MethodImpl(MethodImplOptions.AggressiveOptimization)]
public void Test()
{
// bu coreclr!ThrowControlForThread
Console.ReadLine();
var cts = new CancellationTokenSource();
cts.CancelAfter(500);
ControlledExecution.Run(Work, cts.Token);
while (!flag)
{
TestLoop();
}
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)]
public void TestLoop()
{
for (int i = 0; i < 20; i++)
{
if (num > 10000)
{
Console.WriteLine("num is greater than 10000");
}
num++;
}
}
[MethodImpl(MethodImplOptions.AggressiveOptimization)]
public void Work()
{
try
{
while (!flag)
{
TestLoop();
}
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
}
-
SoftwareExceptionFrame
- [cDAC] Implement core stackwalking #111759- Stores a copy of
T_CONTEXT
- Stores a copy of
-
FuncEvalFrame
[cDAC] Stack walk support more Frame types #112997- Debugger test app use immediate window to call
Console.ReadLine()
while it is executing create a dump. Use OS to create a dump (or WinDBG as a non-invasive attach on the debugged process). - On ARM, used VS debugging through SSH.
- Debugger test app use immediate window to call
-
HelperMethodFrame
- Stores
LazyMachState
- Planned to be removed.
- Stores
-
HijackFrame
[cDAC] Stack walk support more Frame types #112997- Set native breakpoint in the GC have second thread doing continuous CPU intensive work (loop checking volatile bool).
class HijackTest()
{
public volatile bool flag;
public volatile int num;
// Set breakpoint at ThreadSuspend::SuspendEE then step out and look at the main thread stack
// (bu coreclr!ThreadSuspend::SuspendEE)
// Note: HijackFrames are not used on Windows if CET is enabled. Either test on non-Windows
// or disable CET by modifying Thread::AreShadowStacksEnabled to return false.
[MethodImpl(MethodImplOptions.AggressiveOptimization)]
public void Test()
{
// start other thread that will force a GC collection.
Task.Run(Work);
// run loop checking volatile variable to generate non-interruptible code.
while (!flag)
{
TestLoop();
}
}
public void Work()
{
Thread.Sleep(500);
GC.Collect();
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)]
public void TestLoop()
{
num++; num++; num++; num++; num++;
num++; num++; num++; num++; num++;
num++; num++; num++; num++; num++;
num++; num++; num++; num++; num++;
num++; num++; num++; num++; num++;
num++; num++; num++; num++; num++;
}
}
-
InlinedCallFrame
- [cDAC] Implement core stackwalking #111759- Stores IP, SP, and FP directly.
-
TailCallFrame
(Windows x86 only)