Skip to content

Commit

Permalink
Merge branch 'pascalabcnet:master' into test
Browse files Browse the repository at this point in the history
  • Loading branch information
spectatorBH authored Oct 9, 2023
2 parents ba8f785 + 67b3d3a commit 587d5ff
Show file tree
Hide file tree
Showing 18 changed files with 362 additions and 170 deletions.
2 changes: 1 addition & 1 deletion Configuration/GlobalAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ internal static class RevisionClass
public const string Major = "3";
public const string Minor = "9";
public const string Build = "0";
public const string Revision = "3363";
public const string Revision = "3364";

public const string MainVersion = Major + "." + Minor;
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
Expand Down
4 changes: 2 additions & 2 deletions Configuration/Version.defs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%MINOR%=9
%REVISION%=3363
%COREVERSION%=0
%REVISION%=3364
%MINOR%=9
%MAJOR%=3
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,36 @@ public Font DefaultFont {
set {
// 1440 twips is one inch
int pixelSize = (int)(value.SizeInPoints * 20 / TwipsPerPixelY);
defaultFont = value;

/*defaultFont = value;
regularfont = new Font(value.FontFamily, pixelSize * TwipsPerPixelY / 20f, FontStyle.Regular);
boldfont = new Font(regularfont, FontStyle.Bold);
italicfont = new Font(regularfont, FontStyle.Italic);
bolditalicfont = new Font(regularfont, FontStyle.Bold | FontStyle.Italic);*/
defaultFont = value;

FontFamily validFontFamily = value.FontFamily;

foreach (FontFamily ff in FontFamily.Families)
{
if (ff.Name == value.FontFamily.Name)
{
validFontFamily = ff;
//находим первый подходящий fontFaFontFamily
break;
}
}

if (regularfont != null) regularfont.Dispose();
regularfont = new Font(validFontFamily, pixelSize * TwipsPerPixelY / 20f, FontStyle.Regular);

if (boldfont != null) boldfont.Dispose();
boldfont = new Font(regularfont, FontStyle.Bold);

if (italicfont != null) italicfont.Dispose();
italicfont = new Font(regularfont, FontStyle.Italic);

if (bolditalicfont != null) bolditalicfont.Dispose();
bolditalicfont = new Font(regularfont, FontStyle.Bold | FontStyle.Italic);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Release/pabcversion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.9.0.3363
3.9.0.3364
2 changes: 1 addition & 1 deletion ReleaseGenerators/PascalABCNET_version.nsh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
!define VERSION '3.9.0.3363'
!define VERSION '3.9.0.3364'
10 changes: 8 additions & 2 deletions Utils/NodesGeneratorNew/NodeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3404,11 +3404,17 @@ public void generate_code(StreamWriter sw,HelpStorage hst, SyntaxTemplateManager

generate_list_constructors(sw, manager);

//sw.WriteLine();
var sb = new StringBuilder();
sb.Append(this.node_name + " -> " + (this.base_class?.node_name ?? "object") + " [");
foreach (node_field_info nfi in _subnodes)
{
nfi.generate_field_code(sw);
sb.Append(nfi.field_type_name + " " + nfi.field_name + ",");
nfi.generate_field_code(sw);
}
if (sb[sb.Length-1] == ',')
sb.Remove(sb.Length - 1, 1);
sb.Append("]\n");
File.AppendAllText("Tree.txt", sb.ToString());

if (_subnodes.Count > 0)
sw.WriteLine();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ public void RefreshRow(int i)
ValueItem vi = new ValueItem(rv.monoValue, this.watchList.Rows[i].Cells[0].Value as string, WorkbenchServiceFactory.DebuggerManager.evaluator.declaringType);
(this.watchList.Rows[i] as AdvancedDataGridView.TreeGridNode)._grid = this.watchList;
(this.watchList.Rows[i] as AdvancedDataGridView.TreeGridNode).Content = vi;
this.watchList.Rows[i].Cells[1].Value = WorkbenchServiceFactory.DebuggerManager.MakeValueView(rv.obj_val);//rv.obj_val.AsString;
this.watchList.Rows[i].Cells[2].Value = DebugUtils.WrapTypeName(rv.obj_val.Type);
this.watchList.Rows[i].Cells[1].Value = rv.monoValue.Value;//rv.obj_val.AsString;
this.watchList.Rows[i].Cells[2].Value = rv.monoValue.TypeName;
this.watchList.InvalidateCell(0, i);
}
catch (System.Exception e)
Expand Down
97 changes: 82 additions & 15 deletions VisualPascalABCNETLinux/IB/Debugger/Debugger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class AssemblyHelper
private static Hashtable stand_types = new Hashtable(StringComparer.OrdinalIgnoreCase);
private static List<Type> unit_types = new List<Type>();//spisok tipov-obertok nad moduljami
private static List<DebugType> unit_debug_types;//to zhe samoe, no tipy Debugger.Core
private static List<Mono.Debugger.Soft.TypeMirror> unit_mono_types;
private static DebugType pabc_system_type = null;

static AssemblyHelper()
Expand Down Expand Up @@ -235,6 +236,17 @@ public static List<DebugType> GetUsesTypes(Process p, DebugType dt)
}
return unit_debug_types;
}

public static List<Mono.Debugger.Soft.TypeMirror> GetUsesMonoTypes(Mono.Debugging.Soft.SoftDebuggerSession session)
{
if (unit_mono_types == null)
{
unit_mono_types = new List<Mono.Debugger.Soft.TypeMirror>();
foreach (var t in unit_types)
unit_mono_types.Add(session.GetType(t.FullName));
}
return unit_mono_types;
}

public static void Unload()
{
Expand All @@ -245,6 +257,9 @@ public static void Unload()
if (unit_debug_types != null)
unit_debug_types.Clear();
unit_debug_types = null;
if (unit_mono_types != null)
unit_mono_types.Clear();
unit_mono_types = null;
}
}

Expand Down Expand Up @@ -554,7 +569,7 @@ public System.Diagnostics.Process RunWithMonoDebugger(System.Diagnostics.Process

private delegate void EndDebuggerSessionDelegate();

public void EndDebuggerSession()
private void EndDebuggerSessionSafe()
{
if (Mono.Debugger.Soft.VirtualMachineManager.currentProcess == null)
return;
Expand Down Expand Up @@ -600,14 +615,21 @@ public void EndDebuggerSession()
//monoDebuggerSession.TargetThreadStopped -= MonoDebuggerSession_TargetThreadStopped;
Status = DebugStatus.None;
Mono.Debugger.Soft.VirtualMachineManager.currentProcess = null;
var oldSession = monoDebuggerSession;
monoDebuggerSession = new Mono.Debugging.Soft.SoftDebuggerSession();
foreach (var bp in oldSession.Breakpoints.GetBreakpoints())
monoDebuggerSession.Breakpoints.Add(bp);
}


private void Process_Exited(object sender, EventArgs e)
{
VisualPABCSingleton.MainForm.Invoke(new EndDebuggerSessionDelegate(EndDebuggerSession));

EndDebuggerSession();
}

public void EndDebuggerSession()
{
VisualPABCSingleton.MainForm.Invoke(new EndDebuggerSessionDelegate(EndDebuggerSessionSafe));
}

private void MonoDebuggerSession_TargetThreadStopped(object sender, Mono.Debugging.Client.TargetEventArgs e)
Expand Down Expand Up @@ -854,7 +876,23 @@ void debuggedProcess_DebuggingResumed(object sender, ProcessEventArgs e)
}

public ExpressionEvaluator evaluator;


public Mono.Debugging.Soft.SoftDebuggerSession DebuggerSession
{
get
{
return monoDebuggerSession;
}
}

public Mono.Debugging.Client.StackFrame StackFrame
{
get
{
return stackFrame;
}
}

void debugProcessStarted(object sender, ProcessEventArgs e)
{
workbench.WidgetController.SetDebugTabsVisible(true);
Expand Down Expand Up @@ -1508,8 +1546,11 @@ public ListItem FindVarByName(string var, int num_line)
else if (lv.Name.Contains("$class_var"))
{
global_lv = lv;
#if (DEBUG)
Console.WriteLine("found global variables class " + lv.Name + " " + lv.TypeName);
#endif
}

else if (lv.Name.Contains("$unit_var"))
unit_lvs.Add(lv);
else if (lv.Name == "$disp$")
Expand All @@ -1526,6 +1567,8 @@ public ListItem FindVarByName(string var, int num_line)
if (lv.Name == "$obj$")
self_lv = lv;
}
if (var.ToLower() == "result" && ret_lv != null)
return new ValueItem(ret_lv);
if (var.ToLower() == "self")
{
try
Expand Down Expand Up @@ -1589,14 +1632,20 @@ public ListItem FindVarByName(string var, int num_line)
Console.WriteLine(global_lv.TypeName);
#endif
var tm = monoDebuggerSession.GetType(global_lv.TypeName);

if (tm != null)
{
var tr = new Mono.Debugging.Evaluation.TypeValueReference(stackFrame.SourceBacktrace.GetEvaluationContext(stackFrame.Index, Mono.Debugging.Client.EvaluationOptions.DefaultOptions), tm);
var fields = tr.GetChildReferences(Mono.Debugging.Client.EvaluationOptions.DefaultOptions);
foreach (var fi in fields)
{
if (string.Compare(fi.Name, var, true) == 0)
return new ValueItem(fi.CreateObjectValue(false, Mono.Debugging.Client.EvaluationOptions.DefaultOptions));
{
var val = fi.CreateObjectValue(false, Mono.Debugging.Client.EvaluationOptions.DefaultOptions);
val.parentFrame = stackFrame;
return new ValueItem(val);
}

}
}

Expand All @@ -1623,8 +1672,33 @@ public ListItem FindVarByName(string var, int num_line)
return new BaseTypeItem(tr, t);
}

List<Mono.Debugger.Soft.TypeMirror> types = AssemblyHelper.GetUsesMonoTypes(monoDebuggerSession);
foreach (var tm in types)
{
var tr = new Mono.Debugging.Evaluation.TypeValueReference(stackFrame.SourceBacktrace.GetEvaluationContext(stackFrame.Index, Mono.Debugging.Client.EvaluationOptions.DefaultOptions), tm);
var fields = tr.GetChildReferences(Mono.Debugging.Client.EvaluationOptions.DefaultOptions);
foreach (var fi in fields)
{
if (string.Compare(fi.Name, var, true) == 0)
{
var val = fi.CreateObjectValue(false, Mono.Debugging.Client.EvaluationOptions.DefaultOptions);
val.parentFrame = stackFrame;
return new ValueItem(val);
}

}

Type unit_type = AssemblyHelper.GetType(tm.FullName);
if (unit_type != null)
{
System.Reflection.FieldInfo fi = unit_type.GetField(var, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.IgnoreCase);
if (fi != null && fi.IsLiteral)
return new ValueItem(DebugUtils.MakeMonoValue(fi.GetRawConstantValue()));
}
}


nvc = debuggedProcess.SelectedFunction.LocalVariables;
/*nvc = debuggedProcess.SelectedFunction.LocalVariables;
List<NamedValue> val_list = new List<NamedValue>();
foreach (NamedValue nv in nvc)//smotrim sredi lokalnyh peremennyh
{
Expand Down Expand Up @@ -1766,15 +1840,8 @@ public ListItem FindVarByName(string var, int num_line)
}
}
/*foreach (NamedValue nv in unit_vars)
{
IList<FieldInfo> fields = nv.Type.GetFields(BindingFlags.All);
foreach (FieldInfo fi in fields)
if (string.Compare(fi.Name, var, true) == 0) return new ValueItem(fi.GetValue(nv),fi.DeclaringType);
}*/

if (ret_nv != null && string.Compare(var, "Result", true) == 0)
return new ValueItem(ret_nv, null);
return new ValueItem(ret_nv, null);*/

}
else
Expand Down
2 changes: 1 addition & 1 deletion VisualPascalABCNETLinux/IB/Debugger/DynamicTreeView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1791,7 +1791,7 @@ public string Text
set
{
if (value == null)
throw new ArgumentNullException("value", "Use string.Empty instead of null!");
value = "";
if (text != value)
{
text = value;
Expand Down
Loading

0 comments on commit 587d5ff

Please sign in to comment.