diff --git a/VisualPascalABCNETLinux/IB/Debugger/LocalVars.cs b/VisualPascalABCNETLinux/IB/Debugger/LocalVars.cs index 82e773c78..d3ea82e40 100644 --- a/VisualPascalABCNETLinux/IB/Debugger/LocalVars.cs +++ b/VisualPascalABCNETLinux/IB/Debugger/LocalVars.cs @@ -728,24 +728,28 @@ namespace VisualPascalABC List list = new List(); - 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); } } diff --git a/VisualPascalABCNETLinux/MonoDebugging/Client/ObjectValue.cs b/VisualPascalABCNETLinux/MonoDebugging/Client/ObjectValue.cs index 722fc65a0..ed2ad0985 100644 --- a/VisualPascalABCNETLinux/MonoDebugging/Client/ObjectValue.cs +++ b/VisualPascalABCNETLinux/MonoDebugging/Client/ObjectValue.cs @@ -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)