Отладчик: Окно "Локальные переменные"
This commit is contained in:
parent
3275eb311c
commit
dbffb4ba80
|
|
@ -546,7 +546,8 @@ namespace VisualPascalABC
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private delegate void EndDebuggerSessionDelegate();
|
||||||
|
|
||||||
public void EndDebuggerSession()
|
public void EndDebuggerSession()
|
||||||
{
|
{
|
||||||
|
|
@ -596,9 +597,10 @@ namespace VisualPascalABC
|
||||||
monoDebuggerSession = new Mono.Debugging.Soft.SoftDebuggerSession();
|
monoDebuggerSession = new Mono.Debugging.Soft.SoftDebuggerSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void Process_Exited(object sender, EventArgs e)
|
private void Process_Exited(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
EndDebuggerSession();
|
VisualPABCSingleton.MainForm.Invoke(new EndDebuggerSessionDelegate(EndDebuggerSession));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -613,6 +615,7 @@ namespace VisualPascalABC
|
||||||
stackFrame = e.Thread.Backtrace.GetFrame(0);
|
stackFrame = e.Thread.Backtrace.GetFrame(0);
|
||||||
JumpToCurrentLine();
|
JumpToCurrentLine();
|
||||||
workbench.WidgetController.SetStartDebugEnabled();
|
workbench.WidgetController.SetStartDebugEnabled();
|
||||||
|
WorkbenchServiceFactory.DebuggerOperationsService.RefreshPad(new FunctionItem(stackFrame).SubItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MonoDebuggerSession_TargetStarted(object sender, EventArgs e)
|
private void MonoDebuggerSession_TargetStarted(object sender, EventArgs e)
|
||||||
|
|
|
||||||
|
|
@ -141,34 +141,17 @@ namespace VisualPascalABC
|
||||||
|
|
||||||
public class ModuleItem : ListItem
|
public class ModuleItem : ListItem
|
||||||
{
|
{
|
||||||
private NamedValue val;
|
|
||||||
private string ns_name;
|
|
||||||
private Function func;
|
private Function func;
|
||||||
private List<DebugType> types;
|
private List<DebugType> types;
|
||||||
|
private Mono.Debugging.Client.StackFrame frame;
|
||||||
/*public ModuleItem(NamedValue val, Function func)
|
private List<Mono.Debugging.Evaluation.TypeValueReference> monoTypes;
|
||||||
|
|
||||||
|
public ModuleItem(List<Mono.Debugging.Evaluation.TypeValueReference> monoTypes, Mono.Debugging.Client.StackFrame frame)
|
||||||
{
|
{
|
||||||
this.val = val;
|
this.monoTypes = monoTypes;
|
||||||
ns_name = val.Type.FullName.Substring(0, val.Type.FullName.LastIndexOf('.'));
|
this.frame = frame;
|
||||||
this.func = func;
|
|
||||||
this.func.Process.DebuggeeStateChanged += delegate
|
|
||||||
{
|
|
||||||
this.OnChanged(new ListItemEventArgs(this));
|
|
||||||
};
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public ModuleItem(List<DebugType> types, Function func)
|
|
||||||
{
|
|
||||||
//this.val = val;
|
|
||||||
//ns_name = val.Type.FullName.Substring(0, val.Type.FullName.LastIndexOf('.'));
|
|
||||||
this.types = types;
|
|
||||||
this.func = func;
|
|
||||||
this.func.Process.DebuggeeStateChanged += delegate
|
|
||||||
{
|
|
||||||
this.OnChanged(new ListItemEventArgs(this));
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int ImageIndex
|
public override int ImageIndex
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -228,12 +211,12 @@ namespace VisualPascalABC
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
List<IListItem> ret = new List<IListItem>();
|
List<IListItem> ret = new List<IListItem>();
|
||||||
foreach (DebugType dt in types)
|
foreach (var tr in monoTypes)
|
||||||
{
|
{
|
||||||
//IList<FieldInfo> fis = val.Type.GetFields(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
|
var fields = tr.GetChildReferences(Mono.Debugging.Client.EvaluationOptions.DefaultOptions);
|
||||||
IList<FieldInfo> fis = dt.GetFields(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
|
foreach (var fi in fields)
|
||||||
foreach (FieldInfo fi in fis)
|
if (!fi.Name.Contains("$"))
|
||||||
if (!fi.Name.Contains("$")) ret.Add(new ValueItem(fi.GetValue(null),fi.DeclaringType));
|
ret.Add(new ValueItem(fi.CreateObjectValue(false, Mono.Debugging.Client.EvaluationOptions.DefaultOptions)));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -242,15 +225,8 @@ namespace VisualPascalABC
|
||||||
|
|
||||||
public class FunctionItem : ListItem
|
public class FunctionItem : ListItem
|
||||||
{
|
{
|
||||||
Function function;
|
Mono.Debugging.Client.StackFrame frame;
|
||||||
|
|
||||||
public Function Function
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return function;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool IsLiteral
|
public override bool IsLiteral
|
||||||
{
|
{
|
||||||
|
|
@ -271,7 +247,7 @@ namespace VisualPascalABC
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return function.Name;
|
return frame.SourceLocation.MethodName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -314,45 +290,42 @@ namespace VisualPascalABC
|
||||||
{
|
{
|
||||||
List<IListItem> ret = new List<IListItem>();
|
List<IListItem> ret = new List<IListItem>();
|
||||||
Hashtable ht = new Hashtable(StringComparer.CurrentCultureIgnoreCase);
|
Hashtable ht = new Hashtable(StringComparer.CurrentCultureIgnoreCase);
|
||||||
foreach (NamedValue val in function.LocalVariables)
|
foreach (var val in frame.GetAllLocals())
|
||||||
{
|
{
|
||||||
if (val.Name.Contains("$class_var") /*&& !val.Type.FullName.Contains("$")*/)
|
if (val.Name.Contains("$class_var"))
|
||||||
{
|
{
|
||||||
//IList<FieldInfo> fis = val.Type.GetFields(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
|
List<Mono.Debugging.Evaluation.TypeValueReference> types = new List<Mono.Debugging.Evaluation.TypeValueReference>();
|
||||||
//if (fis.Count != 0)
|
|
||||||
List<DebugType> types = new List<DebugType>();
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (val.Type.FullName.Contains(PascalABCCompiler.TreeConverter.compiler_string_consts.ImplementationSectionNamespaceName))
|
if (val.TypeName.Contains(PascalABCCompiler.TreeConverter.compiler_string_consts.ImplementationSectionNamespaceName))
|
||||||
{
|
{
|
||||||
string interf_name = val.Type.FullName.Substring(0, val.Type.FullName.IndexOf(PascalABCCompiler.TreeConverter.compiler_string_consts.ImplementationSectionNamespaceName));
|
string interf_name = val.TypeName.Substring(0, val.TypeName.IndexOf(PascalABCCompiler.TreeConverter.compiler_string_consts.ImplementationSectionNamespaceName));
|
||||||
Type t = AssemblyHelper.GetTypeForStatic(interf_name);
|
Type t = AssemblyHelper.GetTypeForStatic(interf_name);
|
||||||
DebugType dt = DebugUtils.GetDebugType(t);
|
var tr = new Mono.Debugging.Evaluation.TypeValueReference(frame.SourceBacktrace.GetEvaluationContext(frame.Index, Mono.Debugging.Client.EvaluationOptions.DefaultOptions),
|
||||||
types.Add(dt);
|
(frame.DebuggerSession as Mono.Debugging.Soft.SoftDebuggerSession).GetType(t.FullName));
|
||||||
|
types.Add(tr);
|
||||||
}
|
}
|
||||||
types.Add(val.Type);
|
var valtr = new Mono.Debugging.Evaluation.TypeValueReference(frame.SourceBacktrace.GetEvaluationContext(frame.Index, Mono.Debugging.Client.EvaluationOptions.DefaultOptions),
|
||||||
|
(frame.DebuggerSession as Mono.Debugging.Soft.SoftDebuggerSession).GetType(val.TypeName));
|
||||||
|
types.Add(valtr);
|
||||||
}
|
}
|
||||||
catch (System.Exception e)
|
catch (System.Exception e)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine(e.Message + " " + e.StackTrace);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret.Add(new ModuleItem(types, function));
|
ret.Add(new ModuleItem(types, frame));
|
||||||
//foreach (FieldInfo fi in fis)
|
|
||||||
// if (!fi.Name.Contains("$")) ret.Add(new ValueItem(fi.GetValue(val)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (NamedValue val in function.LocalVariables)
|
foreach (var val in frame.GetAllLocals())
|
||||||
{
|
{
|
||||||
//if (val.IsObject)
|
|
||||||
|
|
||||||
if (!val.Name.Contains("$"))
|
if (!val.Name.Contains("$"))
|
||||||
ret.Add(new ValueItem(val,null));
|
ret.Add(new ValueItem(val));
|
||||||
else if (val.Name.Contains("$rv"))
|
else if (val.Name.Contains("$rv"))
|
||||||
{
|
{
|
||||||
ret.Add(new ValueItem(val,null));
|
ret.Add(new ValueItem(val));
|
||||||
}
|
}
|
||||||
else if (val.Name == "$disp$")
|
/*else if (val.Name == "$disp$")
|
||||||
{
|
{
|
||||||
IList<FieldInfo> fields = val.Type.GetFields(BindingFlags.All);
|
IList<FieldInfo> fields = val.Type.GetFields(BindingFlags.All);
|
||||||
foreach (FieldInfo fi in fields)
|
foreach (FieldInfo fi in fields)
|
||||||
|
|
@ -361,15 +334,15 @@ namespace VisualPascalABC
|
||||||
ret.Add(new ValueItem(fi.GetValue(val),fi.DeclaringType));
|
ret.Add(new ValueItem(fi.GetValue(val),fi.DeclaringType));
|
||||||
ht[fi.Name] = fi.Name;
|
ht[fi.Name] = fi.Name;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
NamedValue self_nv = null;
|
Mono.Debugging.Client.ObjectValue self_nv = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
foreach (NamedValue val in function.Arguments)
|
foreach (var val in frame.GetParameters())
|
||||||
{
|
{
|
||||||
if (!val.Name.Contains("$") && !ht.ContainsKey(val.Name))
|
if (!val.Name.Contains("$") && !ht.ContainsKey(val.Name))
|
||||||
ret.Add(new ValueItem(val, null));
|
ret.Add(new ValueItem(val));
|
||||||
else if (val.Name == "$obj$")
|
else if (val.Name == "$obj$")
|
||||||
self_nv = val;
|
self_nv = val;
|
||||||
}
|
}
|
||||||
|
|
@ -377,26 +350,17 @@ namespace VisualPascalABC
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
if (!function.IsStatic) ret.Add(new ValueItem(function.ThisValue,null));
|
if (frame.GetThisReference() != null)
|
||||||
|
ret.Add(new ValueItem(frame.GetThisReference()));
|
||||||
else if (self_nv != null)
|
else if (self_nv != null)
|
||||||
ret.Add(new ValueItem(self_nv,"self",null));
|
ret.Add(new ValueItem(self_nv));
|
||||||
|
|
||||||
/*foreach (NamedValue val in function.ContaingClassVariables)
|
|
||||||
{
|
|
||||||
if (!val.Name.Contains("$"))
|
|
||||||
ret.Add(new ValueItem(val));
|
|
||||||
}*/
|
|
||||||
return ret.AsReadOnly();
|
return ret.AsReadOnly();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public FunctionItem(Function function)
|
public FunctionItem(Mono.Debugging.Client.StackFrame frame)
|
||||||
{
|
{
|
||||||
this.function = function;
|
this.frame = frame;
|
||||||
this.function.Process.DebuggeeStateChanged += delegate
|
|
||||||
{
|
|
||||||
this.OnChanged(new ListItemEventArgs(this));
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -489,7 +489,7 @@ namespace AdvancedDataGridView
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
DateTime start = Debugger.Util.HighPrecisionTimer.Now;
|
//DateTime start = Debugger.Util.HighPrecisionTimer.Now;
|
||||||
updated = false;
|
updated = false;
|
||||||
//this.HasChildren = Content.HasSubItems;
|
//this.HasChildren = Content.HasSubItems;
|
||||||
//this._image = content.Image;
|
//this._image = content.Image;
|
||||||
|
|
@ -513,7 +513,7 @@ namespace AdvancedDataGridView
|
||||||
if (this.Cells[2].Value == null)
|
if (this.Cells[2].Value == null)
|
||||||
this.Cells[2].Value = this.type;
|
this.Cells[2].Value = this.type;
|
||||||
//this.Cells[2].Value = this.type;
|
//this.Cells[2].Value = this.type;
|
||||||
DateTime end = Debugger.Util.HighPrecisionTimer.Now;
|
//DateTime end = Debugger.Util.HighPrecisionTimer.Now;
|
||||||
|
|
||||||
//LoggingService.InfoFormatted("Updated node {0} ({1} ms)", FullName, (end - start).TotalMilliseconds);
|
//LoggingService.InfoFormatted("Updated node {0} ({1} ms)", FullName, (end - start).TotalMilliseconds);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -633,11 +633,9 @@ namespace VisualPascalABC
|
||||||
private bool watch_vis = false;
|
private bool watch_vis = false;
|
||||||
public void SetDebugTabsVisible(bool flag)
|
public void SetDebugTabsVisible(bool flag)
|
||||||
{
|
{
|
||||||
if (DebugWatchListWindow == null)
|
|
||||||
return;
|
|
||||||
if (flag)
|
if (flag)
|
||||||
{
|
{
|
||||||
if (!DebugWatchListWindow.IsHidden)
|
if (DebugWatchListWindow != null && !DebugWatchListWindow.IsHidden)
|
||||||
{
|
{
|
||||||
watch_vis = true;
|
watch_vis = true;
|
||||||
}
|
}
|
||||||
|
|
@ -645,14 +643,15 @@ namespace VisualPascalABC
|
||||||
{
|
{
|
||||||
if (!BottomTabsVisible)
|
if (!BottomTabsVisible)
|
||||||
BottomTabsVisible = true;
|
BottomTabsVisible = true;
|
||||||
ShowContent(DebugWatchListWindow, false);
|
if (DebugWatchListWindow != null)
|
||||||
|
ShowContent(DebugWatchListWindow, false);
|
||||||
ShowContent(DebugVariablesListWindow, false);
|
ShowContent(DebugVariablesListWindow, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//HideContent(DebugWatchListWindow);
|
//HideContent(DebugWatchListWindow);
|
||||||
if (!watch_vis)
|
if (!watch_vis && DebugWatchListWindow != null)
|
||||||
{
|
{
|
||||||
HideContent(DebugWatchListWindow);
|
HideContent(DebugWatchListWindow);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -341,9 +341,10 @@ namespace VisualPascalABC
|
||||||
AddDisassemblyWindow(); // Это нельзя убирать - почему то оболочка закрывается при запуске программы!!!
|
AddDisassemblyWindow(); // Это нельзя убирать - почему то оболочка закрывается при запуске программы!!!
|
||||||
HideContent(FindSymbolsResultWindow);
|
HideContent(FindSymbolsResultWindow);
|
||||||
HideContent(DisassemblyWindow);
|
HideContent(DisassemblyWindow);
|
||||||
|
AddDebugVariablesListWindow();
|
||||||
|
HideContent(DebugVariablesListWindow);
|
||||||
/*AddImmediateWindow();
|
/*AddImmediateWindow();
|
||||||
//AddDebugVariablesListWindow();
|
|
||||||
//AddDebugWatchListWindow();
|
//AddDebugWatchListWindow();
|
||||||
if (!Tools.IsUnix())
|
if (!Tools.IsUnix())
|
||||||
{
|
{
|
||||||
|
|
@ -355,7 +356,7 @@ namespace VisualPascalABC
|
||||||
// SelectContent(ProjectExplorerWindow, false);
|
// SelectContent(ProjectExplorerWindow, false);
|
||||||
|
|
||||||
//HideContent(ImmediateWindow);
|
//HideContent(ImmediateWindow);
|
||||||
//HideContent(DebugVariablesListWindow);
|
|
||||||
//HideContent(DebugWatchListWindow);
|
//HideContent(DebugWatchListWindow);
|
||||||
|
|
||||||
if (!Tools.IsUnix())
|
if (!Tools.IsUnix())
|
||||||
|
|
@ -685,19 +686,27 @@ namespace VisualPascalABC
|
||||||
DebugVariablesListWindow.ClearAllSubTrees();
|
DebugVariablesListWindow.ClearAllSubTrees();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RefreshPad(IList<IListItem> items)
|
private delegate void RefreshPadDelegate(IList<IListItem> items);
|
||||||
|
|
||||||
|
private void RefreshPadInvoke(IList<IListItem> items)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DebugWatchListWindow.RefreshWatch();
|
if (DebugWatchListWindow != null)
|
||||||
|
DebugWatchListWindow.RefreshWatch();
|
||||||
AdvancedDataGridView.TreeGridNode.UpdateNodesForLocalList(DebugVariablesListWindow.watchList, DebugVariablesListWindow.watchList.Nodes, items);
|
AdvancedDataGridView.TreeGridNode.UpdateNodesForLocalList(DebugVariablesListWindow.watchList, DebugVariablesListWindow.watchList.Nodes, items);
|
||||||
}
|
}
|
||||||
catch (System.Exception)
|
catch (System.Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine(ex.Message + " " + ex.StackTrace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RefreshPad(IList<IListItem> items)
|
||||||
|
{
|
||||||
|
Invoke(new RefreshPadDelegate(RefreshPadInvoke), items);
|
||||||
|
}
|
||||||
|
|
||||||
public void GotoWatch()
|
public void GotoWatch()
|
||||||
{
|
{
|
||||||
BottomTabsVisible = true;
|
BottomTabsVisible = true;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue