Exemplo n.º 1
0
        DebugPendingBreakpoint(JoinableTaskContext taskContext,
                               DebugBoundBreakpoint.Factory debugBoundBreakpointFactory,
                               BreakpointErrorEnumFactory breakpointErrorEnumFactory,
                               BoundBreakpointEnumFactory breakpointBoundEnumFactory,
                               IBreakpointManager breakpointManager, IDebugProgram2 program,
                               IDebugBreakpointRequest2 request, RemoteTarget target,
                               Marshal marshal)
        {
            taskContext.ThrowIfNotOnMainThread();

            _debugBoundBreakpointFactory = debugBoundBreakpointFactory;
            _breakpointErrorEnumFactory  = breakpointErrorEnumFactory;
            _breakpointBoundEnumFactory  = breakpointBoundEnumFactory;
            _breakpointManager           = breakpointManager;
            _program = program;
            _request = request;
            _target  = target;
            _marshal = marshal;

            _boundBreakpoints = new Dictionary <int, IBoundBreakpoint>();

            BP_REQUEST_INFO[] breakpointRequestInfo = new BP_REQUEST_INFO[1];
            request.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION |
                                   enum_BPREQI_FIELDS.BPREQI_CONDITION |
                                   enum_BPREQI_FIELDS.BPREQI_PASSCOUNT |
                                   enum_BPREQI_FIELDS.BPREQI_LANGUAGE,
                                   breakpointRequestInfo);
            _requestInfo = breakpointRequestInfo[0];

            _enabled             = false;
            _deleted             = false;
            _breakpointCondition = new BreakpointCondition(_requestInfo);
        }
Exemplo n.º 2
0
 BreakpointsVM(ILanguageManager languageManager, IImageManager imageManager, IThemeManager themeManager, IDebuggerSettings debuggerSettings, ITheDebugger theDebugger, IBreakpointManager breakpointManager, IBreakpointSettings breakpointSettings, Lazy<IModuleLoader> moduleLoader, IInMemoryModuleManager inMemoryModuleManager)
 {
     this.breakpointContext = new BreakpointContext(imageManager, moduleLoader) {
         Language = languageManager.Language,
         SyntaxHighlight = debuggerSettings.SyntaxHighlightBreakpoints,
         UseHexadecimal = debuggerSettings.UseHexadecimal,
         ShowTokens = breakpointSettings.ShowTokens,
         ShowModuleNames = breakpointSettings.ShowModuleNames,
         ShowParameterTypes = breakpointSettings.ShowParameterTypes,
         ShowParameterNames = breakpointSettings.ShowParameterNames,
         ShowOwnerTypes = breakpointSettings.ShowOwnerTypes,
         ShowReturnTypes = breakpointSettings.ShowReturnTypes,
         ShowNamespaces = breakpointSettings.ShowNamespaces,
         ShowTypeKeywords = breakpointSettings.ShowTypeKeywords,
     };
     this.breakpointManager = breakpointManager;
     this.theDebugger = theDebugger;
     this.breakpointList = new ObservableCollection<BreakpointVM>();
     breakpointSettings.PropertyChanged += BreakpointSettings_PropertyChanged;
     breakpointManager.OnListModified += BreakpointManager_OnListModified;
     debuggerSettings.PropertyChanged += DebuggerSettings_PropertyChanged;
     theDebugger.OnProcessStateChanged += TheDebugger_OnProcessStateChanged;
     themeManager.ThemeChanged += ThemeManager_ThemeChanged;
     languageManager.LanguageChanged += LanguageManager_LanguageChanged;
     inMemoryModuleManager.DynamicModulesLoaded += InMemoryModuleManager_DynamicModulesLoaded;
     foreach (var bp in breakpointManager.Breakpoints)
         AddBreakpoint(bp);
 }
Exemplo n.º 3
0
        DebugWatchpoint(JoinableTaskContext taskContext,
                        DebugWatchpointResolution.Factory resolutionFactory,
                        BreakpointErrorEnumFactory breakpointErrorEnumFactory,
                        BoundBreakpointEnumFactory boundBreakpointEnumFactory,
                        IBreakpointManager breakpointManager, IDebugBreakpointRequest2 request,
                        RemoteTarget target, IDebugProgram2 program, Marshal marshal)
        {
            taskContext.ThrowIfNotOnMainThread();

            _request                    = request;
            _target                     = target;
            _breakpointManager          = breakpointManager;
            _resolutionFactory          = resolutionFactory;
            _breakpointErrorEnumFactory = breakpointErrorEnumFactory;
            _boundBreakpointEnumFactory = boundBreakpointEnumFactory;
            _disabledByPassCount        = false;

            BP_REQUEST_INFO[] breakpointRequestInfo = new BP_REQUEST_INFO[1];
            request.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION |
                                   enum_BPREQI_FIELDS.BPREQI_CONDITION |
                                   enum_BPREQI_FIELDS.BPREQI_PASSCOUNT,
                                   breakpointRequestInfo);
            _requestInfo = breakpointRequestInfo[0];

            _enabled = true;
            _deleted = false;
            _program = program;
            _marshal = marshal;
        }
        public void SetUp()
        {
            _lldbShell         = Substitute.For <ILLDBShell>();
            _breakpointManager = Substitute.For <IBreakpointManager>();
            _moduleFileLoader  = Substitute.For <IModuleFileLoader>();

            _debugger           = Substitute.For <SbDebugger>();
            _target             = Substitute.For <RemoteTarget>();
            _listenerSubscriber = Substitute.For <ILldbListenerSubscriber>();
            _process            = Substitute.For <SbProcess>();

            _debugEngineHandler = Substitute.For <IDebugEngineHandler>();
            _taskExecutor       = Substitute.For <ITaskExecutor>();
            _eventManager       = Substitute.For <IEventManager>();

            var exceptionManagerFactory =
                new LldbExceptionManager.Factory(new Dictionary <int, YetiCommon.Signal>());
            var exceptionManager = exceptionManagerFactory.Create(_process);

            _debugModuleCache = Substitute.For <IDebugModuleCache>();
            _debugProgram     = Substitute.For <IGgpDebugProgram>();

            _attachedProgram = new LldbAttachedProgram(
                _breakpointManager, _eventManager, _lldbShell, _moduleFileLoader,
                _debugEngineHandler, _taskExecutor, _debugProgram, _debugger, _target, _process,
                exceptionManager, _debugModuleCache, _listenerSubscriber, _remotePid);
        }
Exemplo n.º 5
0
 public virtual IWatchpoint Create(IBreakpointManager breakpointManager,
                                   IDebugBreakpointRequest2 request, RemoteTarget target,
                                   IDebugProgram2 program)
 {
     _taskContext.ThrowIfNotOnMainThread();
     return(Create(breakpointManager, request, target, program, new Marshal()));
 }
        public void SetUp()
        {
            var taskContext = new JoinableTaskContext();

            mockBreakpointManager = Substitute.For <IBreakpointManager>();
            mockBreakpointRequest = Substitute.For <IDebugBreakpointRequest2>();
            mockTarget            = Substitute.For <RemoteTarget>();
            mockProgram           = Substitute.For <IDebugProgram2>();
            mockMarshal           = Substitute.For <Marshal>();
            mockLldbBreakpoint    = Substitute.For <RemoteBreakpoint>();
            requestInfo           = new BP_REQUEST_INFO();
            mockBreakpointRequest.GetRequestInfo(Arg.Any <enum_BPREQI_FIELDS>(),
                                                 Arg.Any <BP_REQUEST_INFO[]>()).Returns(x =>
            {
                enum_BPREQI_FIELDS fields = (enum_BPREQI_FIELDS)x[0];
                BP_REQUEST_INFO[] breakpointRequestInfo = (BP_REQUEST_INFO[])x[1];
                if (breakpointRequestInfo == null || breakpointRequestInfo.Length == 0)
                {
                    return(1);
                }
                return(BuildBreakpointRequestInfo(fields, out breakpointRequestInfo[0]));
            });
            mockLldbBreakpoint.GetId().Returns(EXPECTED_ID);
            SetBreakpointType(enum_BP_LOCATION_TYPE.BPLT_CODE_FILE_LINE);

            mockBoundBreakpointFactory = Substitute.For <DebugBoundBreakpoint.Factory>();

            debugPendingBreakpointFactory = new DebugPendingBreakpoint.Factory(taskContext,
                                                                               mockBoundBreakpointFactory, new BreakpointErrorEnumFactory(),
                                                                               new BoundBreakpointEnumFactory());

            pendingBreakpoint = debugPendingBreakpointFactory.Create(
                mockBreakpointManager, mockProgram, mockBreakpointRequest, mockTarget,
                mockMarshal);
        }
Exemplo n.º 7
0
		BreakpointListSettings(ISettingsManager settingsManager, Lazy<IModuleLoader> moduleLoader, IBreakpointManager breakpointManager) {
			this.settingsManager = settingsManager;
			this.moduleLoader = moduleLoader;
			this.breakpointManager = breakpointManager;
			breakpointManager.OnListModified += BreakpointManager_OnListModified;
			Load();
		}
Exemplo n.º 8
0
 BreakpointsVM(ILanguageManager languageManager, IImageManager imageManager, IThemeManager themeManager, IDebuggerSettings debuggerSettings, ITheDebugger theDebugger, IBreakpointManager breakpointManager, IBreakpointSettings breakpointSettings, Lazy <IModuleLoader> moduleLoader, IInMemoryModuleManager inMemoryModuleManager)
 {
     this.breakpointContext = new BreakpointContext(imageManager, moduleLoader)
     {
         Language           = languageManager.Language,
         SyntaxHighlight    = debuggerSettings.SyntaxHighlightBreakpoints,
         UseHexadecimal     = debuggerSettings.UseHexadecimal,
         ShowTokens         = breakpointSettings.ShowTokens,
         ShowModuleNames    = breakpointSettings.ShowModuleNames,
         ShowParameterTypes = breakpointSettings.ShowParameterTypes,
         ShowParameterNames = breakpointSettings.ShowParameterNames,
         ShowOwnerTypes     = breakpointSettings.ShowOwnerTypes,
         ShowReturnTypes    = breakpointSettings.ShowReturnTypes,
         ShowNamespaces     = breakpointSettings.ShowNamespaces,
         ShowTypeKeywords   = breakpointSettings.ShowTypeKeywords,
     };
     this.breakpointManager                      = breakpointManager;
     this.theDebugger                            = theDebugger;
     this.breakpointList                         = new ObservableCollection <BreakpointVM>();
     breakpointSettings.PropertyChanged         += BreakpointSettings_PropertyChanged;
     breakpointManager.OnListModified           += BreakpointManager_OnListModified;
     debuggerSettings.PropertyChanged           += DebuggerSettings_PropertyChanged;
     theDebugger.OnProcessStateChanged          += TheDebugger_OnProcessStateChanged;
     themeManager.ThemeChanged                  += ThemeManager_ThemeChanged;
     languageManager.LanguageChanged            += LanguageManager_LanguageChanged;
     inMemoryModuleManager.DynamicModulesLoaded += InMemoryModuleManager_DynamicModulesLoaded;
     foreach (var bp in breakpointManager.Breakpoints)
     {
         AddBreakpoint(bp);
     }
 }
Exemplo n.º 9
0
 BreakpointListSettings(ISettingsManager settingsManager, Lazy <IModuleLoader> moduleLoader, IBreakpointManager breakpointManager)
 {
     this.settingsManager              = settingsManager;
     this.moduleLoader                 = moduleLoader;
     this.breakpointManager            = breakpointManager;
     breakpointManager.OnListModified += BreakpointManager_OnListModified;
     Load();
 }
Exemplo n.º 10
0
 public virtual IEventManager Create(IDebugEngineHandler debugEngineHandler,
                                     IBreakpointManager breakpointManager,
                                     IGgpDebugProgram program, SbProcess process,
                                     LldbListenerSubscriber listenerSubscriber)
 {
     return(new LldbEventManager(debugEngineHandler, breakpointManager,
                                 _boundBreakpointEnumFactory, program, process,
                                 listenerSubscriber, _taskContext));
 }
Exemplo n.º 11
0
 public virtual IWatchpoint Create(IBreakpointManager breakpointManager,
                                   IDebugBreakpointRequest2 request, RemoteTarget target,
                                   IDebugProgram2 program, Marshal marshal)
 {
     _taskContext.ThrowIfNotOnMainThread();
     return(new DebugWatchpoint(_taskContext, _resolutionFactory,
                                _breakpointErrorEnumFactory, _boundBreakpointEnumFactory,
                                breakpointManager, request, target, program, marshal));
 }
Exemplo n.º 12
0
 BreakpointMarker(IBreakpointManager breakpointManager, IGlyphTextMarkerService glyphTextMarkerService, IClassificationTypeRegistryService classificationTypeRegistryService, ILCodeBreakpointGlyphTextMarkerHandler ilCodeBreakpointGlyphTextMarkerHandler)
 {
     this.glyphTextMarkerService = glyphTextMarkerService;
     this.classificationTypeEnabledBreakpoint = classificationTypeRegistryService.GetClassificationType(ThemeClassificationTypeNames.BreakpointStatement);
     this.toMethodMarkers = new Dictionary <ILCodeBreakpoint, IGlyphTextMethodMarker>();
     this.ilCodeBreakpointGlyphTextMarkerHandler = ilCodeBreakpointGlyphTextMarkerHandler;
     breakpointManager.BreakpointsAdded         += BreakpointManager_BreakpointsAdded;
     breakpointManager.BreakpointsRemoved       += BreakpointManager_BreakpointsRemoved;
 }
Exemplo n.º 13
0
 public virtual IPendingBreakpoint Create(IBreakpointManager breakpointManager,
                                          IDebugProgram2 program,
                                          IDebugBreakpointRequest2 request,
                                          RemoteTarget target, Marshal marshal)
 {
     _taskContext.ThrowIfNotOnMainThread();
     return(new DebugPendingBreakpoint(_taskContext, _debugBoundBreakpointFactory,
                                       _breakpointErrorEnumFactory,
                                       _breakpointBoundEnumFactory, breakpointManager,
                                       program, request, target, marshal));
 }
Exemplo n.º 14
0
 public DefaultDebugController(ICommunicationServer ipcServer,
                               IDebuggerService debugger,
                               IDebugEventListener callbackService,
                               ThreadManager threadManager,
                               IBreakpointManager breakpointManager)
 {
     _server           = ipcServer;
     _debugger         = debugger;
     _callbackService  = callbackService;
     _threadManager    = threadManager;
     BreakpointManager = breakpointManager;
 }
Exemplo n.º 15
0
 LldbEventManager(IDebugEngineHandler debugEngineHandler,
                  IBreakpointManager breakpointManager,
                  BoundBreakpointEnumFactory boundBreakpointEnumFactory,
                  IGgpDebugProgram program, SbProcess process,
                  LldbListenerSubscriber listenerSubscriber, JoinableTaskContext taskContext)
 {
     _debugEngineHandler         = debugEngineHandler;
     _lldbBreakpointManager      = breakpointManager;
     _boundBreakpointEnumFactory = boundBreakpointEnumFactory;
     _program                = program;
     _lldbProcess            = process;
     _lldbListenerSubscriber = listenerSubscriber;
     _taskContext            = taskContext;
 }
Exemplo n.º 16
0
		BreakpointListSettings(ISettingsManager settingsManager, Lazy<IModuleLoader> moduleLoader, IBreakpointManager breakpointManager) {
			this.settingsManager = settingsManager;
			this.moduleLoader = moduleLoader;
			this.breakpointManager = breakpointManager;
			breakpointManager.OnListModified += BreakpointManager_OnListModified;

			// Prevent Save() from opening assemblies when all files are closed (Close All)
			breakpointManager.OnRemoveBreakpoints = a => {
				if (a == null)
					return new DisableSaveHelper(this);
				((DisableSaveHelper)a).Dispose();
				return null;
			};

			Load();
		}
Exemplo n.º 17
0
        public void SetUp()
        {
            var taskContext = new JoinableTaskContext();

            mockBreakpointManager = Substitute.For <IBreakpointManager>();
            mockBreakpointRequest = Substitute.For <IDebugBreakpointRequest2>();
            mockProgram           = Substitute.For <IDebugProgram2>();
            mockResolution        = Substitute.For <IDebugBreakpointResolution2>();
            mockResolutionFactory = Substitute.For <DebugWatchpointResolution.Factory>();
            mockResolutionFactory.Create(TEST_ADDRESS_STR, mockProgram).Returns(mockResolution);
            mockTarget = Substitute.For <RemoteTarget>();
            SbError error;

            mockError = Substitute.For <SbError>();
            mockTarget.WatchAddress(TEST_ADDRESS, WATCH_SIZE, false, true, out error).Returns(x =>
            {
                x[4] = mockError;
                return(mockLldbWatchpoint);
            });
            mockMarshal = Substitute.For <Marshal>();
            mockMarshal.GetStringFromIntPtr(Arg.Any <IntPtr>()).Returns(TEST_ADDRESS_STR);
            mockLldbWatchpoint = Substitute.For <SbWatchpoint>();
            requestInfo        = new BP_REQUEST_INFO();
            requestInfo.bpLocation.unionmember4 = (IntPtr)4;
            mockBreakpointRequest.GetRequestInfo(Arg.Any <enum_BPREQI_FIELDS>(),
                                                 Arg.Any <BP_REQUEST_INFO[]>()).Returns(x =>
            {
                enum_BPREQI_FIELDS fields = (enum_BPREQI_FIELDS)x[0];
                BP_REQUEST_INFO[] breakpointRequestInfo = (BP_REQUEST_INFO[])x[1];
                if (breakpointRequestInfo == null || breakpointRequestInfo.Length == 0)
                {
                    return(1);
                }
                return(BuildBreakpointRequestInfo(fields, out breakpointRequestInfo[0]));
            });
            mockLldbWatchpoint.GetId().Returns(EXPECTED_ID);
            SetBreakpointType(enum_BP_LOCATION_TYPE.BPLT_DATA_STRING);

            watchpointFactory = new DebugWatchpoint.Factory(taskContext, mockResolutionFactory,
                                                            new BreakpointErrorEnumFactory(), new BoundBreakpointEnumFactory());
            watchpoint = watchpointFactory.Create(mockBreakpointManager, mockBreakpointRequest,
                                                  mockTarget, mockProgram, mockMarshal);
        }
Exemplo n.º 18
0
        BreakpointListSettings(ISettingsManager settingsManager, Lazy <IModuleLoader> moduleLoader, IBreakpointManager breakpointManager)
        {
            this.settingsManager              = settingsManager;
            this.moduleLoader                 = moduleLoader;
            this.breakpointManager            = breakpointManager;
            breakpointManager.OnListModified += BreakpointManager_OnListModified;

            // Prevent Save() from opening assemblies when all files are closed (Close All)
            breakpointManager.OnRemoveBreakpoints = a => {
                if (a == null)
                {
                    return(new DisableSaveHelper(this));
                }
                ((DisableSaveHelper)a).Dispose();
                return(null);
            };

            Load();
        }
Exemplo n.º 19
0
        public void SetUp()
        {
            _mockSbListener         = Substitute.For <SbListener>();
            _mockSbProcess          = Substitute.For <SbProcess>();
            _mockSbEvent            = Substitute.For <SbEvent>();
            _mockRemoteThread       = Substitute.For <RemoteThread>();
            _mockBreakpointManager  = Substitute.For <IBreakpointManager>();
            _mockDebugEngineHandler = Substitute.For <IDebugEngineHandler>();

            _mockPendingBreakpoint1 = Substitute.For <IPendingBreakpoint>();
            _mockPendingBreakpoint2 = Substitute.For <IPendingBreakpoint>();
            _mockBoundBreakpoint1   = Substitute.For <IBoundBreakpoint>();
            _mockBoundBreakpoint2   = Substitute.For <IBoundBreakpoint>();
            _mockBoundBreakpoint3   = Substitute.For <IBoundBreakpoint>();
            _mockWatchpoint         = Substitute.For <IWatchpoint>();
            _mockProgram            = Substitute.For <IGgpDebugProgram>();

            MockEvent(EventType.STATE_CHANGED, StateType.STOPPED, false);
            MockListener(_mockSbEvent, true);
            MockThread(_mockRemoteThread, StopReason.BREAKPOINT, _breakpointStopData);
            MockProcess(new List <RemoteThread> {
                _mockRemoteThread
            });
            MockBreakpointManager();

            _mockListenerSubscriber = Substitute.For <LldbListenerSubscriber>(_mockSbListener);

            var threadContext = new FakeMainThreadContext();

            _eventManager =
                new LldbEventManager
                .Factory(new BoundBreakpointEnumFactory(), threadContext.JoinableTaskContext)
                .Create(_mockDebugEngineHandler, _mockBreakpointManager, _mockProgram,
                        _mockSbProcess, _mockListenerSubscriber);

            var lldbEventManager = _eventManager as LldbEventManager;

            lldbEventManager?.SubscribeToChanges();
        }
        public void SetUp()
        {
            taskContext           = new JoinableTaskContext();
            mockBreakpointRequest = Substitute.For <IDebugBreakpointRequest2>();
            mockTarget            = Substitute.For <RemoteTarget>();
            mockProgram           = Substitute.For <IGgpDebugProgram>();
            mockPendingBreakpoint = Substitute.For <IPendingBreakpoint>();
            mockPendingBreakpoint.GetId().Returns(ID);
            mockWatchpoint = Substitute.For <IWatchpoint>();
            mockWatchpoint.GetId().Returns(ID);
            mockPendingBreakpointFactory = Substitute.For <DebugPendingBreakpoint.Factory>();
            mockWatchpointFactory        = Substitute.For <DebugWatchpoint.Factory>();
            var mockDebugEngineHandler = Substitute.For <IDebugEngineHandler>();

            breakpointManager = new LldbBreakpointManager.Factory(taskContext,
                                                                  mockPendingBreakpointFactory, mockWatchpointFactory).Create(mockDebugEngineHandler,
                                                                                                                              mockProgram);

            mockPendingBreakpointFactory.Create(breakpointManager, mockProgram,
                                                mockBreakpointRequest, mockTarget).ReturnsForAnyArgs(mockPendingBreakpoint);
            mockWatchpointFactory.Create(breakpointManager, mockBreakpointRequest, mockTarget,
                                         mockProgram).ReturnsForAnyArgs(mockWatchpoint);
        }
Exemplo n.º 21
0
 public LldbAttachedProgram(IBreakpointManager breakpointManager, IEventManager eventManager,
                            ILLDBShell lldbShell, IModuleFileLoader moduleFileLoader,
                            IDebugEngineHandler debugEngineHandler,
                            ITaskExecutor taskExecutor, IGgpDebugProgram debugProgram,
                            SbDebugger debugger, RemoteTarget target, SbProcess process,
                            IExceptionManager exceptionManager,
                            IDebugModuleCache debugModuleCache,
                            ILldbListenerSubscriber listenerSubscriber, uint remotePid)
 {
     _debugProgram       = debugProgram;
     _breakpointManager  = breakpointManager;
     _eventManager       = eventManager;
     _lldbShell          = lldbShell;
     _moduleFileLoader   = moduleFileLoader;
     _debugEngineHandler = debugEngineHandler;
     _taskExecutor       = taskExecutor;
     _debugger           = debugger;
     _target             = target;
     _process            = process;
     _exceptionManager   = exceptionManager;
     _debugModuleCache   = debugModuleCache;
     _listenerSubscriber = listenerSubscriber;
     RemotePid           = remotePid;
 }
Exemplo n.º 22
0
 public MachineStopManager(MachineInstance runner, IBreakpointManager breakpoints)
 {
     _machine     = runner ?? throw new ArgumentNullException(nameof(runner));
     _breakpoints = breakpoints ?? throw new ArgumentNullException(nameof(runner));
 }
Exemplo n.º 23
0
 public DefaultDebugService(IBreakpointManager breakpointManager, ThreadManager threads, IVariableVisualizer visualizer)
 {
     _breakpointManager = breakpointManager;
     _visualizer        = visualizer;
     _threadManager     = threads;
 }
Exemplo n.º 24
0
 public MovementRepository(IDatabase database, IBeanRepository beanRepository, INormalRandom normalRandom, IBreakpointManager breakpointManager) : base(database)
 {
     _beanRepository    = beanRepository;
     _normalRandom      = normalRandom;
     _breakpointManager = breakpointManager;
 }