Отладчик для Linux: глобальные переменные
This commit is contained in:
parent
b6e40cecce
commit
f12406b471
|
|
@ -1445,7 +1445,6 @@ namespace VisualPascalABC
|
|||
return new ValueItem(stackFrame.GetThisReference());
|
||||
else if (lv.Name.Contains("$class_var"))
|
||||
{
|
||||
|
||||
global_lv = lv;
|
||||
}
|
||||
|
||||
|
|
@ -1522,14 +1521,15 @@ namespace VisualPascalABC
|
|||
}
|
||||
if (global_lv != null)
|
||||
{
|
||||
var fields = global_lv.GetAllChildren();
|
||||
|
||||
var tr = new Mono.Debugging.Evaluation.TypeValueReference(stackFrame.SourceBacktrace.GetEvaluationContext(stackFrame.Index, Mono.Debugging.Client.EvaluationOptions.DefaultOptions), monoDebuggerSession.GetType(global_lv.TypeName));
|
||||
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);
|
||||
return new ValueItem(fi.CreateObjectValue(false, Mono.Debugging.Client.EvaluationOptions.DefaultOptions));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Type global_type = AssemblyHelper.GetType(global_lv.TypeName);
|
||||
if (global_type != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
using Mono.Debugging.Client;
|
||||
using Mono.Debugging.Evaluation;
|
||||
|
||||
namespace Mono.Debugging.Backend
|
||||
{
|
||||
|
|
@ -16,5 +17,6 @@ namespace Mono.Debugging.Backend
|
|||
CompletionData GetExpressionCompletionData (int frameIndex, string exp);
|
||||
AssemblyLine[] Disassemble (int frameIndex, int firstLine, int count);
|
||||
ValidationResult ValidateExpression (int frameIndex, string expression, EvaluationOptions options);
|
||||
EvaluationContext GetEvaluationContext(int frameIndex, EvaluationOptions options);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
|
||||
using Mono.Debugging.Backend;
|
||||
using Mono.Debugging.Evaluation;
|
||||
|
||||
namespace Mono.Debugging.Client
|
||||
{
|
||||
|
|
@ -46,6 +47,8 @@ namespace Mono.Debugging.Client
|
|||
string typeName;
|
||||
string displayValue;
|
||||
string childSelector;
|
||||
object type;
|
||||
EvaluationContext ctx;
|
||||
ObjectValueFlags flags;
|
||||
IObjectValueSource source;
|
||||
IObjectValueUpdater updater;
|
||||
|
|
@ -78,13 +81,14 @@ namespace Mono.Debugging.Client
|
|||
return CreateObject (source, path, typeName, new EvaluationResult (value), flags, children);
|
||||
}
|
||||
|
||||
public static ObjectValue CreateObject (IObjectValueSource source, ObjectPath path, string typeName, EvaluationResult value, ObjectValueFlags flags, ObjectValue[] children)
|
||||
public static ObjectValue CreateObject (IObjectValueSource source, ObjectPath path, string typeName, EvaluationResult value, ObjectValueFlags flags, ObjectValue[] children, object type=null, EvaluationContext ctx=null)
|
||||
{
|
||||
var val = Create (source, path, typeName);
|
||||
val.flags = flags | ObjectValueFlags.Object;
|
||||
val.displayValue = value.DisplayValue;
|
||||
val.value = value.Value;
|
||||
|
||||
val.type = type;
|
||||
val.ctx = ctx;
|
||||
if (children != null) {
|
||||
val.children = new List<ObjectValue> ();
|
||||
val.children.AddRange (children);
|
||||
|
|
@ -93,16 +97,18 @@ namespace Mono.Debugging.Client
|
|||
return val;
|
||||
}
|
||||
|
||||
public static ObjectValue CreateNullObject (IObjectValueSource source, string name, string typeName, ObjectValueFlags flags)
|
||||
public static ObjectValue CreateNullObject (IObjectValueSource source, string name, string typeName, ObjectValueFlags flags, object type = null, EvaluationContext ctx = null)
|
||||
{
|
||||
return CreateNullObject (source, new ObjectPath (name), typeName, flags);
|
||||
return CreateNullObject (source, new ObjectPath (name), typeName, flags, type, ctx);
|
||||
}
|
||||
|
||||
public static ObjectValue CreateNullObject (IObjectValueSource source, ObjectPath path, string typeName, ObjectValueFlags flags)
|
||||
public static ObjectValue CreateNullObject (IObjectValueSource source, ObjectPath path, string typeName, ObjectValueFlags flags, object type = null, EvaluationContext ctx = null)
|
||||
{
|
||||
var val = Create (source, path, typeName);
|
||||
val.flags = flags | ObjectValueFlags.Object;
|
||||
val.value = "(null)";
|
||||
val.type = type;
|
||||
val.ctx = ctx;
|
||||
val.isNull = true;
|
||||
return val;
|
||||
}
|
||||
|
|
@ -170,6 +176,7 @@ namespace Mono.Debugging.Client
|
|||
public static ObjectValue CreateFatalError (string name, string message, ObjectValueFlags flags)
|
||||
{
|
||||
var val = new ObjectValue ();
|
||||
Console.WriteLine("create value " + name);
|
||||
val.flags = flags | ObjectValueFlags.Error;
|
||||
val.value = message;
|
||||
val.name = name;
|
||||
|
|
@ -186,6 +193,7 @@ namespace Mono.Debugging.Client
|
|||
|
||||
public static ObjectValue CreateShowMore ()
|
||||
{
|
||||
Console.WriteLine("create value show more");
|
||||
return new ObjectValue () {
|
||||
flags = ObjectValueFlags.IEnumerable,
|
||||
name = ""
|
||||
|
|
@ -205,6 +213,22 @@ namespace Mono.Debugging.Client
|
|||
get { return flags; }
|
||||
}
|
||||
|
||||
public object Type
|
||||
{
|
||||
get
|
||||
{
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
public EvaluationContext Context
|
||||
{
|
||||
get
|
||||
{
|
||||
return ctx;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Name of the value (for example, the property name)
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ namespace Mono.Debugging.Evaluation
|
|||
|
||||
public ObjectValueAdaptor Adaptor { get; set; }
|
||||
|
||||
protected abstract EvaluationContext GetEvaluationContext (int frameIndex, EvaluationOptions options);
|
||||
public abstract EvaluationContext GetEvaluationContext (int frameIndex, EvaluationOptions options);
|
||||
|
||||
public abstract int FrameCount { get; }
|
||||
|
||||
|
|
|
|||
|
|
@ -468,13 +468,13 @@ namespace Mono.Debugging.Evaluation
|
|||
string typeName = type != null ? GetTypeName (ctx, type) : "";
|
||||
|
||||
if (obj == null || IsNull (ctx, obj))
|
||||
return ObjectValue.CreateNullObject (source, path, GetDisplayTypeName (typeName), flags);
|
||||
return ObjectValue.CreateNullObject (source, path, GetDisplayTypeName (typeName), flags, type, ctx);
|
||||
|
||||
if (IsPrimitive (ctx, obj) || IsEnum (ctx,obj))
|
||||
return ObjectValue.CreatePrimitive (source, path, GetDisplayTypeName (typeName), ctx.Evaluator.TargetObjectToExpression (ctx, obj), flags);
|
||||
|
||||
if (IsArray (ctx, obj))
|
||||
return ObjectValue.CreateObject (source, path, GetDisplayTypeName (typeName), ctx.Evaluator.TargetObjectToExpression (ctx, obj), flags, null);
|
||||
return ObjectValue.CreateObject (source, path, GetDisplayTypeName (typeName), ctx.Evaluator.TargetObjectToExpression (ctx, obj), flags, null, type, ctx);
|
||||
|
||||
EvaluationResult tvalue = null;
|
||||
TypeDisplayData tdata = null;
|
||||
|
|
@ -520,7 +520,7 @@ namespace Mono.Debugging.Evaluation
|
|||
}
|
||||
}
|
||||
|
||||
ObjectValue oval = ObjectValue.CreateObject (source, path, tname, tvalue, flags, null);
|
||||
ObjectValue oval = ObjectValue.CreateObject (source, path, tname, tvalue, flags, null, type, ctx);
|
||||
if (!string.IsNullOrEmpty (tdata.NameDisplayString) && ctx.Options.AllowDisplayStringEvaluation) {
|
||||
try {
|
||||
oval.Name = EvaluateDisplayString (ctx, obj, tdata.NameDisplayString);
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ namespace Mono.Debugging.Soft
|
|||
return new SoftDebuggerStackFrame (frame, addressSpace, location, language, external, hasDebugInfo, hidden, typeFQN, typeFullName);
|
||||
}
|
||||
|
||||
protected override EvaluationContext GetEvaluationContext (int frameIndex, EvaluationOptions options)
|
||||
public override EvaluationContext GetEvaluationContext (int frameIndex, EvaluationOptions options)
|
||||
{
|
||||
ValidateStack ();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue