internal DebugSourceSpan(DebugSourceFile sourceFile, int lineStart, int columnStart, int lineEnd, int columnEnd) { _sourceFile = sourceFile; _lineStart = lineStart; _columnStart = columnStart; _lineEnd = lineEnd; _columnEnd = columnEnd; }
private int GetSequencePointIndexForSourceSpan(string sourceFile, SourceSpan sourceSpan, DebugFrame frame) { DebugSourceFile debugSourceFile = _debugContext.Lookup(sourceFile); if (debugSourceFile == null) { return(Int32.MaxValue); } DebugSourceSpan debugSourceSpan = new DebugSourceSpan(debugSourceFile, sourceSpan); FunctionInfo leafFrameFuncInfo = frame.FunctionInfo; FunctionInfo funcInfo = debugSourceFile.LookupFunctionInfo(debugSourceSpan); // Verify that funcInfo matches the current frame if (funcInfo != leafFrameFuncInfo) { return(Int32.MaxValue); } // Get the target sequence point return(debugSourceSpan.GetSequencePointIndex(funcInfo)); }
protected override MSAst.Expression VisitDebugInfo(MSAst.DebugInfoExpression node) { if (!node.IsClear) { MSAst.Expression transformedExpression; // Verify that DebugInfoExpression has valid SymbolDocumentInfo if (node.Document == null) { throw new InvalidOperationException( string.Format( CultureInfo.CurrentCulture, ErrorStrings.DebugInfoWithoutSymbolDocumentInfo, _locationCookie)); } DebugSourceFile sourceFile = _debugContext.GetDebugSourceFile( String.IsNullOrEmpty(node.Document.FileName) ? "<compile>" : node.Document.FileName); // Update the location cookie int locationCookie = _locationCookie++; if (!_transformToGenerator) { MSAst.Expression tracebackCall = null; if (locationCookie == 0) { tracebackCall = Ast.Empty(); } else { tracebackCall = Ast.Call( typeof(RuntimeOps).GetMethod(nameof(RuntimeOps.OnTraceEvent)), _thread, AstUtils.Constant(locationCookie), Ast.Convert(Ast.Constant(null), typeof(Exception)) ); } transformedExpression = Ast.Block( Ast.Assign( _debugMarker, AstUtils.Constant(locationCookie) ), Ast.IfThen( Ast.GreaterThan( Ast.Property(_sourceFilesToVariablesMap[sourceFile], "Mode"), Ast.Constant((int)DebugMode.ExceptionsOnly) ), Ast.IfThen( Ast.OrElse( Ast.Equal( Ast.Property(_sourceFilesToVariablesMap[sourceFile], "Mode"), Ast.Constant((int)DebugMode.FullyEnabled) ), Ast.ArrayIndex( _traceLocations, AstUtils.Constant(locationCookie) ) ), Ast.Block( _pushFrame ?? Ast.Empty(), tracebackCall ) ) ) ); } else { Debug.Assert(_generatorLabelTarget != null); transformedExpression = Ast.Block( AstUtils.YieldReturn( _generatorLabelTarget, _debugYieldValue, locationCookie ) ); // Update the variable scope map if (_currentLocals.Count > 0) { BlockExpression curentBlock = _currentLocals.Peek(); if (!_variableScopeMapCache.TryGetValue(curentBlock, out IList <VariableInfo> scopedVaribles)) { scopedVaribles = new List <VariableInfo>(); BlockExpression[] blocks = _currentLocals.ToArray(); for (int i = blocks.Length - 1; i >= 0; i--) { foreach (var variable in blocks[i].Variables) { scopedVaribles.Add(_localsToVarInfos[variable]); } } _variableScopeMapCache.Add(curentBlock, scopedVaribles); } _variableScopeMap.Add(locationCookie, scopedVaribles); } DebugSourceSpan span = new DebugSourceSpan( sourceFile, node.StartLine, node.StartColumn, node.EndLine, node.EndColumn); // Update the location-span map _markerLocationMap.Add(locationCookie, span); } return(transformedExpression); } return(Ast.Empty()); }
internal DebugSourceSpan(DebugSourceFile sourceFile, SourceSpan dlrSpan) : this(sourceFile, dlrSpan.Start.Line, dlrSpan.Start.Column, dlrSpan.End.Line, dlrSpan.End.Column) { }
internal DebugSourceSpan(DebugSourceFile sourceFile, in SourceSpan dlrSpan)