Esempio n. 1
0
        private BackTraceElement GetElement(int bpaddr)
        {
            BaseViewModel bvmodel = BreakPointManager.GetBVModel(bpaddr);

            if (bvmodel != null)
            {
                LadderNetworkViewModel lnvmodel = ifacade.ProjectModel.GetNetwork(bvmodel);
                if (lnvmodel == null)
                {
                    return(null);
                }
                LadderDiagramViewModel ldvmodel = lnvmodel.LDVModel;
                SimuBrpoElement        brpo     = new SimuBrpoElement();
                brpo.LDVModel = ldvmodel;
                brpo.LNVModel = lnvmodel;
                brpo.BVModel  = bvmodel;
                return(new BackTraceElement(BackTraceType.Diagram, brpo));
            }
            FuncBlock fblock = BreakPointManager.GetFBlock(bpaddr);

            if (fblock != null)
            {
                FuncBlockViewModel fbvmodel = ifacade.ProjectModel.GetFuncBlock(fblock);
                if (fbvmodel == null)
                {
                    return(null);
                }
                FuncBrpoElement brpo = new FuncBrpoElement();
                brpo.FBVModel = fbvmodel;
                brpo.FBlock   = fblock;
                return(new BackTraceElement(BackTraceType.FuncBlock, brpo));
            }
            return(new BackTraceElement(BackTraceType.External));
        }
Esempio n. 2
0
        private void OnBreakpointPause(object sender, BreakpointPauseEventArgs e)
        {
            items.Clear();
            FuncBlock fblock = BreakPointManager.GetFBlock(e.Address);
            void *    rbp    = SimulateDllModel.GetRBP();
            int       laddr  = (int)rbp + 0x4;
            int       paddr  = (int)rbp - 0x8;

            if (fblock != null)
            {
                IList <FuncBlock_Assignment> localvars  = fblock.LocalVars;
                IList <FuncBlock_Assignment> parameters = fblock.Parameters;
                LocalVarElement_ForFuncBlock lvelement  = null;
                foreach (FuncBlock_Assignment localvar in localvars)
                {
                    lvelement = new LocalVarElement_ForFuncBlock(localvar);
                    GetValue(lvelement, localvar, laddr);
                    items.Add(lvelement);
                    laddr -= localvar.Sizeof;
                }
                foreach (FuncBlock_Assignment parameter in parameters)
                {
                    lvelement = new LocalVarElement_ForFuncBlock(parameter);
                    GetValue(lvelement, parameter, paddr);
                    items.Add(lvelement);
                    paddr += parameter.Sizeof;
                }
            }
            PropertyChanged(this, new PropertyChangedEventArgs("Items"));
        }
Esempio n. 3
0
        public BreakPointMargin(BreakPointManager manager)
        {
            if (manager == null)
            {
                throw new ArgumentNullException("manager");
            }

            this.manager = manager;
        }
Esempio n. 4
0
 public UploadBlock(string fileName, string fileSize, FileType fileType, string target)
 {
     InitializeComponent();
     _uploadBlockViewModel = new UploadBlockViewModel()
     {
         FileName = fileName,
         FileSize = fileSize,
         FileType = fileType,
         Target   = target
     };
     _breakPointManager = new BreakPointManager();
     _breakPointManager.OnUploadProgressChanged += BreakPointManager_OnUploadProgressChanged;
     _breakPointManager.OnUploadCompleted       += BreakPointManager_OnUploadCompleted;
     DataContext = _uploadBlockViewModel;
     Unloaded   += UploadBlock_Unloaded;
 }
Esempio n. 5
0
 private void OnBreakpointPause(object sender, BreakpointPauseEventArgs e)
 {
     Dispatcher.Invoke(new Utility.Delegates.Execute(() =>
     {
         BaseViewModel bvmodel = BreakPointManager.GetBVModel(e.Address);
         if (bvmodel != null)
         {
             Breakpoint = bvmodel;
             ifacade.NavigateToNetwork(bvmodel);
             IEnumerable <SimuBrpoElement> fit = items.Where(
                 (_ele) => { return(_ele.BVModel == bvmodel); });
             if (fit.Count() > 0)
             {
                 SimuBrpoElement ele = fit.First();
                 int id = items.IndexOf(ele);
                 DG_Main.SelectedIndex = id;
             }
         }
     }));
 }
Esempio n. 6
0
		public DebugManager()
		{
			BreakPointManager = new BreakPointManager();

			StartDebuggingCommand = ReactiveCommand.Create();
			StartDebuggingCommand.Subscribe(async o =>
			{
				switch (_shell.CurrentPerspective)
				{
					case Perspective.Editor:
						if (o == null)
						{
							o = _shell.CurrentSolution.StartupProject;
						}

						if (o is IProject)
						{
							var masterProject = o as IProject;

							//WorkspaceViewModel.Instance.SaveAllCommand.Execute(null);

							Task.Factory.StartNew(async () =>
							{
								//WorkspaceViewModel.Instance.ExecutingCompileTask = true;

								if (await masterProject.ToolChain.Build(_console, masterProject))
								{
									//Debugger = masterProject.SelectedDebugAdaptor;

									if (CurrentDebugger != null)
									{
										//await WorkspaceViewModel.Instance.DispatchDebug((Action)(() =>
										{
											StartDebug(masterProject);
										} //));
									}
									else
									{
										_console.WriteLine(
											"You have not selected a debug adaptor. Please goto Tools->Options to configure your debug adaptor.");
									}
								}

								//WorkspaceViewModel.Instance.ExecutingCompileTask = false;
							});
						}
						break;

					case Perspective.Debug:
						// Begin dispatch otherwise UI is awaiting debugger. Inversion of control.
						//WorkspaceViewModel.Instance.BeginDispatchDebug(() =>
					{
						PrepareToRun();
						await CurrentDebugger.ContinueAsync();
					} //);
						break;
				}
			} /*, (o) =>
            {
                bool result = false;

                switch (WorkspaceViewModel.Instance.CurrentPerspective)
                {
                    case Perspective.Editor:
                        if (WorkspaceViewModel.Instance.SolutionExplorer.SelectedProject != null && !WorkspaceViewModel.Instance.ExecutingCompileTask)
                        {
                            result = true;
                        }
                        break;

                    case Perspective.Debug:
                        result = StepCommandsCanExecute(o);
                        break;
                }

                return result;
            }*/);

			RestartDebuggingCommand = ReactiveCommand.Create();
				//(o) => WorkspaceViewModel.Instance.CurrentPerspective == Perspective.Debug && Debugger != null && !IsUpdating);
			RestartDebuggingCommand.Subscribe(_ =>
			{
				SetDebuggers(currentDebugger);

				// Begin dispatch other wise ui thread is awaiting the debug thread. Inversion of control.
				//WorkspaceViewModel.Instance.BeginDispatchDebug(() =>
				{
					PrepareToRun();
					//Debugger.Reset(project.UserData.RunImmediately);
				} //);
			});

			StopDebuggingCommand = ReactiveCommand.Create();
				//(o) => WorkspaceViewModel.Instance.CurrentPerspective == Perspective.Debug && Debugger != null && !IsUpdating);
			StopDebuggingCommand.Subscribe(_ => { Stop(); });

			InterruptDebuggingCommand = ReactiveCommand.Create();
				//, (o) => WorkspaceViewModel.Instance.CurrentPerspective == Perspective.Debug && Debugger != null && Debugger.State == DebuggerState.Running && !IsUpdating);
			InterruptDebuggingCommand.Subscribe(async _ => { await CurrentDebugger.PauseAsync(); });

			StepIntoCommand = ReactiveCommand.Create(); //stepcommand can execute.
			StepIntoCommand.Subscribe(_ => { StepInto(); });

			StepInstructionCommand = ReactiveCommand.Create(); // }, StepCommandsCanExecute);
			StepInstructionCommand.Subscribe(_ => { StepInstruction(); });

			StepOverCommand = ReactiveCommand.Create(); // }, StepCommandsCanExecute);
			StepOverCommand.Subscribe(_ => { StepOver(); });

			StepOutCommand = ReactiveCommand.Create(); // , StepCommandsCanExecute);
			StepOutCommand.Subscribe(_ => { StepOut(); });
		}