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

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

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

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

            return(false);
        }
Ejemplo n.º 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;
                }
            }
        }
Ejemplo n.º 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;
                }
            }
        }
Ejemplo n.º 9
0
 public static object GeneratorLoopProc(DebugThread thread)
 {
     return(thread.DebugContext.GeneratorLoopProc(thread.GetLeafFrame(), out bool _));
 }
Ejemplo n.º 10
0
 public static void OnThreadExitEvent(DebugThread thread)
 {
     thread.DebugContext.DispatchDebugEvent(thread, Int32.MaxValue, TraceEventKind.ThreadExit, null);
 }
Ejemplo n.º 11
0
 public static void OnFrameExitTraceEvent(DebugThread thread, int debugMarker, object retVal)
 {
     thread.DebugContext.DispatchDebugEvent(thread, debugMarker, TraceEventKind.FrameExit, retVal);
 }
Ejemplo n.º 12
0
 public static void OnFrameEnterTraceEvent(DebugThread thread)
 {
     thread.DebugContext.DispatchDebugEvent(thread, 0, TraceEventKind.FrameEnter, null);
 }
Ejemplo n.º 13
0
 public static void OnTraceEventUnwind(DebugThread thread, int debugMarker, Exception exception)
 {
     thread.DebugContext.DispatchDebugEvent(thread, debugMarker, TraceEventKind.ExceptionUnwind, exception);
 }
Ejemplo n.º 14
0
 public static void OnTraceEvent(DebugThread thread, int debugMarker, Exception exception)
 {
     thread.DebugContext.DispatchDebugEvent(thread, debugMarker, exception != null ? TraceEventKind.Exception : TraceEventKind.TracePoint, exception);
 }
Ejemplo n.º 15
0
 public static bool PopFrame(DebugThread thread)
 {
     return(thread.PopFrame());
 }
Ejemplo n.º 16
0
 public static void LiftVariables(DebugThread thread, IRuntimeVariables runtimeVariables)
 {
     ((DefaultDebugThread)thread).LiftVariables(runtimeVariables);
 }