Exemplo n.º 1
0
        public void LldbEvaluationResultBatchTest(LLDBErrorCode resultSource,
                                                  ExpressionEvaluationStep.Types.EngineResult
                                                  resultExpected)
        {
            var step =
                new ExpressionEvaluationStepBatchParams(ExpressionEvaluationEngine.LLDB,
                                                        resultSource, 500);
            var steps = new List <ExpressionEvaluationStepBatchParams> {
                step
            };

            var batchParams = new ExpressionEvaluationBatchParams(
                ExpressionEvaluationStrategy.LLDB, ExpressionEvaluationContext.FRAME, steps, 500,
                2000, null);

            _expressionEvaluationBatch.Add(batchParams);

            var batchSummary = _expressionEvaluationBatch.GetSummary();

            Assert.NotNull(batchSummary.Proto.ExpressionEvaluations);
            Assert.AreEqual(1, batchSummary.Proto.ExpressionEvaluations.Count);

            var expressionEvaluation = batchSummary.Proto.ExpressionEvaluations[0];

            Assert.NotNull(expressionEvaluation.EvaluationSteps);
            Assert.AreEqual(1, expressionEvaluation.EvaluationSteps.Count);

            var firstStep = expressionEvaluation.EvaluationSteps[0];

            Assert.AreEqual(resultExpected, firstStep.Result);
        }
Exemplo n.º 2
0
 public ExpressionEvaluationStepBatchParams(ExpressionEvaluationEngine stepEngine,
                                            LLDBErrorCode lldbErrorCode, long durationUs)
 {
     StepEngine    = stepEngine;
     LldbErrorCode = lldbErrorCode;
     DurationUs    = durationUs;
 }
                // Step finalization for LLDB and LLDB_VARIABLE_PATH engines.
                public void Finalize(LLDBErrorCode lldbErrorCode)
                {
                    long endTicks = _timeSource.GetTimestampTicks();

                    if (_engine != ExpressionEvaluationEngine.LLDB && _engine !=
                        ExpressionEvaluationEngine.LLDB_VARIABLE_PATH)
                    {
                        throw new ArgumentException(
                                  $"Engine {_engine} is incompatible with LLDBErrorCode " +
                                  $"({lldbErrorCode}). Check the parameters for the invoked method.");
                    }

                    if (_finalized)
                    {
                        throw new InvalidOperationException("Object is already finalized");
                    }

                    var batchParams = new ExpressionEvaluationStepBatchParams(
                        _engine, lldbErrorCode, _timeSource.GetDurationUs(_startTicks, endTicks));

                    _stepsRecorder.AddStep(batchParams);

                    _finalized = true;
                }