1 /* ****************************************************************************
3 * Copyright (c) Microsoft Corporation.
5 * This source code is subject to terms and conditions of the Apache License, Version 2.0. A
6 * copy of the license can be found in the License.html file at the root of this distribution. If
7 * you cannot locate the Apache License, Version 2.0, please send an email to
8 * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
9 * by the terms of the Apache License, Version 2.0.
11 * You must not remove this notice, or any other, from this software.
14 * ***************************************************************************/
17 using Microsoft.Scripting.Ast;
18 using Microsoft.Scripting.Ast.Compiler;
20 using System.Linq.Expressions;
21 using System.Linq.Expressions.Compiler;
25 using System.Collections.Generic;
27 using System.Reflection.Emit;
28 using System.Diagnostics;
29 using System.Diagnostics.SymbolStore;
30 using System.Reflection;
32 namespace System.Runtime.CompilerServices {
33 #if !FEATURE_CORE_DLR || SILVERLIGHT
34 using ILGenerator = OffsetTrackingILGenerator;
38 /// Generates debug information for lambdas in an expression tree.
40 public abstract class DebugInfoGenerator {
43 /// Creates PDB symbol generator.
45 /// <returns>PDB symbol generator.</returns>
46 public static DebugInfoGenerator CreatePdbGenerator() {
47 return new SymbolDocumentGenerator();
51 /// Marks a sequence point.
53 /// <param name="method">The lambda being generated.</param>
54 /// <param name="ilOffset">IL offset where to mark the sequence point.</param>
55 /// <param name="sequencePoint">Debug informaton corresponding to the sequence point.</param>
56 public abstract void MarkSequencePoint(LambdaExpression method, int ilOffset, DebugInfoExpression sequencePoint);
58 internal virtual void MarkSequencePoint(LambdaExpression method, MethodBase methodBase, ILGenerator ilg, DebugInfoExpression sequencePoint) {
59 MarkSequencePoint(method, ilg.ILOffset, sequencePoint);
62 internal virtual void SetLocalName(LocalBuilder localBuilder, string name) {