public MonoProperty(StackFrame frame, LocalVariable localVariable, TypeMirror typeMirror, Mirror childMirror)
 {
     this.frame = frame;
     this.variable = localVariable;
     this.mirror = typeMirror;
     this.childMirror = childMirror;
 }
 public ExpandedProperty(TypeMirror typeMirror, StackFrame frame, LocalVariable localVariable)
 {
     this.frame = frame;
     this.localVariable = localVariable;
     var properties = typeMirror.GetProperties().Cast<Mirror>();
     var methods = typeMirror.GetMethods().Cast<Mirror>();
     var fields = typeMirror.GetFields().Cast<Mirror>();
     var children = properties.Concat(methods).Concat(fields);
     allProperties = children.ToList();
 }
		public Value GetValue (LocalVariable variable)
		{
			if (variable == null)
				throw new ArgumentNullException ("variable");

			if (values == null)
				values = frame.GetValues (variables);

			for (int i = 0; i < variables.Length; i++) {
				if (variable == variables[i])
					return values[i];
			}

			throw new ArgumentOutOfRangeException ("variable");
		}
		public Value GetValue (LocalVariable var) {
			if (var == null)
				throw new ArgumentNullException ("var");
			if (var.Method != Method)
				throw new ArgumentException ("Local variable doesn't belong to this frame's method.");

			// FIXME: Liveness
			// FIXME: Check for return value
			// FIXME: Allow returning the frame return value if possible
			return vm.DecodeValue (vm.conn.StackFrame_GetValues (thread.Id, Id, new int [] { var.GetValueIndex } )[0]);
		}
		public void SetValue (LocalVariable var, Value value) {
			if (var == null)
				throw new ArgumentNullException ("var");
			if (var.Method != Method)
				throw new ArgumentException ("Local variable doesn't belong to this frame's method.");
			if (value == null)
				throw new ArgumentNullException ("value");
			CheckMirror (value);
			// FIXME: Liveness
			// FIXME: Check for return value
			try {
				vm.conn.StackFrame_SetValues (thread.Id, Id, new int [] { var.GetValueIndex }, new ValueImpl [] { vm.EncodeValue (value) });
			} catch (CommandException ex) {
				if (ex.ErrorCode == ErrorCode.INVALID_ARGUMENT)
					throw new ArgumentException ("Value does not match the type of the local variable.");
				else
					throw;
			}
		}
		public Value[] GetValues (LocalVariable[] vars) {
			if (vars == null)
				throw new ArgumentNullException ("vars");
			for (int i = 0; i < vars.Length; ++i) {
				if (vars [i] == null)
					throw new ArgumentNullException ("vars");
				if (vars [i].Method != Method)
					throw new ArgumentException ("Local variable doesn't belong to this frame's method.");
			}
			int[] pos = new int [vars.Length];
			for (int i = 0; i < vars.Length; ++i)
				pos [i] = vars [i].GetValueIndex;
			return vm.DecodeValues (vm.conn.StackFrame_GetValues (thread.Id, Id, pos));
		}
Example #7
0
		public LocalVariable[] GetLocals () {
			if (locals == null) {

				LocalsInfo li = new LocalsInfo ();
				try {
					li = vm.conn.Method_GetLocalsInfo (id);
				} catch (CommandException) {
					throw new ArgumentException ("Method doesn't have a body.");
				}
				// Add the arguments as well
				var pi = vm.conn.Method_GetParamInfo (id);

				locals = new LocalVariable [pi.param_count + li.names.Length];

				for (int i = 0; i < pi.param_count; ++i)
					locals [i] = new LocalVariable (vm, this, i, pi.param_types [i], pi.param_names [i], -1, -1, true);

				for (int i = 0; i < li.names.Length; ++i)
					locals [i + pi.param_count] = new LocalVariable (vm, this, i, li.types [i], li.names [i], li.live_range_start [i], li.live_range_end [i], false);
			}
			return locals;
		}
Example #8
0
		public LocalVariable[] GetLocals () {
			if (locals == null) {
				var li = vm.conn.Method_GetLocalsInfo (id);
				// Add the arguments as well
				var pi = vm.conn.Method_GetParamInfo (id);

				locals = new LocalVariable [pi.param_count + li.names.Length];

				for (int i = 0; i < pi.param_count; ++i)
					locals [i] = new LocalVariable (vm, this, i, pi.param_types [i], pi.param_names [i], -1, -1, true);

				for (int i = 0; i < li.names.Length; ++i)
					locals [i + pi.param_count] = new LocalVariable (vm, this, i, li.types [i], li.names [i], li.live_range_start [i], li.live_range_end [i], false);
			}
			return locals;
		}
 public MonoProperty(StackFrame frame, LocalVariable variable)
     : this(frame, variable, null, null)
 {
 }
		public VariableValueReference (EvaluationContext ctx, string name, LocalVariable variable): base (ctx)
		{
			this.name = name;
			this.variable = variable;
		}
		public LocalVariableBatch (StackFrame frame, LocalVariable[] variables)
		{
			this.variables = variables;
			this.frame = frame;
		}
Example #12
0
		public LocalVariable[] GetLocals () {
			if (locals == null) {
				LocalsInfo li = new LocalsInfo ();
				try {
					li = vm.conn.Method_GetLocalsInfo (id);
				} catch (CommandException) {
					throw new AbsentInformationException ();
				}

				// Add the arguments as well
				var pi = GetParameters ();

				locals = new LocalVariable [pi.Length + li.names.Length];

				for (int i = 0; i < pi.Length; ++i)
					locals [i] = new LocalVariable (vm, this, i, pi[i].ParameterType.Id, pi[i].Name, -1, -1, true);

				for (int i = 0; i < li.names.Length; ++i)
					locals [i + pi.Length] = new LocalVariable (vm, this, i, li.types [i], li.names [i], li.live_range_start [i], li.live_range_end [i], false);

				if (vm.Version.AtLeast (2, 43)) {
					scopes = new LocalScope [li.scopes_start.Length];
					for (int i = 0; i < scopes.Length; ++i)
						scopes [i] = new LocalScope (vm, this, li.scopes_start [i], li.scopes_end [i]);
				}
			}
			return locals;
		}
Example #13
0
 public SdbVariable(MDS.LocalVariable variable)
     : base(variable)
 {
 }