예제 #1
0
 internal DebugFrame(
     DebugThread thread,
     FunctionInfo funcInfo) {
     _thread = thread;
     _funcInfo = funcInfo;
     _variables = new  Dictionary<IList<VariableInfo>, ScopeData>();
 }
예제 #2
0
        public static int GetCurrentSequencePointForLeafGeneratorFrame(DebugThread thread)
        {
            DebugFrame frame = thread.GetLeafFrame();

            Debug.Assert(frame.Generator != null);

            return(frame.CurrentLocationCookie);
        }
예제 #3
0
 internal DebugFrame(
     DebugThread thread,
     FunctionInfo funcInfo)
 {
     Thread     = thread;
     _funcInfo  = funcInfo;
     _variables = new  Dictionary <IList <VariableInfo>, ScopeData>();
 }
예제 #4
0
 internal DebugFrame(
     DebugThread thread,
     FunctionInfo funcInfo,
     IRuntimeVariables liftedLocals,
     int frameOrder)
     : this(thread, funcInfo) {
     _liftedLocals = liftedLocals;
     _stackDepth = frameOrder;
 }
예제 #5
0
 internal DebugFrame(
     DebugThread thread,
     FunctionInfo funcInfo,
     IRuntimeVariables liftedLocals,
     int frameOrder)
     : this(thread, funcInfo)
 {
     _liftedLocals = liftedLocals;
     StackDepth    = frameOrder;
 }
예제 #6
0
        public static bool IsCurrentLeafFrameRemappingToGenerator(DebugThread thread)
        {
            DebugFrame frame = null;

            if (thread.TryGetLeafFrame(ref frame))
            {
                return(frame.ForceSwitchToGeneratorLoop);
            }

            return(false);
        }
예제 #7
0
        void IDebugCallback.OnDebugEvent(TraceEventKind kind, DebugThread thread, FunctionInfo functionInfo, int sequencePointIndex, int stackDepth, object payload)
        {
            ITraceCallback traceCallback = _traceCallback;

            if (traceCallback != null)
            {
                // $TODO: what if the callback throws an exception? should we swallow it?
                var curThread = _traceFrame.Value;
                try {
                    if (kind == TraceEventKind.FrameExit || kind == TraceEventKind.ThreadExit)
                    {
                        traceCallback.OnTraceEvent(
                            kind,
                            kind == TraceEventKind.FrameExit ? functionInfo.Name : null,
                            null,
                            SourceSpan.None,
                            null,
                            payload,
                            functionInfo != null ? functionInfo.CustomPayload : null
                            );
                    }
                    else
                    {
                        DebugFrame leafFrame = thread.GetLeafFrame();
                        _traceFrame.Value = leafFrame;
                        Debug.Assert(sequencePointIndex >= 0 && sequencePointIndex < functionInfo.SequencePoints.Length);
                        DebugSourceSpan sourceSpan = functionInfo.SequencePoints[sequencePointIndex];
                        traceCallback.OnTraceEvent(
                            kind,
                            functionInfo.Name,
                            sourceSpan.SourceFile.Name,
                            sourceSpan.ToDlrSpan(),
                            () => { return(leafFrame.GetLocalsScope()); },
                            payload,
                            functionInfo.CustomPayload
                            );
                    }
                } finally {
                    _traceFrame.Value = curThread;
                }
            }
        }
예제 #8
0
        void IDebugCallback.OnDebugEvent(TraceEventKind kind, DebugThread thread, FunctionInfo functionInfo, int sequencePointIndex, int stackDepth, object payload) {
            ITraceCallback traceCallback = _traceCallback;

            if (traceCallback != null) {
                // $TODO: what if the callback throws an exception? should we swallow it?
                var curThread = _traceFrame.Value;
                try {
                    if (kind == TraceEventKind.FrameExit || kind == TraceEventKind.ThreadExit) {
                        traceCallback.OnTraceEvent(
                            kind,
                            kind == TraceEventKind.FrameExit ? functionInfo.Name : null,
                            null, 
                            SourceSpan.None, 
                            null,
                            payload,
                            functionInfo != null ? functionInfo.CustomPayload : null
                        );
                    } else  {
                        DebugFrame leafFrame = thread.GetLeafFrame();
                        _traceFrame.Value = leafFrame;
                        Debug.Assert(sequencePointIndex >= 0 && sequencePointIndex < functionInfo.SequencePoints.Length);
                        DebugSourceSpan sourceSpan = functionInfo.SequencePoints[sequencePointIndex];
                        traceCallback.OnTraceEvent(
                            kind,
                            functionInfo.Name,
                            sourceSpan.SourceFile.Name,
                            sourceSpan.ToDlrSpan(),
                            () => { return leafFrame.GetLocalsScope(); },
                            payload,
                            functionInfo.CustomPayload
                        );
                    }
                } finally {
                    _traceFrame.Value = curThread;
                }
            }
        }
예제 #9
0
 public static object GeneratorLoopProc(DebugThread thread)
 {
     return(thread.DebugContext.GeneratorLoopProc(thread.GetLeafFrame(), out bool _));
 }
예제 #10
0
 public static void OnThreadExitEvent(DebugThread thread)
 {
     thread.DebugContext.DispatchDebugEvent(thread, Int32.MaxValue, TraceEventKind.ThreadExit, null);
 }
예제 #11
0
 public static void OnFrameExitTraceEvent(DebugThread thread, int debugMarker, object retVal)
 {
     thread.DebugContext.DispatchDebugEvent(thread, debugMarker, TraceEventKind.FrameExit, retVal);
 }
예제 #12
0
 public static void OnFrameEnterTraceEvent(DebugThread thread)
 {
     thread.DebugContext.DispatchDebugEvent(thread, 0, TraceEventKind.FrameEnter, null);
 }
예제 #13
0
 public static void OnTraceEventUnwind(DebugThread thread, int debugMarker, Exception exception)
 {
     thread.DebugContext.DispatchDebugEvent(thread, debugMarker, TraceEventKind.ExceptionUnwind, exception);
 }
예제 #14
0
 public static void OnTraceEvent(DebugThread thread, int debugMarker, Exception exception)
 {
     thread.DebugContext.DispatchDebugEvent(thread, debugMarker, exception != null ? TraceEventKind.Exception : TraceEventKind.TracePoint, exception);
 }
예제 #15
0
 public static bool PopFrame(DebugThread thread)
 {
     return(thread.PopFrame());
 }
예제 #16
0
 public static void LiftVariables(DebugThread thread, IRuntimeVariables runtimeVariables)
 {
     ((DefaultDebugThread)thread).LiftVariables(runtimeVariables);
 }