fix in linux debugger

This commit is contained in:
Ivan Bondarev 2023-10-03 16:46:20 +02:00
parent 4dd97d6a09
commit 9ff3f54007
2 changed files with 24 additions and 16 deletions

View file

@ -728,24 +728,28 @@ namespace VisualPascalABC
List<IListItem> list = new List<IListItem>();
if (monoValue.IsObject)
if (monoValue != null && monoValue.IsObject)
{
if (monoValue.TypeName.IndexOf("System.Collections.Generic.") != -1)
{
var tm = monoValue.Type as Mono.Debugger.Soft.TypeMirror;
if (tm == null)
return list;
var fields = tm.GetFields();
var tr = new Mono.Debugging.Evaluation.TypeValueReference(VisualPascalABC.WorkbenchServiceFactory.DebuggerManager.StackFrame.SourceBacktrace.GetEvaluationContext(VisualPascalABC.WorkbenchServiceFactory.DebuggerManager.StackFrame.Index, Mono.Debugging.Client.EvaluationOptions.DefaultOptions), tm);
foreach (var fi in fields)
{
try
{
var valref = new Mono.Debugging.Evaluation.UserVariableReference(monoValue.Context, fi.Name);
valref.Value = tm.GetValue(fi, fi.VirtualMachine.GetThread(VisualPascalABC.WorkbenchServiceFactory.DebuggerManager.DebuggerSession.ActiveThread.Id));
var valref = tr.GetChild(fi.Name, Mono.Debugging.Client.EvaluationOptions.DefaultOptions);
list.Add(new ValueItem(valref.CreateObjectValue(false)));
}
catch (System.Exception ex)
{
Console.WriteLine(ex.Message);
#if (DEBUG)
Console.WriteLine(ex.Message+" "+ex.StackTrace);
#endif
}
}
@ -1003,7 +1007,7 @@ namespace VisualPascalABC
{
get
{
return monoType.Name;
return Mono.Debugging.Client.ObjectValue.GetPascalTypeName(monoType.Name);
}
}

View file

@ -86,17 +86,24 @@ namespace Mono.Debugging.Client
static ObjectValue Create(IObjectValueSource source, ObjectPath path, string typeName)
{
var val = new ObjectValue();
val.typeName = typeName;
val.typeName = GetPascalTypeName(typeName);
val.source = source;
val.path = path;
return val;
}
public static string GetPascalTypeName(string typeName)
{
StringBuilder sb = new StringBuilder();
StringBuilder buf = new StringBuilder();
int i = 0;
while (i < val.typeName.Length)
{
char c = val.typeName[i];
while (i < typeName.Length)
{
char c = typeName[i];
if (char.IsLetterOrDigit(c))
buf.Append(c);
else if (c != ']')
{
{
string type = buf.ToString();
string pascalType = "";
if (c == '*')
@ -112,9 +119,9 @@ namespace Mono.Debugging.Client
buf.Clear();
}
i++;
}
}
if (buf.Length > 0)
{
{
string type = buf.ToString();
string pascalType = "";
if (pascalTypes.TryGetValue(type, out pascalType))
@ -122,10 +129,7 @@ namespace Mono.Debugging.Client
else
sb.Append(type);
}
val.typeName = sb.ToString();
val.source = source;
val.path = path;
return val;
return sb.ToString();
}
public static ObjectValue CreateString(IObjectValueSource source, ObjectPath path, string typeName, string value)