Beispiel #1
0
 internal DebugFrame(
     DebugThread thread,
     FunctionInfo funcInfo) {
     _thread = thread;
     _funcInfo = funcInfo;
     _variables = new  Dictionary<IList<VariableInfo>, ScopeData>();
 }
Beispiel #2
0
 internal DebugFrame(
     DebugThread thread,
     FunctionInfo funcInfo,
     IRuntimeVariables liftedLocals,
     int frameOrder)
     : this(thread, funcInfo) {
     _liftedLocals = liftedLocals;
     _stackDepth = frameOrder;
 }
Beispiel #3
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;
                }
            }
        }
Beispiel #4
0
        private void CreateGenerator(FunctionInfo targetFuncInfo) {
            object[] paramValues = GetParamValuesForGenerator();
            _generator = (IDebuggableGenerator)targetFuncInfo.GeneratorFactory.GetType().GetMethod("Invoke").Invoke(targetFuncInfo.GeneratorFactory, paramValues);

            // Update funcInfo to the new version
            if (_funcInfo != targetFuncInfo) {
                _funcInfo = targetFuncInfo;
            }
        }
Beispiel #5
0
        internal int GetSequencePointIndex(FunctionInfo funcInfo) {
            DebugSourceSpan[] sequencePoints = funcInfo.SequencePoints;
            for (int i = 0; i < sequencePoints.Length; i++) {
                DebugSourceSpan sequencePoint = sequencePoints[i];

                if (Intersects(sequencePoint)) {
                    return i;
                }
            }

            return Int32.MaxValue;
        }
Beispiel #6
0
 public static DebugFrame CreateFrameForGenerator(DebugContext debugContext, FunctionInfo func)
 {
     return(debugContext.CreateFrameForGenerator(func));
 }
Beispiel #7
0
 public static bool[] GetTraceLocations(FunctionInfo functionInfo)
 {
     return(functionInfo.GetTraceLocations());
 }