public LimnorDebugger(string project, string component) { _componentFile = component; _projectFile = project; bool fileFound = System.IO.File.Exists(_componentFile); if (fileFound) { _doc = new XmlDocument(); _doc.Load(_componentFile); _projectFile = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(_componentFile), System.IO.Path.GetFileName(_projectFile)); _projectFile = _projectFile.ToLowerInvariant(); if (!_debuggerList.TryGetValue(_projectFile, out _debugUI)) { _debugUI = null; System.Threading.Thread th = new System.Threading.Thread(showDebugWindow); th.SetApartmentState(System.Threading.ApartmentState.STA); th.Start(); while (_debugUI == null) { Application.DoEvents(); } _debugUI.MainThreadId = System.Threading.Thread.CurrentThread.ManagedThreadId; _debuggerList.Add(_projectFile, _debugUI); while (!_debugUI.FormReady) { Application.DoEvents(); } } _ComponentDebugger = _debugUI.AddTab(this); } }
/// <summary> /// break at the first event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btPause_Click(object sender, EventArgs e) { DebugCommandStatus = EnumRunStatus.Pause; UserControlDebugger c = CurrentComponentUI; if (c != null) { c.SetRunStatus(c.CurrentThreadId, EnumRunStatus.Pause); } }
private void addNewTabPage(LimnorDebugger debugger) { UserControlDebugger c = new UserControlDebugger(debugger); TabPage p = new TabPage(); p.Text = debugger.ComponentName; p.Name = debugger.Key; c.Dock = DockStyle.Fill; p.Controls.Add(c); tabControl1.TabPages.Add(p); }
private void btStepOut_Click(object sender, EventArgs e) { DebugCommandStatus = EnumRunStatus.StepOut; UserControlDebugger c = CurrentComponentUI; if (c != null) { c.SetRunStatus(c.CurrentThreadId, EnumRunStatus.StepOut); c.SetAtBreak(c.CurrentThreadId, false); } }
public UserControlDebugger AddTab(LimnorDebugger debugger) { UserControlDebugger c = GetComponentDebugger(debugger); if (c == null) { this.Invoke(miAddNewTab, debugger); TabPage p = tabControl1.TabPages[debugger.Key]; c = p.Controls[0] as UserControlDebugger; } return(c); }
private UserControlDebugger GetComponentDebugger(LimnorDebugger debugger) { for (int i = 0; i < tabControl1.TabPages.Count; i++) { for (int j = 0; j < tabControl1.TabPages[i].Controls.Count; j++) { UserControlDebugger c = tabControl1.TabPages[i].Controls[j] as UserControlDebugger; if (c != null) { if (c.ComponentFile == debugger.ComponentFile) { return(c); } } } } return(null); }
public void ShowBreakPoint(UserControlDebugger uc) { for (int i = 0; i < tabControl1.TabPages.Count; i++) { for (int j = 0; j < tabControl1.TabPages[i].Controls.Count; j++) { UserControlDebugger c = tabControl1.TabPages[i].Controls[j] as UserControlDebugger; if (c != null) { if (c.ComponentFile == uc.ComponentFile) { this.Invoke(miSetTabIndex, i); return; } } } } }
// private void exitDebug() { DebugCommandStatus = EnumRunStatus.Stop; btStop.Enabled = false; _stopping = true; setButtonImages(); for (int i = 0; i < tabControl1.TabPages.Count; i++) { for (int j = 0; j < tabControl1.TabPages[i].Controls.Count; j++) { UserControlDebugger c = tabControl1.TabPages[i].Controls[j] as UserControlDebugger; if (c != null) { c.Stop(); } } } if (_prj.ProjectType == EnumProjectType.Kiosk) { LKiosk.Exitkiosk(); } tmStop.Enabled = true; }
private void tmStop_Tick(object sender, EventArgs e) { tmStop.Enabled = false; bool b = false; Application.DoEvents(); System.Threading.Thread.Sleep(0); Application.DoEvents(); for (int i = 0; i < tabControl1.TabPages.Count; i++) { for (int j = 0; j < tabControl1.TabPages[i].Controls.Count; j++) { UserControlDebugger c = tabControl1.TabPages[i].Controls[j] as UserControlDebugger; if (c != null) { if (c.IsWaitingAtBreakPoint) { b = true; break; } } } if (b) { break; } } if (b) { tmStop.Enabled = true; } else { Application.Exit(); } }
private void setButtonImages0() { if (_stopping) { disableAll(); } else { bool atBreak; int level; EnumRunStatus status; UserControlDebugger c = CurrentComponentUI; if (c != null) { if (c.CurrentViewerFinished) { status = EnumRunStatus.Finished; atBreak = false; level = 0; } else { atBreak = c.GetAtBreak(c.CurrentThreadId); level = c.GetCallStackLevel(c.CurrentThreadId); status = c.GetRunStatus(c.CurrentThreadId); } } else { atBreak = false; level = 0; status = EnumRunStatus.Run; } if (status == EnumRunStatus.Finished) { disableAll(); } else { if (atBreak) { btRun.Image = imageList1.Images[IMG_Run]; btRun.Enabled = true; btPause.Image = imageList1.Images[IMG_Pause2]; btPause.Enabled = false; btStepInto.Image = imageList1.Images[IMG_StepInto]; btStepInto.Enabled = true; btStepOver.Image = imageList1.Images[IMG_StepOver]; btStepOver.Enabled = true; if (level > 0) { btStepOut.Image = imageList1.Images[IMG_StepOut]; btStepOut.Enabled = true; } else { btStepOut.Image = imageList1.Images[IMG_StepOut2]; btStepOut.Enabled = false; } } else { btRun.Image = imageList1.Images[IMG_Run2]; btRun.Enabled = false; btPause.Image = imageList1.Images[IMG_Pause]; btPause.Enabled = true; btStepInto.Image = imageList1.Images[IMG_StepInto2]; btStepInto.Enabled = false; btStepOver.Image = imageList1.Images[IMG_StepOver2]; btStepOver.Enabled = false; btStepOut.Image = imageList1.Images[IMG_StepOut2]; btStepOut.Enabled = false; } } btStop.Image = imageList1.Images[IMG_Stop]; btStop.Enabled = true; } }