コード例 #1
0
        protected override void HandleBreakpointHit(IBreakPoint bp, IThread bpThread)
        {
            VSCodeBreakPoint codeBp = (VSCodeBreakPoint)bp;

            da.Protocol.SendEvent(new StoppedEvent()
            {
                AllThreadsStopped = true,
                HitBreakpointIds  = new List <int>()
                {
                    codeBp.GetHashCode()
                },
                Reason   = StoppedEvent.ReasonValue.Breakpoint,
                ThreadId = bpThread.ThreadID,
            });
        }
コード例 #2
0
        protected override SetBreakpointsResponse HandleSetBreakpointsRequest(SetBreakpointsArguments arguments)
        {
            List <Breakpoint>          result   = new List <Breakpoint>();
            HashSet <VSCodeBreakPoint> validBPs = new HashSet <VSCodeBreakPoint>();

            foreach (var i in arguments.Breakpoints)
            {
                try
                {
                    VSCodeBreakPoint bp = debugged.FindBreakpoint(arguments.Source.Path, i.Line);
                    if (bp != null)
                    {
                        if (bp.ConditionExpression != i.Condition)
                        {
                            debugged.SendSetBreakpointCondition(bp.GetHashCode(),
                                                                string.IsNullOrEmpty(i.Condition) ? Runtime.Debugger.Protocol.BreakpointConditionStyle.None : Runtime.Debugger.Protocol.BreakpointConditionStyle.WhenTrue,
                                                                i.Condition);
                        }
                    }
                    else
                    {
                        bp = new VSCodeBreakPoint(debugged, arguments.Source, i.Line, i.Column.GetValueOrDefault(), i.Condition);
                    }
                    validBPs.Add(bp);

                    if (!bp.IsBound && bp.TryBind())
                    {
                        debugged.AddPendingBreakpoint(bp);
                        result.Add(bp.BreakPoint);
                    }
                }
                catch (Exception ex)
                {
                    SendOutput(ex.ToString());
                }
            }

            debugged.UpdateBreakpoints(arguments.Source.Path, validBPs);
            return(new SetBreakpointsResponse(result));
        }