Example #1
0
    internal override async Task <JObject> StepAndCheck(StepKind kind, string script_loc, int line, int column, string function_name,
                                                        Func <JObject, Task> wait_for_event_fn = null, Func <JToken, Task> locals_fn = null, int times = 1)
    {
        JObject resumeLimit = null;

        if (kind != StepKind.Resume)
        {
            resumeLimit = JObject.FromObject(new
            {
                type = kind == StepKind.Over ? "next" : kind == StepKind.Out ? "finish" : "step"
            });
        }
        var o = JObject.FromObject(new
        {
            to   = _client.ThreadActorId,
            type = "resume",
            resumeLimit
        });

        for (int i = 0; i < times - 1; i++)
        {
            await SendCommandAndCheck(o, "resume", null, -1, -1, null);
        }

        // Check for method/line etc only at the last step
        return(await SendCommandAndCheck(
                   o, "resume", script_loc, line, column, function_name,
                   wait_for_event_fn : wait_for_event_fn,
                   locals_fn : locals_fn));
    }
Example #2
0
        async Task <bool> Step(MessageId msg_id, StepKind kind, CancellationToken token)
        {
            var context = GetContext(msg_id);

            if (context.CallStack == null)
            {
                return(false);
            }

            if (context.CallStack.Count <= 1 && kind == StepKind.Out)
            {
                return(false);
            }

            var res = await SendMonoCommand(msg_id, MonoCommands.StartSingleStepping(kind), token);

            var ret_code = res.Value?["result"]?["value"]?.Value <int>();

            if (ret_code.HasValue && ret_code.Value == 0)
            {
                context.ClearState();
                await SendCommand(msg_id, "Debugger.stepOut", new JObject(), token);

                return(false);
            }

            SendResponse(msg_id, Result.Ok(new JObject()), token);

            context.ClearState();

            await SendCommand(msg_id, "Debugger.resume", new JObject(), token);

            return(true);
        }
Example #3
0
 /// <summary>
 /// Creates a Step breakpoint using the specified parameters.
 /// </summary>
 /// <param name="originLocation">Origin location of the step.</param>
 /// <param name="kind">Step kind.</param>
 public StepBreakpoint(IProgramLocation originLocation, StepKind kind)
 {
     OriginLocation = originLocation;
     Kind = kind;
     OnExecute = true;
     IsOneShot = true;
     Enabled = true;
 }
Example #4
0
 /// <summary>
 /// Creates a Step breakpoint using the specified parameters.
 /// </summary>
 /// <param name="originLocation">Origin location of the step.</param>
 /// <param name="kind">Step kind.</param>
 public StepBreakpoint(IProgramLocation originLocation, StepKind kind)
 {
     OriginLocation = originLocation;
     Kind           = kind;
     OnExecute      = true;
     IsOneShot      = true;
     Enabled        = true;
 }
Example #5
0
        async Task Step(MessageId msg_id, StepKind kind, CancellationToken token)
        {
            var res = await SendMonoCommand(msg_id, MonoCommands.StartSingleStepping(kind), token);

            SendResponse(msg_id, Result.Ok(new JObject()), token);

            this.current_callstack = null;

            await SendCommand(msg_id, "Debugger.resume", new JObject(), token);
        }
Example #6
0
		internal async Task<JObject> StepAndCheck (StepKind kind, string script_loc, int line, int column, string function_name,
							Func<JObject, Task> wait_for_event_fn = null, Action<JToken> locals_fn = null, int times=1)
		{
			for (int i = 0; i < times - 1; i ++) {
				await SendCommandAndCheck (null, $"Debugger.step{kind.ToString ()}", null, -1, -1, null);
			}

			// Check for method/line etc only at the last step
			return await SendCommandAndCheck (
						null, $"Debugger.step{kind.ToString ()}", script_loc, line, column, function_name,
						wait_for_event_fn: wait_for_event_fn,
						locals_fn: locals_fn);
		}
Example #7
0
        async Task Step(int msg_id, StepKind kind, CancellationToken token)
        {
            var o = JObject.FromObject(new {
                expression            = string.Format(MonoCommands.START_SINGLE_STEPPING, (int)kind),
                objectGroup           = "mono_debugger",
                includeCommandLineAPI = false,
                silent        = false,
                returnByValue = true,
            });

            var res = await SendCommand("Runtime.evaluate", o, token);

            SendResponse(msg_id, Result.Ok(new JObject()), token);

            this.current_callstack = null;

            await SendCommand("Debugger.resume", new JObject(), token);
        }
Example #8
0
        async Task <bool> Step(MessageId msg_id, StepKind kind, CancellationToken token)
        {
            var context = GetContext(msg_id);

            if (context.CallStack == null)
            {
                return(false);
            }

            var res = await SendMonoCommand(msg_id, MonoCommands.StartSingleStepping(kind), token);

            SendResponse(msg_id, Result.Ok(new JObject()), token);

            context.CallStack = null;

            await SendCommand(msg_id, "Debugger.resume", new JObject(), token);

            return(true);
        }
Example #9
0
        async Task <JObject> StepAndCheck(StepKind kind, string script_loc, int line, int column, string function_name, DebugTestContext ctx,
                                          Func <JObject, Task> wait_for_event_fn = null, Action <JToken> locals_fn = null, int times = 1)
        {
            for (int i = 0; i < times - 1; i++)
            {
                await SendCommandAndCheck(null, $"Debugger.step{kind.ToString ()}", ctx);
            }

            // Check for method/line etc only at the last step
            return(await SendCommandAndCheck(
                       null, $"Debugger.step{kind.ToString ()}", ctx,
                       wait_for_event_fn: async(pause_location) => {
                await CheckLocalsOnFrame(pause_location ["callFrames"][0], script_loc, line, column, function_name, ctx);
                if (wait_for_event_fn != null)
                {
                    await wait_for_event_fn(pause_location);
                }
            },
                       locals_fn : locals_fn));
        }
Example #10
0
        public bool IsStepCompleted(IProgramLocation originLocation, StepKind stepKind)
        {
            PicoProgramLocation loc = (PicoProgramLocation)originLocation;
            ushort pc = Target.VirtualMachine.Data.DirectPC;
            ushort sp = Target.VirtualMachine.Data.DirectSP;

            switch (stepKind)
            {
            case StepKind.Into:
                // If PC is changed, a step is performed.
                return(pc != loc.PC);

            case StepKind.Over:
                // To complete a step over PC has to change, and the call stack has to remain the same.
                return(pc != loc.PC && sp == loc.SP);

            case StepKind.Out:
                // To step out of a subroutine, SP needs to increment (Pop RetAddress).
                return(sp > loc.SP);
            }
            return(false);            // Unreachable, but makes the compiler happy. :)
        }
        /// <summary>
        /// Добавляет шаг-осмотра.
        /// </summary>
        /// <param name="patientId">Id пациента</param>
        /// <param name="step">Шаг осмотра</param>
        /// <param name="date">Дата осмотра</param>
        /// <param name="healthGroup">Группа здоровья, опционально</param>
        /// <param name="referral">Направление, опционально</param>
        /// <exception cref="WebServiceOperationException">Возникает если не возможно добавить шаг осмотра.</exception>
        protected async Task AddStepAsync(int patientId, StepKind step, DateTime date, HealthGroup healthGroup = 0, Referral referral = 0)
        {
            ThrowExceptionIfNotAuthorized();

            var contentParameters = new Dictionary <string, string>
            {
                { "stageId", ((int)step).ToString() },
                { "stageDate", date.ToString("dd.MM.yyyy", CultureInfo.InvariantCulture) },
                { "resultId", ((int)healthGroup).ToString() },
                { "destId", referral == 0 ? string.Empty : ((int)referral).ToString() },
                { "dispId", patientId.ToString() },
            };

            var responseText = await SendPostAsync(@"disp/editDispStage", contentParameters);

            var response = JsonConvert.DeserializeObject <WebResponse>(responseText);

            if (response.IsError)
            {
                throw new WebServiceOperationException("Ошибка добавления шага выполнения осмотра.");
            }
        }
Example #12
0
 public void Step(Token keyword, Token name, StepKind stepKind)
 {
     if (NextEvent("step", keyword.Position))
         listener.Step(keyword, name, stepKind);
 }
Example #13
0
 public ExpectedStep(StepKind kind, int startLine)
 {
     Kind      = kind;
     StartLine = startLine;
 }
Example #14
0
 public void Step(Token keyword, Token name, StepKind stepKind)
 {
 }
Example #15
0
 public void Step(Token keyword, Token name, StepKind stepKind)
 {
     root.Add(formatter.CreateStepExpression(keyword, name, stepKind));
 }
Example #16
0
 public SExp CreateStepExpression(Token keyword, Token name, StepKind stepKind)
 {
     return new SExpList("step", new SExp(FormatPosition(keyword.Position)), new SExp(stepKind.ToString()), new SExp(keyword.Content), new SExp(name.Content));
 }
Example #17
0
 /// <summary>
 /// Creates a Step breakpoint of the specified kind using the
 /// specified target to obtain current program location.
 /// </summary>
 /// <param name="target">Debugger target.</param>
 /// <param name="kind">Step kind.</param>
 public StepBreakpoint(ITarget target, StepKind kind)
     : this(target.ProgramLocation, kind)
 {
 }
Example #18
0
        public bool IsStepCompleted(IProgramLocation originLocation, StepKind stepKind)
        {
            PicoProgramLocation loc = (PicoProgramLocation)originLocation;
            ushort pc = Target.VirtualMachine.Data.DirectPC;
            ushort sp = Target.VirtualMachine.Data.DirectSP;

            switch (stepKind)
            {
                case StepKind.Into:
                    // If PC is changed, a step is performed.
                    return pc != loc.PC;
                case StepKind.Over:
                    // To complete a step over PC has to change, and the call stack has to remain the same.
                    return pc != loc.PC && sp == loc.SP;
                case StepKind.Out:
                    // To step out of a subroutine, SP needs to increment (Pop RetAddress).
                    return sp > loc.SP;
            }
            return false; // Unreachable, but makes the compiler happy. :)
        }
Example #19
0
 /// <summary>
 /// Creates a Step breakpoint of the specified kind using the
 /// specified target to obtain current program location.
 /// </summary>
 /// <param name="target">Debugger target.</param>
 /// <param name="kind">Step kind.</param>
 public StepBreakpoint(ITarget target, StepKind kind) : this(target.ProgramLocation, kind)
 {
 }