Пример #1
0
        private static ImportedMethod TryGetCurrentMethod(DkmInspectionContext inspectionContext, DkmStackWalkFrame frame)
        {
            InspectionSession session = InspectionSession.GetInstance(inspectionContext.InspectionSession);
            InspectionScope   scope   = session.GetScope((DkmClrInstructionAddress)frame.InstructionAddress);

            return(scope.TryImportCurrentMethod());
        }
Пример #2
0
        public static DebugCompilerContext CreateLocalsContext(DkmInspectionContext inspectionContext, DkmClrInstructionAddress address, bool argumentsOnly)
        {
            MemoryStream input;
            StreamReader reader;

            CreateInputStream(string.Empty, out input, out reader);

            InspectionSession session = InspectionSession.GetInstance(inspectionContext.InspectionSession);
            InspectionScope   scope   = session.GetScope(address);

            DebugCompilerContext context = new DebugCompilerContext(
                null /* null because the context doesn't own the lifetime of the session */,
                scope,
                input,
                reader,
                typeof(LocalVariablesTranslator),
                null /* Method name is not applicable because we create multiple methods for Locals. */,
                new List <DkmClrLocalVariableInfo>(),
                null /* Assignment L-Value only applies to assigments */,
                argumentsOnly);

            context.InitializeSymbols();

            return(context);
        }
Пример #3
0
        public static DebugCompilerContext CreateAssignmentContext(DkmEvaluationResult lValue, DkmClrInstructionAddress address, string expression)
        {
            MemoryStream input;
            StreamReader reader;

            CreateInputStream(expression, out input, out reader);

            InspectionSession session = InspectionSession.GetInstance(lValue.InspectionSession);
            InspectionScope   scope   = session.GetScope(address);

            DebugCompilerContext context = new DebugCompilerContext(
                null /* null because the context doesn't own the lifetime of the session */,
                scope,
                input,
                reader,
                typeof(AssignmentTranslator),
                "$.M1",
                null /* Generated locals is not applicable for assigments */,
                lValue.FullName,
                false /* "ArgumentsOnly" only applies to local variable query */);

            context.InitializeSymbols();

            return(context);
        }
 public DebugCompilerContext(
     InspectionSession ownedSession,
     InspectionScope scope,
     MemoryStream input,
     StreamReader reader,
     Type translatorType,
     string methodName,
     List<DkmClrLocalVariableInfo> generatedLocals,
     string assignmentLValue,
     bool argumentsOnly)
     : this(scope.Session.Importer, reader, CompilationFlags.NoDebug | CompilationFlags.WriteDll)
 {
     _ownedSession = ownedSession;
     _input = input;
     _reader = reader;
     _translatorType = translatorType;
     Scope = scope;
     MethodName = methodName;
     ClassName = string.Format("$.C{0}", s_nextClass++);
     GeneratedLocals = generatedLocals;
     AssignmentLValue = assignmentLValue;
     ArgumentsOnly = argumentsOnly;
 }
 public DebugCompilerContext(
     InspectionSession ownedSession,
     InspectionScope scope,
     MemoryStream input,
     StreamReader reader,
     Type translatorType,
     string methodName,
     List <DkmClrLocalVariableInfo> generatedLocals,
     string assignmentLValue,
     bool argumentsOnly)
     : this(scope.Session.Importer, reader, CompilationFlags.NoDebug | CompilationFlags.WriteDll)
 {
     _ownedSession    = ownedSession;
     _input           = input;
     _reader          = reader;
     _translatorType  = translatorType;
     Scope            = scope;
     MethodName       = methodName;
     ClassName        = string.Format("$.C{0}", s_nextClass++);
     GeneratedLocals  = generatedLocals;
     AssignmentLValue = assignmentLValue;
     ArgumentsOnly    = argumentsOnly;
 }