Исправления в Linux-отладчике (исправил зависания в JumpToCurrentLine выносом кода в Control.Invoke)

This commit is contained in:
Ivan Bondarev 2023-06-07 21:21:05 +02:00
parent d4f154bf57
commit 512d4c2de5
2 changed files with 35 additions and 6 deletions

View file

@ -978,13 +978,32 @@ namespace VisualPascalABC
private Mono.Debugging.Client.SourceLocation stepin_stmt = null;
private bool tab_changed=false;
private delegate void JumpToLineDelegate(int line);
private delegate void JumpToLinePreActionsDelegate();
private delegate void SetCurrentLineBookmarkDelegate(string fileName, IDocument document, int makerStartLine, int makerStartColumn, int makerEndLine, int makerEndColumn);
void JumpToLineInvoke(int line)
{
curPage.TextEditor.ActiveTextAreaControl.JumpTo(line, 0);
}
void JumpToLinePreActionsInvoke()
{
workbench.MainForm.Activate();
CurrentLineBookmark.Remove();//udalajem zheltyj kursor otladki
}
void SetCurrentLineBookmarkInvoke(string fileName, IDocument document, int makerStartLine, int makerStartColumn, int makerEndLine, int makerEndColumn)
{
CurrentLineBookmark.SetPosition(fileName, document, makerStartLine, makerStartColumn, makerEndLine, makerEndColumn);
}
/// <summary>
/// Перейти к следующей строке при отладке
/// </summary>
private void JumpToCurrentLine(bool fromBreakpoint = false)
{
workbench.MainForm.Activate();
CurrentLineBookmark.Remove();//udalajem zheltyj kursor otladki
workbench.MainForm.Invoke(new JumpToLinePreActionsDelegate(JumpToLinePreActionsInvoke));
//System.Threading.Thread.Sleep(70);
if (stackFrame != null)
{
@ -1030,6 +1049,7 @@ namespace VisualPascalABC
{
tab_changed = true;
curPage = WorkbenchServiceFactory.FileService.OpenFileForDebug(stackFrame.SourceLocation.FileName);
if (curPage == null)
{
MustDebug = true;
@ -1112,10 +1132,12 @@ namespace VisualPascalABC
}
}
}
//for (int i=0; i<lseg.Words.Count; i++)
CurrentLineBookmark.SetPosition(stackFrame.SourceLocation.FileName, curPage.TextEditor.Document, stackFrame.SourceLocation.Line, 1, stackFrame.SourceLocation.Line,
//CurrentLineBookmark.SetPosition(stackFrame.SourceLocation.FileName, curPage.TextEditor.Document, stackFrame.SourceLocation.Line, 1, stackFrame.SourceLocation.Line,
// len);
curPage.TextEditor.ActiveTextAreaControl.Invoke(new JumpToLineDelegate(JumpToLineInvoke), stackFrame.SourceLocation.Line - 1);
curPage.TextEditor.ActiveTextAreaControl.Invoke(new SetCurrentLineBookmarkDelegate(SetCurrentLineBookmarkInvoke), stackFrame.SourceLocation.FileName, curPage.TextEditor.Document, stackFrame.SourceLocation.Line, 1, stackFrame.SourceLocation.Line,
len);
//curPage.TextEditor.ActiveTextAreaControl.JumpTo(stackFrame.SourceLocation.Line - 1, 0);
if ((Status == DebugStatus.StepOver || Status == DebugStatus.StepIn) && (CurrentLine == stackFrame.SourceLocation.Line
&& save_PrevFullFileName == stackFrame.SourceLocation.FileName))

View file

@ -148,7 +148,14 @@ namespace VisualPascalABC
CurrentCodeFileDocument.AddDesigner(null);
}
public CodeFileDocumentControl OpenFileForDebug(string FileName)
public delegate CodeFileDocumentControl OpenFileForDebugDelegate(string FileName);
public ICodeFileDocument OpenFileForDebug(string FileName)
{
return this.Invoke(new OpenFileForDebugDelegate(OpenFileForDebugInvoke), FileName) as ICodeFileDocument;
}
public CodeFileDocumentControl OpenFileForDebugInvoke(string FileName)
{
CodeFileDocumentControl tp = FindTab(FileName);
bool IsNewFile = FileName == null;