Author: toshok
Date: 2005-06-14 20:56:06 -0400 (Tue, 14 Jun 2005)
New Revision: 46002
Modified:
trunk/debugger/ChangeLog
trunk/debugger/backends/mono/MonoFundamentalObjectBase.cs
trunk/debugger/frontend/Expression.cs
trunk/debugger/interfaces/ITargetFundamentalObject.cs
Log:
2005-06-14 Chris Toshok <[EMAIL PROTECTED]>
* backends/mono/MonoFundamentalObjectBase.cs
(MonoFundamentalObjectBase.SetObject): new method, here only as a
workaround for bug #75270.
* interfaces/ITargetFundamentalObject.cs
(ITargetFundamentalObject.SetObject): new method.
* frontend/Expression.cs (StructAccessExpression.SetStaticField,
StructAccessExpression.SetField): setters for fields (fundamental
types only for now.)
(StructAccessExpression.DoAssign): implement for fields.
(ArrayAccessExpression.DoAssign): implement for array[int].
Modified: trunk/debugger/ChangeLog
===================================================================
--- trunk/debugger/ChangeLog 2005-06-15 00:14:28 UTC (rev 46001)
+++ trunk/debugger/ChangeLog 2005-06-15 00:56:06 UTC (rev 46002)
@@ -1,3 +1,18 @@
+2005-06-14 Chris Toshok <[EMAIL PROTECTED]>
+
+ * backends/mono/MonoFundamentalObjectBase.cs
+ (MonoFundamentalObjectBase.SetObject): new method, here only as a
+ workaround for bug #75270.
+
+ * interfaces/ITargetFundamentalObject.cs
+ (ITargetFundamentalObject.SetObject): new method.
+
+ * frontend/Expression.cs (StructAccessExpression.SetStaticField,
+ StructAccessExpression.SetField): setters for fields (fundamental
+ types only for now.)
+ (StructAccessExpression.DoAssign): implement for fields.
+ (ArrayAccessExpression.DoAssign): implement for array[int].
+
2005-06-11 Chris Toshok <[EMAIL PROTECTED]>
* backends/native/NativeFundamentalObject.cs:
Modified: trunk/debugger/backends/mono/MonoFundamentalObjectBase.cs
===================================================================
--- trunk/debugger/backends/mono/MonoFundamentalObjectBase.cs 2005-06-15
00:14:28 UTC (rev 46001)
+++ trunk/debugger/backends/mono/MonoFundamentalObjectBase.cs 2005-06-15
00:56:06 UTC (rev 46002)
@@ -39,6 +39,14 @@
protected abstract object GetObject (ITargetMemoryReader reader,
TargetLocation location);
+ // XXX this is here due to mono bug #75270. without the
+ // (unused) implementation, MonoFundamentalObject.SetObject
+ // is never called when going through an interface.
+ public override void SetObject (ITargetObject obj)
+ {
+ throw new NotImplementedException ();
+ }
+
public override string Print ()
{
object obj = GetObject ();
Modified: trunk/debugger/frontend/Expression.cs
===================================================================
--- trunk/debugger/frontend/Expression.cs 2005-06-15 00:14:28 UTC (rev
46001)
+++ trunk/debugger/frontend/Expression.cs 2005-06-15 00:56:06 UTC (rev
46002)
@@ -1435,6 +1435,54 @@
return null;
}
}
+
+ protected void SetStaticField (ITargetStructType stype,
StackFrame frame,
+ ITargetFieldInfo field,
ITargetObject obj)
+ {
+ ITargetFundamentalObject fobj = GetStaticField (stype,
frame, field) as ITargetFundamentalObject;
+
+ if (fobj == null)
+ throw new ScriptingException ("Can only set
fields that are of fundamental types.");
+
+ fobj.SetObject (obj);
+ }
+
+ protected void SetField (ITargetStructObject sobj,
ITargetFieldInfo field, ITargetObject obj)
+ {
+ ITargetFundamentalObject fobj = GetField (sobj, field)
as ITargetFundamentalObject;
+
+ if (fobj == null)
+ throw new ScriptingException ("Can only set
fields that are of fundamental types.");
+
+ fobj.SetObject (obj);
+ }
+
+ protected override bool DoAssign (ScriptingContext context,
ITargetObject obj)
+ {
+ ITargetMemberInfo member = FindMember (context, true);
+
+ if (member is ITargetFieldInfo) {
+
+ if (member.Type != obj.TypeInfo.Type)
+ throw new ScriptingException (
+ "Type mismatch:
cannot assign expression of type " +
+ "`{0}' to field
`{1}', which is of type `{2}'.",
+
obj.TypeInfo.Type.Name, Name, member.Type.Name);
+
+ if (member.IsStatic)
+ SetStaticField (Type, Frame,
(ITargetFieldInfo)member, obj);
+ else if (!IsStatic)
+ SetField (Instance,
(ITargetFieldInfo)member, obj);
+ }
+ else if (member is ITargetPropertyInfo)
+ throw new ScriptingException ("Can't set
properties directly.");
+ else if (member is ITargetEventInfo)
+ throw new ScriptingException ("Can't set events
directly.");
+ else if (member is ITargetMethodInfo)
+ throw new ScriptingException ("Can't set
methods directly.");
+
+ return true;
+ }
}
public class PointerDereferenceExpression : PointerExpression
@@ -1732,6 +1780,28 @@
return type.ElementType;
}
+
+ protected override bool DoAssign (ScriptingContext context,
ITargetObject obj)
+ {
+ // array[int]
+ ITargetArrayObject aobj = expr.EvaluateVariable
(context) as ITargetArrayObject;
+ if (aobj != null) {
+ int i;
+ ITargetFundamentalObject elobj;
+
+ // single dimensional array only at present
+ i = GetIntIndex (this.indices[0], context);
+
+ elobj = aobj[i] as ITargetFundamentalObject;
+
+ if (elobj != null) {
+ elobj.SetObject (obj);
+ }
+ }
+
+ return true;
+ }
+
}
public class CastExpression : Expression
Modified: trunk/debugger/interfaces/ITargetFundamentalObject.cs
===================================================================
--- trunk/debugger/interfaces/ITargetFundamentalObject.cs 2005-06-15
00:14:28 UTC (rev 46001)
+++ trunk/debugger/interfaces/ITargetFundamentalObject.cs 2005-06-15
00:56:06 UTC (rev 46002)
@@ -16,5 +16,9 @@
object Object {
get;
}
+
+ // <summary>
+ // </summary>
+ void SetObject (ITargetObject obj);
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches