public DbgDotNetStepperBreakpointImpl(DbgEngineImpl engine, DbgThread thread, DbgModule module, uint token, uint offset)
 {
     this.engine = engine ?? throw new ArgumentNullException(nameof(engine));
     this.thread = thread;
     engine.VerifyMonoDebugThread();
     breakpoint = engine.CreateBreakpointForStepper(module, token, offset, OnBreakpointHit);
 }
Esempio n. 2
0
        public void BreakPointOnMainWillHit()
        {
            BreakpointEventRequest request = null;

            _vm.OnTypeLoad += e => {
                if (DebugeeProgramClassName == e.Type.FullName)
                {
                    var locations = e.Type.GetMethod("Main").Locations;
                    Assert.AreEqual(4, locations.Count);

                    Assert.AreEqual(7, locations[0].LineNumber);
                    Assert.AreEqual(8, locations[1].LineNumber);
                    Assert.AreEqual(9, locations[2].LineNumber);
                    Assert.AreEqual(9, locations[3].LineNumber);

                    request = _vm.SetBreakpoint(locations.First());
                    request.Enable();
                }
            };

            _vm.BreakpointHit += e => {
                Assert.AreEqual("Main", e.Method.Name);
                Assert.AreSame(e.Request, request);
                Finish();
            };

            WaitUntilFinished();
        }
Esempio n. 3
0
 bool SendCodeBreakpointHitMessage_MonoDebug(BreakpointEventRequest breakpoint, DbgThread thread)
 {
     debuggerThread.VerifyAccess();
     if (breakpoint.Tag is BoundBreakpointData bpData)
     {
         if (bpData != null)
         {
             SendMessage(new DbgMessageBreakpoint(bpData.EngineBoundCodeBreakpoint.BoundCodeBreakpoint, thread, GetMessageFlags()));
         }
         else
         {
             SendMessage(new DbgMessageBreak(thread, GetMessageFlags()));
         }
         return(true);
     }
     else if (breakpoint.Tag is Func <DbgThread, bool> callback)
     {
         return(callback(thread));
     }
     else
     {
         Debug.Fail("Breakpoint with invalid Tag data");
         return(false);
     }
 }
		bool SendCodeBreakpointHitMessage_MonoDebug(BreakpointEventRequest breakpoint, DbgThread? thread) {
			debuggerThread.VerifyAccess();
			if (breakpoint.Tag is BoundBreakpointData bpData) {
				if (!(bpData is null))
					SendMessage(new DbgMessageBreakpoint(bpData.EngineBoundCodeBreakpoint!.BoundCodeBreakpoint, thread, GetMessageFlags()));
				else
					SendMessage(new DbgMessageBreak(thread, GetMessageFlags()));
				return true;
			}
Esempio n. 5
0
        void SendCodeBreakpointHitMessage_MonoDebug(BreakpointEventRequest breakpoint, DbgThread thread)
        {
            debuggerThread.VerifyAccess();
            var bpData = (BoundBreakpointData)breakpoint.Tag;

            Debug.Assert(bpData != null);
            if (bpData != null)
            {
                SendMessage(new DbgMessageBreakpoint(bpData.EngineBoundCodeBreakpoint.BoundCodeBreakpoint, thread, GetMessageFlags()));
            }
            else
            {
                SendMessage(new DbgMessageBreak(thread, GetMessageFlags()));
            }
        }
Esempio n. 6
0
        private int TryBindBreakpoints()
        {
            int countBounded = 0;

            try
            {
                AD7PendingBreakpoint[] pendingList;
                lock (_pendingBreakpoints)
                    pendingList = _pendingBreakpoints.Where(x => !x.Bound).ToArray();

                foreach (AD7PendingBreakpoint bp in pendingList)
                {
                    MonoBreakpointLocation location;
                    if (bp.TryBind(_types, out location))
                    {
                        try
                        {
                            BreakpointEventRequest request = _vm.SetBreakpoint(location.Method, location.IlOffset);
                            request.Enable();
                            bp.Bound       = true;
                            bp.LastRequest = request;
                            _engine.Callback.BoundBreakpoint(bp);
                            //_vm.Resume();
                            //bp.CurrentThread = null;
                            countBounded++;
                        }
                        catch (Exception ex)
                        {
                            logger.Error("Cant bind breakpoint: " + ex);
                        }
                    }
                    else
                    {
                        logger.Error($"Cant bind breakpoint: {bp.DocumentName}:{bp.StartLine}");
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Cant bind breakpoint: " + ex);
            }

            return(countBounded);
        }
Esempio n. 7
0
        private int TryBindBreakpoints()
        {
            int countBounded = 0;

            try
            {
                AD7PendingBreakpoint[] pendingList;
                lock (_pendingBreakpoints)
                    pendingList = _pendingBreakpoints.Where(x => !x.Bound).ToArray();

                foreach (AD7PendingBreakpoint bp in pendingList)
                {
                    MonoBreakpointLocation location;
                    if (bp.TryBind(_types, out location))
                    {
                        try
                        {
                            int ilOffset;
                            RoslynHelper.GetILOffset(bp, location.Method, out ilOffset);

                            BreakpointEventRequest request = _vm.SetBreakpoint(location.Method, ilOffset);
                            request.Enable();
                            bp.Bound       = true;
                            bp.LastRequest = request;
                            _engine.Callback.BoundBreakpoint(bp);
                            //_vm.Resume();
                            bp.CurrentThread = _mainThread;
                            countBounded++;
                        }
                        catch (Exception ex)
                        {
                            logger.Error("Cant bind breakpoint: " + ex);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Cant bind breakpoint: " + ex);
            }

            return(countBounded);
        }
Esempio n. 8
0
 public SdbBreakpoint(BreakpointEventRequest sdbRequest, ILocation location)
     : base(sdbRequest)
 {
     Location = location;
 }
 protected virtual void OnBreakpointBound(Breakpoint bp, BreakpointEventRequest request)
 {
 }
Esempio n. 10
0
 public BoundBreakpointData(DbgEngineImpl engine, ModuleId module, BreakpointEventRequest breakpoint)
 {
     Engine     = engine ?? throw new ArgumentNullException(nameof(engine));
     Module     = module;
     Breakpoint = breakpoint;
 }