public bool AttachDebugger(int processId, DebuggerEngine debuggerEngine) { try { var stopWatch = Stopwatch.StartNew(); var proxy = DebuggerAttacherServiceConfiguration.CreateProxy(_debuggingNamedPipeId, _timeout); using (var client = new DebuggerAttacherServiceProxyWrapper(proxy)) { client.Service.AttachDebugger(processId, debuggerEngine); stopWatch.Stop(); _logger.DebugInfo($"Debugger attached to process {processId}, took {stopWatch.ElapsedMilliseconds} ms"); return(true); } } catch (FaultException <DebuggerAttacherServiceFault> serviceFault) { var errorMessage = serviceFault.Detail.Message; if (string.IsNullOrWhiteSpace(errorMessage)) { errorMessage = $"Could not attach debugger to process {processId}, no error message available"; } errorMessage += $"{Environment.NewLine}There might be more information on the problem in Visual Studio's ActivityLog.xml (see e.g. https://blogs.msdn.microsoft.com/visualstudio/2010/02/24/troubleshooting-extensions-with-the-activity-log/)"; _logger.LogError(errorMessage); } catch (Exception e) { _logger.LogError($"Could not attach debugger to process {processId}:{Environment.NewLine}{e}"); } return(false); }
public bool AttachDebugger(int processId, DebuggerEngine debuggerEngine) { try { var stopWatch = Stopwatch.StartNew(); var proxy = DebuggerAttacherServiceConfiguration.CreateProxy(_debuggingNamedPipeId, _timeout); using (var client = new DebuggerAttacherServiceProxyWrapper(proxy)) { client.Service.AttachDebugger(processId, debuggerEngine); stopWatch.Stop(); _logger.DebugInfo(String.Format(Resources.DebuggerAttachTime, processId, stopWatch.ElapsedMilliseconds)); return(true); } } catch (FaultException <DebuggerAttacherServiceFault> serviceFault) { var errorMessage = serviceFault.Detail.Message; if (string.IsNullOrWhiteSpace(errorMessage)) { errorMessage = String.Format(Resources.DebuggerAttachMessage, processId); } errorMessage += $"{Environment.NewLine}{Resources.MoreInformationMessage}"; _logger.LogError(errorMessage); } catch (Exception e) { _logger.LogError(String.Format(Resources.CouldNotAttachMessage, processId, Environment.NewLine, e)); } return(false); }
public bool AttachDebugger(int processId, DebuggerEngine debuggerEngine) { IntPtr pDebugEngine = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(Guid))); try { Guid debuggerEngineGuid = debuggerEngine == DebuggerEngine.Native ? VSConstants.DebugEnginesGuids.NativeOnly : VSConstants.DebugEnginesGuids.ManagedAndNative; Marshal.StructureToPtr(debuggerEngineGuid, pDebugEngine, false); var debugTarget = new VsDebugTargetInfo4 { dlo = (uint)DEBUG_LAUNCH_OPERATION.DLO_AlreadyRunning | (uint)_DEBUG_LAUNCH_OPERATION4.DLO_AttachToSuspendedLaunchProcess, dwProcessId = (uint)processId, dwDebugEngineCount = 1, pDebugEngines = pDebugEngine, }; var debugger = (IVsDebugger4)_serviceProvider.GetService(typeof(SVsShellDebugger)); AttachDebuggerRetrying(debugger, debugTarget); } finally { Marshal.FreeCoTaskMem(pDebugEngine); } return(true); }
/// <summary> /// Конструктор /// </summary> /// <param name="solution"></param> public ViewStructursTabbedDocument(ControllerProgramSolution solution, DebuggerEngine engine) : base(solution, engine) { InitializeComponent(); _engine = engine; _solution = solution; }
public NativeDebuggedProcessExecutor(IDebuggerAttacher debuggerAttacher, DebuggerEngine debuggerEngine, bool printTestOutput, ILogger logger) { _debuggerAttacher = debuggerAttacher ?? throw new ArgumentNullException(nameof(debuggerAttacher)); _debuggerEngine = debuggerEngine; _printTestOutput = printTestOutput; _logger = logger; }
partial void SetUpPartial() { engine = DebuggingService.GetDebuggerEngines().FirstOrDefault(e => e.Id == EngineId); if (engine == null) { Assert.Ignore("Engine not found: {0}", EngineId); } if (!testProjectReady) { testProjectReady = true; var packagesConfig = Path.Combine(TargetProjectSourceDir, "packages.config"); var packagesDir = Path.Combine(TargetProjectSourceDir, "packages"); if (File.Exists(packagesConfig)) { Process.Start("nuget", $"restore \"{packagesConfig}\" -PackagesDirectory \"{packagesDir}\"").WaitForExit(); } else { var projFile = Path.Combine(TargetProjectSourceDir, TestAppProjectDirName + ".csproj"); Process.Start("nuget", $"restore \"{projFile}\" -PackagesDirectory \"{packagesDir}\"").WaitForExit(); } Process.Start("msbuild", "\"" + TargetProjectSourceDir + "\"").WaitForExit(); } }
public virtual void SetUp () { foreach (DebuggerEngine e in DebuggingService.GetDebuggerEngines ()) { if (e.Id == EngineId) { engine = e; break; } } }
public virtual void SetUp() { interpreter = new NUnitInterpreter( config, options, inferior_stdout, inferior_stderr); engine = interpreter.DebuggerEngine; parser = new LineParser(engine); ReadSourceFile(); }
public override void Setup () { base.Setup (); foreach (DebuggerEngine e in DebuggingService.GetDebuggerEngines ()) { if (e.Id == EngineId) { engine = e; break; } } }
public virtual void SetUp () { foreach (var e in DebuggingService.GetDebuggerEngines ()) { if (e.Id == EngineId) { engine = e; break; } } if (engine == null) Assert.Ignore ("Engine not found: {0}", EngineId); }
private bool _IsReading = false; //Происходит ли опрос(видна ли вкладака) /// <summary> /// Конструктор /// </summary> /// <param name="solution"></param> public ViewSituationsTabbedDocument(ControllerProgramSolution solution, DebuggerEngine engine) : base(solution, engine) { InitializeComponent(); _engine = engine; _solution = solution; if (_solution == null) { _solution = ControllerProgramSolution.Create(_engine.Parameters.ProcessorType); } }
public virtual void SetUp() { foreach (DebuggerEngine e in DebuggingService.GetDebuggerEngines()) { if (e.Id == EngineId) { engine = e; break; } } }
public override void Setup() { base.Setup(); foreach (DebuggerEngine e in DebuggingService.GetDebuggerEngines()) { if (e.Id == eid) { engine = e; break; } } }
/// <summary> /// Обновляет содержимое документа на основании нового движка и проекта /// </summary> public override void Update(ControllerProgramSolution solution, DebuggerEngine engine) { if (solution == null) { this.solutionFromEngine = null; this.Solution = solution; } this.debuggerEngine = engine; this.Solution = solution; this.FillVarsComboBoxes(); this.SetRequestedVarsToComboBoxes(); }
internal CommandLineInterpreter(DebuggerOptions options, bool is_interactive) { if (options.HasDebugFlags) { Report.Initialize(options.DebugOutput, options.DebugFlags); } else { Report.Initialize(); } Configuration = new DebuggerConfiguration(); #if HAVE_XSP if (options.StartXSP) { Configuration.SetupXSP(); } else { Configuration.LoadConfiguration(); } #else Configuration.LoadConfiguration(); #endif Configuration.SetupCLI(); interpreter = new Interpreter(is_interactive, Configuration, options); interpreter.CLI = this; engine = interpreter.DebuggerEngine; parser = new LineParser(engine); if (!interpreter.IsScript) { line_editor = new LineEditor("mdb"); line_editor.AutoCompleteEvent += delegate(string text, int pos) { return(engine.Completer.Complete(text, pos)); }; Console.CancelKeyPress += control_c_event; } interrupt_event = new ST.AutoResetEvent(false); nested_break_state_event = new ST.AutoResetEvent(false); main_loop_stack = new Stack <MainLoop> (); main_loop_stack.Push(new MainLoop(interpreter)); main_thread = new ST.Thread(new ST.ThreadStart(main_thread_main)); main_thread.IsBackground = true; }
public virtual void SetUp() { foreach (var e in DebuggingService.GetDebuggerEngines()) { if (e.Id == EngineId) { engine = e; break; } } if (engine == null) { Assert.Ignore("Engine not found: {0}", EngineId); } }
private DebuggerService(string[] args) { mono_debugger_server_static_init(); bool is_interactive = true; DebuggerConfiguration config = new DebuggerConfiguration(); config.LoadConfiguration(); DebuggerOptions options = DebuggerOptions.ParseCommandLine(args); if (options.HasDebugFlags) { Report.Initialize(options.DebugOutput, options.DebugFlags); } else { Report.Initialize(); } // Redirect the Reporter output stream HACK: Using reflection reporterOutput = new MemoryStream(); FieldInfo writerField = typeof(ReportWriter).GetField("writer", BindingFlags.NonPublic | BindingFlags.Instance); StreamWriter writer = new StreamWriter(reporterOutput); writer.AutoFlush = true; writerField.SetValue(Report.ReportWriter, writer); // Redirect the console //Console.SetOut(writer); //Console.SetError(writer); interpreter = new GuiInterpreter(this, is_interactive, config, options); engine = interpreter.DebuggerEngine; parser = new LineParser(engine); this.breakpointsStore = new BreakpointsStore(this, interpreter); this.callstackStore = new CallstackStore(this, interpreter); this.localsStore = new LocalsStore(this, interpreter); this.threadsStore = new ThreadsStore(this, interpreter); if (interpreter.Options.StartTarget) { interpreter.Start(); } NotifyStateChange(); }
public void AttachDebugger(int processId, DebuggerEngine debuggerEngine) { bool success = false; try { success = _debuggerAttacher.AttachDebugger(processId, debuggerEngine); } catch (Exception e) { ThrowFaultException($"Could not attach debugger to process {processId} because of exception on the server side:{Environment.NewLine}{e}"); } if (!success) { ThrowFaultException($"Could not attach debugger to process {processId} for unknown reasons"); } }
/// <summary> /// Загрузка новых параметров /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public override void Update(ControllerProgramSolution solution, DebuggerEngine engine) { try { _engine = engine; this._Address = _engine.Parameters.ViewMemoryAddress; this._Size = _engine.Parameters.ReadingSize; this.SetValues(); switch (engine.Parameters.ProcessorType) { case ProcessorType.MB90F347: this.ddlMemoryType.Items[5] = "SD Card"; break; case ProcessorType.AT89C51ED2: this.ddlMemoryType.Items[5] = "Flash"; break; default: break; } switch (_engine.Parameters.ViewMemoryType) { case MemoryType.Clock: this.ddlMemoryType.Text = "Clock"; break; case MemoryType.RAM: this.ddlMemoryType.Text = "RAM"; break; case MemoryType.EEPROM: this.ddlMemoryType.Text = "Eprom"; break; case MemoryType.FRAM: this.ddlMemoryType.Text = "FRAM"; break; case MemoryType.XRAM: this.ddlMemoryType.Text = "XRAM"; break; case MemoryType.Flash: this.ddlMemoryType.Text = "FLash"; break; default: this.ddlMemoryType.Text = "SD Card"; break; } this.StartAddress_Leave(null, null); this.ReadingSize_Leave(null, null); } catch (Exception ex) { Utils.ErrorMessage("Update:" + ex.Message); return; } }
public CommandLineInterpreter(Interpreter interpreter) { this.interpreter = interpreter; this.engine = interpreter.DebuggerEngine; interpreter.CLI = this; parser = new LineParser(engine); interrupt_event = new ST.AutoResetEvent(false); nested_break_state_event = new ST.AutoResetEvent(false); Console.CancelKeyPress += control_c_event; main_loop_stack = new Stack <MainLoop> (); main_loop_stack.Push(new MainLoop(interpreter)); main_thread = new ST.Thread(new ST.ThreadStart(main_thread_main)); main_thread.IsBackground = true; }
public EmonicLineInterpreter(DebuggerConfiguration config, DebuggerOptions options) { if (options.HasDebugFlags) { Report.Initialize(options.DebugOutput, options.DebugFlags); } else { Report.Initialize(); } interpreter = new EmonicInterpreter(config, options); engine = interpreter.DebuggerEngine; parser = new LineParser(engine); main_thread = new ST.Thread(new System.Threading.ThreadStart(main_thread_main)); main_thread.IsBackground = true; command_thread = new ST.Thread(new ST.ThreadStart(command_thread_main)); command_thread.IsBackground = true; }
/// <summary> /// Загрузка новых параметров /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public override void Update(ControllerProgramSolution solution, DebuggerEngine engine) { _engine = engine; if (solution != null) { _solution = solution; } //Оснатовка чтения this.RemoveReadItems(); //Удаление строк из таблицы this.dgProcess.Rows.Clear(); //Добавление процессов из проекта в таблицу foreach (ProjectProcess ps in _solution.Processes) { this.dgProcess.Rows.Add(ps.Name, "***"); } //Сортировка записий в таблице this.dgProcess.Sort(this.dgProcess.Columns[0], ListSortDirection.Ascending); //Запуск чтения this.AddedReadItems(); }
public ViewGraphicsTabbedDocument(ControllerProgramSolution solution, DebuggerEngine Engine) : base(solution, Engine) { InitializeComponent(); // Инициализация ComboBox'ов this.VarsComboBoxes = new List <ComboBox>() { this.cbVar_0, this.cbVar_1, this.cbVar_2, this.cbVar_3, this.cbVar_4, this.cbVar_5 }; this.timeStamps = new long[this.VarsComboBoxes.Count]; for (int i = 0; i < this.VarsComboBoxes.Count; i++) { this.VarsComboBoxes[i].Leave += new EventHandler(VarComboBox_Leave); this.VarsComboBoxes[i].SelectedIndexChanged += new EventHandler(VarComboBox_Leave); this.VarsComboBoxes[i].KeyDown += new KeyEventHandler(VarComboBox_KeyDown); this.timeStamps[i] = 0; } this.FillVarsComboBoxes(); // Инициализация графиков this.InitGraphControl(); this.Update(solution, Engine); }
/// <summary> /// Конструктор /// </summary> /// <param name="solution"></param> public ViewVarsTabbedDocument(ControllerProgramSolution solution, DebuggerEngine engine) : base(solution, engine) { InitializeComponent(); _engine = engine; _solution = solution; if (_solution == null) { _solution = ControllerProgramSolution.Create(_engine.Parameters.ProcessorType); _EmptyProgect = true; } else { _EmptyProgect = false; } for (int i = 0; i < _RemovedVars.Length; i++) { _RemovedVars[i] = new List <ControllerVar>(); } RebuildTree(); this.dgVars.Columns[1].ReadOnly = false; }
public Interpreter(bool is_interactive, DebuggerConfiguration config, DebuggerOptions options) { this.config = config; this.is_interactive = is_interactive; this.is_script = options.IsScript; this.parser = new ExpressionParser(this); this.session = new DebuggerSession(config, options, "main", parser); this.engine = new DebuggerEngine(this); parser.Session = session; source_factory = new SourceFileFactory(); interrupt_event = new ManualResetEvent(false); process_event = new ManualResetEvent(false); styles = new Hashtable(); styles.Add("cli", new StyleCLI(this)); styles.Add("emacs", new StyleEmacs(this)); current_style = (StyleBase)styles ["cli"]; }
public string[] FilenameCompleter(string text) { string dir; string file_prefix; DebuggerEngine de = engine as DebuggerEngine; if (text.IndexOf(Path.DirectorySeparatorChar) == -1) { dir = de.Interpreter.Options.WorkingDirectory ?? Environment.CurrentDirectory; file_prefix = text; } else { dir = text.Substring(0, text.LastIndexOf(Path.DirectorySeparatorChar) + 1); file_prefix = text.Substring(text.LastIndexOf(Path.DirectorySeparatorChar) + 1); } string[] fs_entries; try { fs_entries = Directory.GetFileSystemEntries(dir, file_prefix + "*"); } catch { return(null); } var matched_paths = new List <string> (); foreach (string f in fs_entries) { if (f.StartsWith(Path.Combine(dir, file_prefix))) { matched_paths.Add(f); } } return(matched_paths.ToArray()); }
partial void SetUpPartial() { foreach (var e in DebuggingService.GetDebuggerEngines()) { if (e.Id == EngineId) { engine = e; break; } } if (engine == null) { Assert.Ignore("Engine not found: {0}", EngineId); } if (!testProjectReady) { testProjectReady = true; var packagesConfig = Path.Combine(TargetProjectSourceDir, "packages.config"); var packagesDir = Path.Combine(TargetProjectSourceDir, "packages"); Process.Start("nuget", $"restore \"{packagesConfig}\" -PackagesDirectory \"{packagesDir}\"").WaitForExit(); Process.Start("msbuild", "\"" + TargetProjectSourceDir + "\"").WaitForExit(); } }
/// <summary> /// Загрузка новых параметров /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public override void Update(ControllerProgramSolution solution, DebuggerEngine engine) { _engine = engine; if (solution != null) { _solution = solution; } else { _solution = ControllerProgramSolution.Create(_engine.Parameters.ProcessorType); } //Очистка значений переменных this.StructsTable.Rows.Clear(); this.VarsTable.Rows.Clear(); this.DisplayVarsTable.Rows.Clear(); this._freeStructs = new List <ControllerStructVar>(); this.clb_structurs.Items.Clear(); FillStuctursTables(); //Добваление структур, которых нет в проекте ControllerStructVar m_struct; ControllerUserVar m_var; foreach (DebuggerParameters.StructDescription sd in _engine.Parameters.ReadingStructs) { bool m_fined = false; foreach (DataRow dr in this.StructsTable.Rows) { if (dr[0].ToString() == sd.Name) { m_fined = true; break; } } if (m_fined) { continue; } m_struct = new ControllerStructVar(); m_struct.Address = sd.Address; m_struct.HasSign = sd.HasSign; m_struct.Memory = sd.MemoryType; m_struct.Name = sd.Name; m_struct.Size = sd.Size; foreach (DebuggerParameters.VarDescription vd in sd.Vars) { m_var = new ControllerUserVar(); m_var.Address = vd.Address; m_var.HasSign = vd.HasSign; m_var.Array = false; m_var.Memory = vd.MemoryType; m_var.Name = vd.Name; m_var.Size = vd.Size; m_struct.Vars.Add(m_var); } AddStructurToTable(m_struct); } FillCheckedList(); //Выбор структур для опроса List <DebuggerParameters.StructDescription> readStructs = new List <DebuggerParameters.StructDescription>(_engine.Parameters.ReadingStructs); _engine.Parameters.ReadingStructs = new List <DebuggerParameters.StructDescription>(); for (int i = 0; i < this.clb_structurs.Items.Count; i++) { foreach (DebuggerParameters.StructDescription sd in readStructs) { if (this.clb_structurs.Items[i].ToString() == sd.Name) { //this.clb_structurs_ItemCheck(this.clb_structurs, new ItemCheckEventArgs(i, System.Windows.Forms.CheckState.Checked, System.Windows.Forms.CheckState.Unchecked)); this.clb_structurs.SetItemCheckState(i, CheckState.Checked); } } } }
public IDebuggedProcessExecutor CreateNativeDebuggingExecutor(DebuggerEngine engine, bool printTestOutput, ILogger logger) { throw new NotImplementedException(); }
protected DebuggerEngine debuggerEngine = null; // движок отладчика, который обслуживает компонент /// <summary> /// Обновляет данные, отображаемые документом на основани передаваемого проекта /// </summary> public virtual void Update(ControllerProgramSolution solution, DebuggerEngine engine) { //throw new Exception("Метод DebuggerTabbedDocument.Update() надо перегрузить в потомке"); }
public void OnFileOpen(DebuggerEngine Engine, string Name) { Invoke(OnFileOpenMethod, new object[] { Engine, Name }); }
public DebuggerTabbedDocument(ControllerProgramSolution solution, DebuggerEngine Engine) : base(solution) { this.codingType = MainForm.MainFormInstance.Hex ? 16 : 10; this.debuggerEngine = Engine; }
public void OnBreakpoint(DebuggerEngine Engine, uint Address) { Invoke(OnBreakpointMethod, new object[] { Engine, Address }); }