Исправил зависание в отладчике (в иксах зависало установка Caret, убрал)

This commit is contained in:
Ivan Bondarev 2023-05-29 12:29:09 +02:00
parent 15be317baa
commit da40c3989f
5 changed files with 64 additions and 22 deletions

View file

@ -990,7 +990,7 @@ namespace VisualPascalABC
{
//debuggedProcess.Modules[0].SymReader.GetMethod(debuggedProcess.SelectedFunction.Token);
string save_PrevFullFileName = PrevFullFileName;
Console.WriteLine(stackFrame.SourceLocation.FileName + ":" + stackFrame.SourceLocation.Line);
Console.WriteLine("jump to "+stackFrame.SourceLocation.FileName + ":" + stackFrame.SourceLocation.Line);
//CodeFileDocumentControl page = null;
//DebuggerService.JumpToCurrentLine(nextStatement.SourceFullFilename, nextStatement.StartLine, nextStatement.StartColumn, nextStatement.EndLine, nextStatement.EndColumn);
if (!ShowDebugTabs)//esli eshe ne pokazany watch i lokal, pokazyvaem
@ -1115,8 +1115,8 @@ 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,
len);
curPage.TextEditor.ActiveTextAreaControl.JumpTo(stackFrame.SourceLocation.Line - 1, 0);
//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))
{
@ -1135,14 +1135,14 @@ namespace VisualPascalABC
CurrentLine = stackFrame.SourceLocation.Line;
MustDebug = false;
}
Console.WriteLine("jumped to " + stackFrame.SourceLocation.FileName + ":" + stackFrame.SourceLocation.Line);
RemoveBreakpoints();
if (currentBreakpoint != null)
{
dbg.RemoveBreakpoint(currentBreakpoint);
currentBreakpoint = null; //RemoveBreakpoints();
}
Console.WriteLine("breakpoints removed");
}
}
@ -1488,7 +1488,27 @@ namespace VisualPascalABC
parent_val = pv;
}
}
if (self_lv != null)
{
var fields = self_lv.GetAllChildren();
foreach (var fi in fields)
if (string.Compare(fi.Name, var, true) == 0)
return new ValueItem(fi);
}
if (global_lv != null)
{
var fields = self_lv.GetAllChildren();
foreach (var fi in fields)
if (string.Compare(fi.Name, var, true) == 0)
return new ValueItem(fi);
Type global_type = AssemblyHelper.GetType(global_lv.TypeName);
if (global_type != null)
{
var fi = global_type.GetField(var, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.IgnoreCase);
if (fi != null && fi.IsLiteral)
return new ValueItem(DebugUtils.MakeValue(fi.GetRawConstantValue()), var, global_nv.Type);
}
}
nvc = debuggedProcess.SelectedFunction.LocalVariables;
@ -1761,6 +1781,7 @@ namespace VisualPascalABC
CloseOldToolTip();
if (toolTipControl != null)
{
toolTipControl.ShowForm(textArea, e.LogicalPosition);
}
oldToolTipControl = toolTipControl;

View file

@ -292,11 +292,15 @@ namespace VisualPascalABC
frm.Controls.Add(this);
frm.ShowWindowWithoutActivation = true;
frm.Show();
frm.GotFocus += (s, e) => {
textArea.Focus();
};
textArea.Click += OnTextAreaClick;
textArea.KeyDown += OnTextAreaClick;
frm.ClientSize = new Size(frm.ClientSize.Width, row.Height + 2);
}
public bool IsMouseOver
{
get
@ -314,6 +318,7 @@ namespace VisualPascalABC
((ICSharpCode.TextEditor.TextArea)sender).KeyDown -= OnTextAreaClick;
((ICSharpCode.TextEditor.TextArea)sender).Click -= OnTextAreaClick;
frm.Close();
this.isExpanded = false;
}
bool isExpanded;
@ -817,6 +822,7 @@ namespace VisualPascalABC
void CloseOnDeactivate()
{
return;
ChildForm owner = Owner as ChildForm;
if (owner != null)
{

View file

@ -669,7 +669,7 @@ namespace VisualPascalABC
get
{
return monoValue.DisplayValue;
if (ShowValuesInHexadecimal && val.IsInteger)
/*if (ShowValuesInHexadecimal && val.IsInteger)
{
return String.Format("0x{0:X}", val.PrimitiveValue);
}
@ -760,7 +760,7 @@ namespace VisualPascalABC
{
return "";
}
}
}*/
}
}
@ -838,25 +838,28 @@ namespace VisualPascalABC
{
get
{
List<IListItem> list = new List<IListItem>();
if (val.IsArray)
if (monoValue.IsObject)
{
foreach (NamedValue element in val.GetArrayElements())
foreach (var element in monoValue.GetAllChildren())
{
list.Add(new ValueItem(element,null));
list.Add(new ValueItem(element));
}
return list;
}
if (val.IsObject || val.Type.IsByRef() && !val.IsPrimitive)
/*if (monoValue.IsObject || !monoValue.IsPrimitive)
{
//if (IsArrayWrap())
//{
NamedValue nv = GetNullBasedArray();
if (nv != null)
var lv = GetNullBasedArray();
if (lv != null)
{
int i = 0;
foreach (NamedValue element in nv.GetArrayElements())
foreach (var element in lv.GetAllChildren())
{
list.Add(new ArrayValueItem(element, null, val, nv, i++));
list.Add(new ArrayValueItem(element, monoValue, lv, i++));
}
}
@ -866,17 +869,19 @@ namespace VisualPascalABC
if (!val.Type.IsByRef())
return new BaseTypeItem(val, val.Type).SubItems;
}
}
}*/
return list;
}
}
private NamedValue GetNullBasedArray()
private Mono.Debugging.Client.ObjectValue GetNullBasedArray()
{
IList<FieldInfo> flds = val.Type.GetFields();
if (flds.Count != 3) return null;
foreach (FieldInfo fi in flds)
if (fi.Name == "NullBasedArray") return fi.GetValue(val);
var fields = monoValue.GetAllChildren();
if (fields.Length != 3)
return null;
foreach (var fi in fields)
if (fi.Name == "NullBasedArray")
return fi;
return null;
}
@ -996,6 +1001,11 @@ namespace VisualPascalABC
low_bound = tmp_fi.GetValue(sz_arr);
}
public ArrayValueItem(Mono.Debugging.Client.ObjectValue val, Mono.Debugging.Client.ObjectValue arr, Mono.Debugging.Client.ObjectValue sz_arr, int ind)
{
}
public override string Name
{
get

View file

@ -719,6 +719,7 @@ namespace AdvancedDataGridView
}
catch (System.Exception e)
{
Console.WriteLine(e.Message + " " + e.StackTrace);
}
}

View file

@ -1703,6 +1703,7 @@ namespace Mono.Debugging.Soft
void Step (StepDepth depth, StepSize size)
{
try {
//Console.WriteLine("Adaptor.CancelAsyncOperations");
Adaptor.CancelAsyncOperations (); // This call can block, so it has to run in background thread to avoid keeping the main session lock
var req = vm.CreateStepRequest (current_thread);
req.Depth = depth;
@ -1719,8 +1720,11 @@ namespace Mono.Debugging.Soft
throw e;
}
currentStepRequest = req;
//Console.WriteLine("OnResumed");
OnResumed ();
//Console.WriteLine("vm.Resume");
vm.Resume ();
//Console.WriteLine("DequeueEventsForFirstThread");
DequeueEventsForFirstThread ();
} catch (CommandException ex) {
string reason;