2
using System.Collections.Generic;
5
using System.Reflection;
6
using Mono.Debugging.Client;
7
using Mono.Debugging.Backend;
8
using System.Diagnostics;
10
namespace Mono.Debugging.Evaluation
12
public class FilteredMembersSource: RemoteFrameObject, IObjectValueSource
16
EvaluationContext ctx;
17
BindingFlags bindingFlags;
18
IObjectSource objectSource;
20
public FilteredMembersSource (EvaluationContext ctx, IObjectSource objectSource, object type, object obj, BindingFlags bindingFlags)
25
this.bindingFlags = bindingFlags;
26
this.objectSource = objectSource;
29
public static ObjectValue CreateNonPublicsNode (EvaluationContext ctx, IObjectSource objectSource, object type, object obj, BindingFlags bindingFlags)
31
return CreateNode (ctx, objectSource, type, obj, bindingFlags, "Non-public members");
34
public static ObjectValue CreateStaticsNode (EvaluationContext ctx, IObjectSource objectSource, object type, object obj, BindingFlags bindingFlags)
36
return CreateNode (ctx, objectSource, type, obj, bindingFlags, "Static members");
39
static ObjectValue CreateNode (EvaluationContext ctx, IObjectSource objectSource, object type, object obj, BindingFlags bindingFlags, string label)
41
FilteredMembersSource src = new FilteredMembersSource (ctx, objectSource, type, obj, bindingFlags);
43
ObjectValue val = ObjectValue.CreateObject (src, new ObjectPath (label), "", "", ObjectValueFlags.Group|ObjectValueFlags.ReadOnly|ObjectValueFlags.NoRefresh, null);
44
val.ChildSelector = "";
48
public ObjectValue[] GetChildren (ObjectPath path, int index, int count, EvaluationOptions options)
50
EvaluationContext cctx = ctx.WithOptions (options);
51
var names = new ObjectValueNameTracker (cctx);
52
object tdataType = null;
53
TypeDisplayData tdata = null;
54
List<ObjectValue> list = new List<ObjectValue> ();
55
foreach (ValueReference val in cctx.Adapter.GetMembersSorted (cctx, objectSource, type, obj, bindingFlags)) {
56
object decType = val.DeclaringType;
57
if (decType != null && decType != tdataType) {
59
tdata = cctx.Adapter.GetTypeDisplayData (cctx, decType);
61
DebuggerBrowsableState state = tdata.GetMemberBrowsableState (val.Name);
62
if (state == DebuggerBrowsableState.Never)
64
ObjectValue oval = val.CreateObjectValue (options);
65
names.FixName (val, oval);
68
if ((bindingFlags & BindingFlags.NonPublic) == 0) {
69
BindingFlags newFlags = bindingFlags | BindingFlags.NonPublic;
70
newFlags &= ~BindingFlags.Public;
71
list.Add (CreateNonPublicsNode (cctx, objectSource, type, obj, newFlags));
73
return list.ToArray ();
76
public ObjectValue GetValue (ObjectPath path, EvaluationOptions options)
78
throw new NotSupportedException ();
81
public EvaluationResult SetValue (ObjectPath path, string value, EvaluationOptions options)
83
throw new NotSupportedException ();
86
public object GetRawValue (ObjectPath path, EvaluationOptions options)
88
throw new System.NotImplementedException ();
91
public void SetRawValue (ObjectPath path, object value, EvaluationOptions options)
93
throw new System.NotImplementedException ();
2
using System.Collections.Generic;
5
using System.Reflection;
6
using Mono.Debugging.Client;
7
using Mono.Debugging.Backend;
8
using System.Diagnostics;
10
namespace Mono.Debugging.Evaluation
12
public class FilteredMembersSource: RemoteFrameObject, IObjectValueSource
16
EvaluationContext ctx;
17
BindingFlags bindingFlags;
18
IObjectSource objectSource;
20
public FilteredMembersSource (EvaluationContext ctx, IObjectSource objectSource, object type, object obj, BindingFlags bindingFlags)
25
this.bindingFlags = bindingFlags;
26
this.objectSource = objectSource;
29
public static ObjectValue CreateNonPublicsNode (EvaluationContext ctx, IObjectSource objectSource, object type, object obj, BindingFlags bindingFlags)
31
return CreateNode (ctx, objectSource, type, obj, bindingFlags, "Non-public members");
34
public static ObjectValue CreateStaticsNode (EvaluationContext ctx, IObjectSource objectSource, object type, object obj, BindingFlags bindingFlags)
36
return CreateNode (ctx, objectSource, type, obj, bindingFlags, "Static members");
39
static ObjectValue CreateNode (EvaluationContext ctx, IObjectSource objectSource, object type, object obj, BindingFlags bindingFlags, string label)
41
FilteredMembersSource src = new FilteredMembersSource (ctx, objectSource, type, obj, bindingFlags);
43
ObjectValue val = ObjectValue.CreateObject (src, new ObjectPath (label), "", "", ObjectValueFlags.Group|ObjectValueFlags.ReadOnly|ObjectValueFlags.NoRefresh, null);
44
val.ChildSelector = "";
48
public ObjectValue[] GetChildren (ObjectPath path, int index, int count, EvaluationOptions options)
50
EvaluationContext cctx = ctx.WithOptions (options);
51
var names = new ObjectValueNameTracker (cctx);
52
object tdataType = null;
53
TypeDisplayData tdata = null;
54
List<ObjectValue> list = new List<ObjectValue> ();
55
foreach (ValueReference val in cctx.Adapter.GetMembersSorted (cctx, objectSource, type, obj, bindingFlags)) {
56
object decType = val.DeclaringType;
57
if (decType != null && decType != tdataType) {
59
tdata = cctx.Adapter.GetTypeDisplayData (cctx, decType);
61
DebuggerBrowsableState state = tdata.GetMemberBrowsableState (val.Name);
62
if (state == DebuggerBrowsableState.Never)
64
ObjectValue oval = val.CreateObjectValue (options);
65
names.FixName (val, oval);
68
if ((bindingFlags & BindingFlags.NonPublic) == 0) {
69
BindingFlags newFlags = bindingFlags | BindingFlags.NonPublic;
70
newFlags &= ~BindingFlags.Public;
71
list.Add (CreateNonPublicsNode (cctx, objectSource, type, obj, newFlags));
73
return list.ToArray ();
76
public ObjectValue GetValue (ObjectPath path, EvaluationOptions options)
78
throw new NotSupportedException ();
81
public EvaluationResult SetValue (ObjectPath path, string value, EvaluationOptions options)
83
throw new NotSupportedException ();
86
public object GetRawValue (ObjectPath path, EvaluationOptions options)
88
throw new System.NotImplementedException ();
91
public void SetRawValue (ObjectPath path, object value, EvaluationOptions options)
93
throw new System.NotImplementedException ();