Author: martin
Date: 2005-09-07 09:54:13 -0400 (Wed, 07 Sep 2005)
New Revision: 49633

Modified:
   trunk/debugger/ChangeLog
   trunk/debugger/backends/Debugger.cs
   trunk/debugger/backends/Inferior.cs
   trunk/debugger/backends/Process.cs
   trunk/debugger/backends/SingleSteppingEngine.cs
   trunk/debugger/backends/TargetAccess.cs
   trunk/debugger/backends/classes/AbsoluteTargetLocation.cs
   trunk/debugger/backends/mono/MonoClassInfo.cs
   trunk/debugger/backends/mono/MonoClassObject.cs
   trunk/debugger/backends/mono/MonoClassType.cs
   trunk/debugger/backends/mono/MonoFunctionObject.cs
   trunk/debugger/backends/mono/MonoFunctionType.cs
   trunk/debugger/backends/mono/MonoMember.cs
   trunk/debugger/backends/native/NativeFunctionObject.cs
   trunk/debugger/backends/native/NativeFunctionType.cs
   trunk/debugger/backends/native/NativeStructType.cs
   trunk/debugger/backends/server/library.c
   trunk/debugger/backends/server/server.h
   trunk/debugger/backends/server/x86_64-arch.c
   trunk/debugger/frontend/Expression.cs
   trunk/debugger/interfaces/ITargetFunctionObject.cs
   trunk/debugger/interfaces/ITargetFunctionType.cs
   trunk/debugger/interfaces/ITargetMemoryAccess.cs
   trunk/debugger/interfaces/ITargetStructType.cs
Log:
2005-09-07  Martin Baulig  <[EMAIL PROTECTED]>

        * interfaces/ITargetFunctionObject.cs
        (ITargetFunctionObject.Invoke): Added `ITargetAccess target' and
        `ITargetObject instance' arguments.

        * interfaces/ITargetStructType.cs
        (ITargetStructType.GetStaticProperty): Take an `ITargetAccess',
        not a `StackFrame'.
        (ITargetStructType.GetStaticConstructor): Likewise.
        (ITargetStructType.GetStaticMethod): Likewise.
        (ITargetStructType.GetMethod): New method.
        (ITargetStructType.GetConstructor): New method.

        * interfaces/ITargetFunctionType.cs
        (ITargetFunctionType.InvokeStatic): Removed.

        * interfaces/ITargetMemoryAccess.cs
        (ITargetAccess.RuntimeInvoke): New method.

        * backends/Inferior.cs (Inferior.RuntimeInvoke): Take
        `MonoObject's as arguments instead of `TargetAddress'es and
        marshal the objects here.

        * backends/server/library.c
        (mono_debugger_server_call_method_invoke): Copy valuetype
        arguments on the stack instead of using the heap hack.



Modified: trunk/debugger/ChangeLog
===================================================================
--- trunk/debugger/ChangeLog    2005-09-07 13:20:40 UTC (rev 49632)
+++ trunk/debugger/ChangeLog    2005-09-07 13:54:13 UTC (rev 49633)
@@ -1,5 +1,33 @@
 2005-09-07  Martin Baulig  <[EMAIL PROTECTED]>
 
+       * interfaces/ITargetFunctionObject.cs
+       (ITargetFunctionObject.Invoke): Added `ITargetAccess target' and
+       `ITargetObject instance' arguments.
+
+       * interfaces/ITargetStructType.cs
+       (ITargetStructType.GetStaticProperty): Take an `ITargetAccess',
+       not a `StackFrame'.
+       (ITargetStructType.GetStaticConstructor): Likewise.
+       (ITargetStructType.GetStaticMethod): Likewise.
+       (ITargetStructType.GetMethod): New method.
+       (ITargetStructType.GetConstructor): New method.
+
+       * interfaces/ITargetFunctionType.cs
+       (ITargetFunctionType.InvokeStatic): Removed.
+
+       * interfaces/ITargetMemoryAccess.cs
+       (ITargetAccess.RuntimeInvoke): New method.
+
+       * backends/Inferior.cs (Inferior.RuntimeInvoke): Take
+       `MonoObject's as arguments instead of `TargetAddress'es and
+       marshal the objects here.
+
+       * backends/server/library.c
+       (mono_debugger_server_call_method_invoke): Copy valuetype
+       arguments on the stack instead of using the heap hack.
+
+2005-09-07  Martin Baulig  <[EMAIL PROTECTED]>
+
        * interfaces/ITargetType.cs (ITargetType.GetTypeInfo): Removed.
 
        * interfaces/ITargetTypeInfo.cs: Removed.

Modified: trunk/debugger/backends/Debugger.cs
===================================================================
--- trunk/debugger/backends/Debugger.cs 2005-09-07 13:20:40 UTC (rev 49632)
+++ trunk/debugger/backends/Debugger.cs 2005-09-07 13:54:13 UTC (rev 49633)
@@ -212,6 +212,15 @@
                                bfd_container.AddFile (process, filename, true, 
false, false);
                }
 
+               internal MonoLanguageBackend MonoLanguage {
+                       get {
+                               if (mono_language == null)
+                                       throw new InvalidOperationException ();
+
+                               return mono_language;
+                       }
+               }
+
                //
                // IDisposable
                //

Modified: trunk/debugger/backends/Inferior.cs
===================================================================
--- trunk/debugger/backends/Inferior.cs 2005-09-07 13:20:40 UTC (rev 49632)
+++ trunk/debugger/backends/Inferior.cs 2005-09-07 13:54:13 UTC (rev 49633)
@@ -12,6 +12,7 @@
 
 using Mono.Debugger;
 using Mono.Debugger.Architecture;
+using Mono.Debugger.Languages.Mono;
 
 namespace Mono.Debugger.Backends
 {
@@ -105,7 +106,7 @@
                static extern TargetError mono_debugger_server_call_method_1 
(IntPtr handle, long method_address, long method_argument, string 
string_argument, long callback_argument);
 
                [DllImport("monodebuggerserver")]
-               static extern TargetError 
mono_debugger_server_call_method_invoke (IntPtr handle, long invoke_method, 
long method_address, long object_address, int num_params, IntPtr param_array, 
long callback_argument, bool debug);
+               static extern TargetError 
mono_debugger_server_call_method_invoke (IntPtr handle, long invoke_method, 
long method_address, int num_params, int blob_size, IntPtr param_data, IntPtr 
offset_data, IntPtr blob_data, long callback_argument, bool debug);
 
                [DllImport("monodebuggerserver")]
                static extern TargetError 
mono_debugger_server_insert_breakpoint (IntPtr handle, long address, out int 
breakpoint);
@@ -259,30 +260,67 @@
                }
 
                public void RuntimeInvoke (TargetAddress invoke_method, 
TargetAddress method_argument,
-                                          TargetAddress object_argument, 
TargetAddress[] param_objects,
+                                          MonoObject object_argument, 
MonoObject[] param_objects,
                                           long callback_arg, bool debug)
                {
                        check_disposed ();
 
-                       int size = param_objects.Length;
-                       long[] param_addresses = new long [size];
-                       for (int i = 0; i < param_objects.Length; i++)
-                               param_addresses [i] = param_objects [i].Address;
+                       int length = param_objects.Length + 1;
 
-                       IntPtr data = IntPtr.Zero;
+                       MonoObject[] input_objects = new MonoObject [length];
+                       input_objects [0] = object_argument;
+                       param_objects.CopyTo (input_objects, 1);
+
+                       int blob_size = 0;
+                       byte[][] blobs = new byte [length][];
+                       int[] blob_offsets = new int [length];
+                       long[] addresses = new long [length];
+
+                       for (int i = 0; i < length; i++) {
+                               if (input_objects [i] == null)
+                                       continue;
+                               if (input_objects [i].Location.HasAddress) {
+                                       blob_offsets [i] = -1;
+                                       addresses [i] = input_objects 
[i].Location.Address.Address;
+                                       continue;
+                               }
+                               blobs [i] = input_objects [i].RawContents;
+                               blob_offsets [i] = blob_size;
+                               blob_size += blobs [i].Length;
+                       }
+
+                       byte[] blob = new byte [blob_size];
+                       blob_size = 0;
+                       for (int i = 0; i < length; i++) {
+                               if (blobs [i] == null)
+                                       continue;
+                               blobs [i].CopyTo (blob, blob_size);
+                               blob_size += blobs [i].Length;
+                       }
+
+                       IntPtr blob_data = IntPtr.Zero, param_data = 
IntPtr.Zero;
+                       IntPtr offset_data = IntPtr.Zero;
                        try {
-                               if (size > 0) {
-                                       data = Marshal.AllocHGlobal (size * 8);
-                                       Marshal.Copy (param_addresses, 0, data, 
size);
+                               if (blob_size > 0) {
+                                       blob_data = Marshal.AllocHGlobal 
(blob_size);
+                                       Marshal.Copy (blob, 0, blob_data, 
blob_size);
                                }
 
+                               param_data = Marshal.AllocHGlobal (length * 8);
+                               Marshal.Copy (addresses, 0, param_data, length);
+
+                               offset_data = Marshal.AllocHGlobal (length * 4);
+                               Marshal.Copy (blob_offsets, 0, offset_data, 
length);
+
                                check_error 
(mono_debugger_server_call_method_invoke (
                                        server_handle, invoke_method.Address, 
method_argument.Address,
-                                       object_argument.Address, size, data, 
callback_arg,
-                                       debug));
+                                       length, blob_size, param_data, 
offset_data, blob_data,
+                                       callback_arg, debug));
                        } finally {
-                               if (data != IntPtr.Zero)
-                                       Marshal.FreeHGlobal (data);
+                               if (blob_data != IntPtr.Zero)
+                                       Marshal.FreeHGlobal (blob_data);
+                               Marshal.FreeHGlobal (param_data);
+                               Marshal.FreeHGlobal (offset_data);
                        }
                }
 

Modified: trunk/debugger/backends/Process.cs
===================================================================
--- trunk/debugger/backends/Process.cs  2005-09-07 13:20:40 UTC (rev 49632)
+++ trunk/debugger/backends/Process.cs  2005-09-07 13:54:13 UTC (rev 49633)
@@ -552,47 +552,38 @@
                        return (TargetAddress) result.Result;
                }
 
-               public void RuntimeInvoke (StackFrame frame,
-                                          TargetAddress method_argument,
-                                          TargetAddress object_argument,
-                                          TargetAddress[] param_objects)
+               public void RuntimeInvoke (TargetAddress method_argument,
+                                          ITargetObject object_argument,
+                                          ITargetObject[] param_objects)
                {
                        lock (this) {
                                check_engine ();
                                engine.RuntimeInvoke (
-                                       frame, method_argument, 
object_argument, param_objects);
+                                       method_argument, object_argument, 
param_objects);
                                operation_completed_event.Reset ();
                                target_state = TargetState.RUNNING;
                        }
                }
 
-               public TargetAddress RuntimeInvoke (StackFrame frame,
-                                                   TargetAddress 
method_argument,
-                                                   TargetAddress 
object_argument,
-                                                   TargetAddress[] 
param_objects,
-                                                   out bool is_exc)
+               public ITargetObject RuntimeInvoke (TargetAddress 
method_argument,
+                                                   ITargetObject 
object_argument,
+                                                   ITargetObject[] 
param_objects,
+                                                   out string exc_message)
                {
                        CommandResult result = new CommandResult ();
 
                        lock (this) {
                                check_engine ();
                                engine.RuntimeInvoke (
-                                       frame, method_argument, 
object_argument, param_objects,
-                                       result);
+                                       method_argument, object_argument, 
param_objects, result);
                                operation_completed_event.Reset ();
                        }
 
                        operation_completed_event.WaitOne ();
 
                        RuntimeInvokeResult res = (RuntimeInvokeResult) 
result.Result;
-
-                       if (res.ExceptionObject.IsNull) {
-                               is_exc = false;
-                               return res.ReturnObject;
-                       } else {
-                               is_exc = true;
-                               return res.ExceptionObject;
-                       }
+                       exc_message = res.ExceptionMessage;
+                       return res.ReturnObject;
                }
 
                public object Invoke (TargetAccessDelegate func, object data)

Modified: trunk/debugger/backends/SingleSteppingEngine.cs
===================================================================
--- trunk/debugger/backends/SingleSteppingEngine.cs     2005-09-07 13:20:40 UTC 
(rev 49632)
+++ trunk/debugger/backends/SingleSteppingEngine.cs     2005-09-07 13:54:13 UTC 
(rev 49633)
@@ -14,6 +14,7 @@
 
 using Mono.Debugger;
 using Mono.Debugger.Languages;
+using Mono.Debugger.Languages.Mono;
 using Mono.Debugger.Architecture;
 using Mono.Debugger.Remoting;
 
@@ -1360,26 +1361,24 @@
                }
 
                [Command]
-               public void RuntimeInvoke (StackFrame frame,
-                                          TargetAddress method_argument,
-                                          TargetAddress object_argument,
-                                          TargetAddress[] param_objects)
+               public void RuntimeInvoke (TargetAddress method_argument,
+                                          ITargetObject object_argument,
+                                          ITargetObject[] param_objects)
                {
                        StartOperation ();
                        ProcessOperation (new OperationRuntimeInvoke (
-                               frame, method_argument, object_argument, 
param_objects));
+                               method_argument, object_argument, 
param_objects));
                }
 
                [Command]
-               public void RuntimeInvoke (StackFrame frame,
-                                          TargetAddress method_argument,
-                                          TargetAddress object_argument,
-                                          TargetAddress[] param_objects,
+               public void RuntimeInvoke (TargetAddress method_argument,
+                                          ITargetObject object_argument,
+                                          ITargetObject[] param_objects,
                                           CommandResult result)
                {
                        StartOperation ();
                        ProcessOperation (new OperationRuntimeInvoke (
-                               frame, method_argument, object_argument, 
param_objects, result));
+                               method_argument, object_argument, 
param_objects, result));
                }
 
                [Command]
@@ -1801,7 +1800,7 @@
                protected class CallbackRuntimeInvoke : Callback
                {
                        OperationRuntimeInvoke op;
-                       ILanguageBackend language;
+                       MonoLanguageBackend language;
                        TargetAddress method;
                        bool method_compiled;
 
@@ -1815,21 +1814,15 @@
                                                           Inferior inferior)
                        {
                                if (language == null) {
-                                       IMethod method = op.Frame.Method;
-                                       if (method == null)
-                                               throw new 
InvalidOperationException ();
-
-                                       language = 
method.Module.LanguageBackend as ILanguageBackend;
-                                       if (language == null)
-                                               throw new 
InvalidOperationException ();
+                                       language = 
sse.ThreadManager.DebuggerBackend.MonoLanguage;
                                }
 
-                               if (!op.ObjectArgument.IsNull)
+                               if ((op.ObjectArgument != null) && 
op.ObjectArgument.Location.HasAddress) {
                                        inferior.CallMethod (
                                                language.GetVirtualMethodFunc,
-                                               op.ObjectArgument.Address,
+                                               
op.ObjectArgument.Location.Address.Address,
                                                op.MethodArgument.Address, ID);
-                               else {
+                               } else {
                                        method = op.MethodArgument;
                                        inferior.CallMethod (
                                                language.CompileMethodFunc,
@@ -1846,8 +1839,7 @@
                                                inferior.AddressDomain, data1);
 
                                        inferior.CallMethod 
(language.CompileMethodFunc,
-                                                            method.Address,
-                                                            
op.ObjectArgument.Address, ID);
+                                                            method.Address, 0, 
ID);
                                        return false;
                                }
 
@@ -1875,16 +1867,23 @@
                                      data1, data2);
 
                                RuntimeInvokeResult result = new 
RuntimeInvokeResult ();
-                               if (data1 != 0)
-                                       result.ReturnObject = new TargetAddress 
(
-                                               inferior.AddressDomain, data1);
-                               else
-                                       result.ReturnObject = 
TargetAddress.Null;
-                               if (data2 != 0)
-                                       result.ExceptionObject = new 
TargetAddress (
+                               if (data2 != 0) {
+                                       TargetAddress exc_address = new 
TargetAddress (
                                                inferior.AddressDomain, data2);
-                               else
-                                       result.ExceptionObject = 
TargetAddress.Null;
+                                       ITargetFundamentalObject exc_obj = 
(ITargetFundamentalObject)
+                                               language.CreateObject 
(sse.target_access, exc_address);
+
+                                       result.ExceptionMessage = (string) 
exc_obj.Object;
+                               }
+
+                               if (data1 != 0) {
+                                       TargetAddress retval_address = new 
TargetAddress (
+                                               inferior.AddressDomain, data1);
+
+                                       result.ReturnObject = 
language.CreateObject (
+                                               sse.target_access, 
retval_address);
+                               }
+
                                op.Result.Result = result;
 
                                return true;
@@ -2428,10 +2427,9 @@
 
        protected class OperationRuntimeInvoke : Operation
        {
-               public readonly StackFrame Frame;
                public readonly TargetAddress MethodArgument;
-               public readonly TargetAddress ObjectArgument;
-               public readonly TargetAddress[] ParamObjects;
+               public readonly MonoObject ObjectArgument;
+               public readonly MonoObject[] ParamObjects;
                public readonly bool Debug;
                public readonly CommandResult Result;
 
@@ -2439,29 +2437,25 @@
                        get { return true; }
                }
 
-               public OperationRuntimeInvoke (StackFrame frame,
-                                              TargetAddress method_argument,
-                                              TargetAddress object_argument,
-                                              TargetAddress[] param_objects)
+               public OperationRuntimeInvoke (TargetAddress method_argument,
+                                              ITargetObject object_argument,
+                                              ITargetObject[] param_objects)
                {
-                       this.Frame = frame;
                        this.MethodArgument = method_argument;
-                       this.ObjectArgument = object_argument;
-                       this.ParamObjects = param_objects;
+                       this.ObjectArgument = (MonoObject) object_argument;
+                       this.ParamObjects = new MonoObject 
[param_objects.Length];
+                       param_objects.CopyTo (this.ParamObjects, 0);
                        this.Debug = true;
                }
 
-               public OperationRuntimeInvoke (StackFrame frame,
-                                              TargetAddress method_argument,
-                                              TargetAddress object_argument,
-                                              TargetAddress[] param_objects,
+               public OperationRuntimeInvoke (TargetAddress method_argument,
+                                              ITargetObject object_argument,
+                                              ITargetObject[] param_objects,
                                               CommandResult result)
+                       : this (method_argument, object_argument, param_objects)
                {
-                       this.Frame = frame;
-                       this.MethodArgument = method_argument;
-                       this.ObjectArgument = object_argument;
-                       this.ParamObjects = param_objects;
                        this.Result = result;
+                       this.Debug = false;
                }
 
                protected override void DoExecute (SingleSteppingEngine sse)
@@ -2669,8 +2663,8 @@
        [Serializable]
        internal struct RuntimeInvokeResult
        {
-               public TargetAddress ReturnObject;
-               public TargetAddress ExceptionObject;
+               public ITargetObject ReturnObject;
+               public string ExceptionMessage;
        }
 
        internal sealed class CommandResult : MarshalByRefObject

Modified: trunk/debugger/backends/TargetAccess.cs
===================================================================
--- trunk/debugger/backends/TargetAccess.cs     2005-09-07 13:20:40 UTC (rev 
49632)
+++ trunk/debugger/backends/TargetAccess.cs     2005-09-07 13:54:13 UTC (rev 
49633)
@@ -7,6 +7,7 @@
 using System.Runtime.Remoting.Messaging;
 
 using Mono.Debugger.Remoting;
+using Mono.Debugger.Languages;
 
 namespace Mono.Debugger.Backends
 {
@@ -35,6 +36,15 @@
                public abstract TargetAddress CallMethod (TargetAddress method, 
TargetAddress arg1,
                                                          TargetAddress arg2);
 
+               public abstract void RuntimeInvoke (TargetAddress 
method_argument,
+                                                   ITargetObject 
object_argument,
+                                                   ITargetObject[] 
param_objects);
+
+               public abstract ITargetObject RuntimeInvoke (TargetAddress 
method_argument,
+                                                            ITargetObject 
object_argument,
+                                                            ITargetObject[] 
param_objects,
+                                                            out string 
exc_message);
+
                public abstract object Invoke (TargetAccessDelegate func, 
object data);
 
                //
@@ -98,6 +108,22 @@
                        return process.CallMethod (method, arg1, arg2);
                }
 
+               public override void RuntimeInvoke (TargetAddress 
method_argument,
+                                                   ITargetObject 
object_argument,
+                                                   ITargetObject[] 
param_objects)
+               {
+                       process.RuntimeInvoke (method_argument, 
object_argument, param_objects);
+               }
+
+               public override ITargetObject RuntimeInvoke (TargetAddress 
method_argument,
+                                                            ITargetObject 
object_argument,
+                                                            ITargetObject[] 
param_objects,
+                                                            out string 
exc_message)
+               {
+                       return process.RuntimeInvoke (
+                               method_argument, object_argument, 
param_objects, out exc_message);
+               }
+
                public override object Invoke (TargetAccessDelegate func, 
object data)
                {
                        return process.Invoke (func, data);
@@ -141,6 +167,30 @@
                                return sse.Process.CallMethod (method, arg1, 
arg2);
                }
 
+               public override void RuntimeInvoke (TargetAddress 
method_argument,
+                                                   ITargetObject 
object_argument,
+                                                   ITargetObject[] 
param_objects)
+               {
+                       if (sse.ThreadManager.InBackgroundThread)
+                               throw new InvalidOperationException ();
+                       else
+                               sse.Process.RuntimeInvoke (
+                                       method_argument, object_argument, 
param_objects);
+               }
+
+               public override ITargetObject RuntimeInvoke (TargetAddress 
method_argument,
+                                                            ITargetObject 
object_argument,
+                                                            ITargetObject[] 
param_objects,
+                                                            out string 
exc_message)
+               {
+                       if (sse.ThreadManager.InBackgroundThread)
+                               throw new InvalidOperationException ();
+                       else
+                               return sse.Process.RuntimeInvoke (
+                                       method_argument, object_argument, 
param_objects,
+                                       out exc_message);
+               }
+
                public override object Invoke (TargetAccessDelegate func, 
object data)
                {
                        if (sse.ThreadManager.InBackgroundThread)

Modified: trunk/debugger/backends/classes/AbsoluteTargetLocation.cs
===================================================================
--- trunk/debugger/backends/classes/AbsoluteTargetLocation.cs   2005-09-07 
13:20:40 UTC (rev 49632)
+++ trunk/debugger/backends/classes/AbsoluteTargetLocation.cs   2005-09-07 
13:54:13 UTC (rev 49633)
@@ -22,6 +22,12 @@
                        this.address = address;
                }
 
+               public AbsoluteTargetLocation (ITargetAccess target, 
TargetAddress address)
+                       : base (null, target, false)
+               {
+                       this.address = address;
+               }
+
                public override bool HasAddress {
                        get { return true; }
                }

Modified: trunk/debugger/backends/mono/MonoClassInfo.cs
===================================================================
--- trunk/debugger/backends/mono/MonoClassInfo.cs       2005-09-07 13:20:40 UTC 
(rev 49632)
+++ trunk/debugger/backends/mono/MonoClassInfo.cs       2005-09-07 13:54:13 UTC 
(rev 49633)
@@ -126,22 +126,6 @@
                        }
                }
 
-               internal ITargetFunctionObject GetMethod (TargetLocation 
location, int index)
-               {
-                       try {
-                               initialize (location.TargetAccess);
-
-                               MonoMethodInfo minfo = Type.GetMethod (index);
-                               IMonoTypeInfo mtype = minfo.Type.GetTypeInfo ();
-                               if (mtype == null)
-                                       return null;
-
-                               return (ITargetFunctionObject) mtype.GetObject 
(location);
-                       } catch (TargetException ex) {
-                               throw new LocationInvalidException (ex);
-                       }
-               }
-
                internal TargetAddress GetMethodAddress (ITargetAccess target, 
int token)
                {
                        try {
@@ -154,18 +138,6 @@
                        }
                }
 
-               internal ITargetObject GetProperty (TargetLocation location, 
int index)
-               {
-                       try {
-                               initialize (location.TargetAccess);
-
-                               MonoPropertyInfo pinfo = Type.Properties 
[index];
-                               return pinfo.Get (location);
-                       } catch (TargetException ex) {
-                               throw new LocationInvalidException (ex);
-                       }
-               }
-
                public override MonoObject GetObject (TargetLocation location)
                {
                        return new MonoClassObject (this, location);

Modified: trunk/debugger/backends/mono/MonoClassObject.cs
===================================================================
--- trunk/debugger/backends/mono/MonoClassObject.cs     2005-09-07 13:20:40 UTC 
(rev 49632)
+++ trunk/debugger/backends/mono/MonoClassObject.cs     2005-09-07 13:54:13 UTC 
(rev 49633)
@@ -38,7 +38,7 @@
 
                public ITargetObject GetProperty (int index)
                {
-                       return type.GetProperty (location, index);
+                       return type.Type.GetProperty (this, index);
                }
 
                public ITargetObject GetEvent (int index)
@@ -49,7 +49,7 @@
 
                public ITargetFunctionObject GetMethod (int index)
                {
-                       return type.GetMethod (location, index);
+                       return type.Type.GetMethod (location.TargetAccess, 
index);
                }
 
                public string PrintObject ()
@@ -78,7 +78,8 @@
                        }
 
                        try {
-                               ITargetObject retval = func.Invoke (args, 
false);
+                               ITargetObject retval = func.Invoke (
+                                       location.TargetAccess, this, args, 
false);
 
                                return retval.Print();
                        }

Modified: trunk/debugger/backends/mono/MonoClassType.cs
===================================================================
--- trunk/debugger/backends/mono/MonoClassType.cs       2005-09-07 13:20:40 UTC 
(rev 49632)
+++ trunk/debugger/backends/mono/MonoClassType.cs       2005-09-07 13:54:13 UTC 
(rev 49633)
@@ -1,8 +1,11 @@
 using System;
 using System.Text;
+using System.Collections;
 using R = System.Reflection;
 using C = Mono.CompilerServices.SymbolWriter;
 
+using Mono.Debugger.Backends;
+
 namespace Mono.Debugger.Languages.Mono
 {
        internal class MonoClassType : MonoType, ITargetClassType
@@ -132,15 +135,6 @@
                        }
                }
 
-               public MonoMethodInfo GetMethod (int index)
-               {
-                       get_methods ();
-                       if (index < first_method)
-                               return parent_type.GetMethod (index);
-
-                       return methods [index - first_method];
-               }
-
                void get_methods ()
                {
                        if (methods != null)
@@ -196,22 +190,43 @@
                        }
                }
 
-               public ITargetFunctionObject GetStaticMethod (StackFrame frame, 
int index)
+               protected ITargetFunctionObject CreateFunctionObject 
(ITargetAccess target,
+                                                                     
MonoFunctionType ftype)
                {
-                       get_methods ();
-
-                       if (index < first_smethod)
-                               return parent_type.GetStaticMethod (frame, 
index);
-
                        try {
-                               MonoFunctionType ftype = static_methods [index 
- first_smethod].FunctionType;
+                               MonoClassInfo info = GetTypeInfo () as 
MonoClassInfo;
+                               if (info == null)
+                                       return null;
 
-                               return ftype.GetStaticObject (frame);
+                               TargetAddress address = info.GetMethodAddress 
(target, ftype.Token);
+                               return ftype.GetObject (new 
AbsoluteTargetLocation (target, address));
                        } catch (TargetException ex) {
                                throw new LocationInvalidException (ex);
                        }
                }
 
+               public ITargetFunctionObject GetMethod (ITargetAccess target, 
int index)
+               {
+                       get_methods ();
+
+                       if (index < first_method)
+                               return parent_type.GetMethod (target, index);
+
+                       return CreateFunctionObject (
+                               target, methods [index - 
first_method].FunctionType);
+               }
+
+               public ITargetFunctionObject GetStaticMethod (ITargetAccess 
target, int index)
+               {
+                       get_methods ();
+
+                       if (index < first_smethod)
+                               return parent_type.GetStaticMethod (target, 
index);
+
+                       return CreateFunctionObject (
+                               target, static_methods [index - 
first_smethod].FunctionType);
+               }
+
                void get_properties ()
                {
                        if (properties != null)
@@ -258,12 +273,31 @@
                        get { return StaticProperties; }
                }
 
-               public ITargetObject GetStaticProperty (StackFrame frame, int 
index)
+               internal ITargetObject GetProperty (MonoClassObject instance, 
int index)
                {
-                       get_properties ();
-                       return static_properties [index].Get (frame);
+                       try {
+                               get_properties ();
+                               ITargetAccess target = 
instance.Location.TargetAccess;
+                               ITargetFunctionObject func = 
CreateFunctionObject (
+                                       target, properties [index].Getter);
+                               return func.Invoke (target, instance, new 
ITargetObject [0], false);
+                       } catch (TargetException ex) {
+                               throw new LocationInvalidException (ex);
+                       }
                }
 
+               public ITargetObject GetStaticProperty (ITargetAccess target, 
int index)
+               {
+                       try {
+                               get_properties ();
+                               ITargetFunctionObject func = 
CreateFunctionObject (
+                                       target, static_properties 
[index].Getter);
+                               return func.Invoke (target, null, new 
ITargetObject [0], false);
+                       } catch (TargetException ex) {
+                               throw new LocationInvalidException (ex);
+                       }
+               }
+
                void get_events ()
                {
                        if (events != null)
@@ -348,12 +382,6 @@
                        }
                }
 
-               public ITargetFunctionObject GetConstructor (StackFrame frame, 
int index)
-               {
-                       get_constructors ();
-                       return constructors [index].Get (frame);
-               }
-
                public ITargetMethodInfo[] StaticConstructors {
                        get {
                                get_constructors ();
@@ -361,16 +389,58 @@
                        }
                }
 
-               public ITargetFunctionObject GetStaticConstructor (StackFrame 
frame, int index)
+               public ITargetFunctionObject GetConstructor (ITargetAccess 
target, int index)
                {
                        get_constructors ();
-                       return static_constructors [index].Get (frame);
+                       return CreateFunctionObject (
+                               target, constructors [index].FunctionType);
                }
 
+               public ITargetFunctionObject GetStaticConstructor 
(ITargetAccess target, int index)
+               {
+                       get_constructors ();
+                       return CreateFunctionObject (
+                               target, static_constructors 
[index].FunctionType);
+               }
+
                protected override IMonoTypeInfo DoGetTypeInfo 
(TargetBinaryReader info)
                {
                        return new MonoClassInfo (this, info);
                }
 
+               [Command]
+               public ITargetMemberInfo FindMember (string name, bool 
search_static,
+                                                    bool search_instance)
+               {
+                       if (search_static) {
+                               foreach (ITargetFieldInfo field in StaticFields)
+                                       if (field.Name == name)
+                                               return field;
+
+                               foreach (ITargetPropertyInfo property in 
StaticProperties)
+                                       if (property.Name == name)
+                                               return property;
+
+                               foreach (ITargetEventInfo ev in StaticEvents)
+                                       if (ev.Name == name)
+                                               return ev;
+                       }
+
+                       if (search_instance) {
+                               foreach (ITargetFieldInfo field in Fields)
+                                       if (field.Name == name)
+                                               return field;
+
+                               foreach (ITargetPropertyInfo property in 
Properties)
+                                       if (property.Name == name)
+                                               return property;
+
+                               foreach (ITargetEventInfo ev in Events)
+                                       if (ev.Name == name)
+                                               return ev;
+                       }
+
+                       return null;
+               }
        }
 }

Modified: trunk/debugger/backends/mono/MonoFunctionObject.cs
===================================================================
--- trunk/debugger/backends/mono/MonoFunctionObject.cs  2005-09-07 13:20:40 UTC 
(rev 49632)
+++ trunk/debugger/backends/mono/MonoFunctionObject.cs  2005-09-07 13:54:13 UTC 
(rev 49633)
@@ -22,16 +22,13 @@
                        throw new InvalidOperationException ();
                }
 
-               public ITargetObject Invoke (MonoObject[] args, bool debug)
+               public ITargetObject Invoke (ITargetAccess target, 
ITargetObject instance,
+                                            ITargetObject[] args, bool debug)
                {
-                       return type.Invoke (location, args, debug);
-               }
-
-               ITargetObject ITargetFunctionObject.Invoke (ITargetObject[] 
args, bool debug)
-               {
                        MonoObject[] margs = new MonoObject [args.Length];
                        args.CopyTo (margs, 0);
-                       return Invoke (margs, debug);
+                       return type.Invoke (target, location.Address,
+                                           (MonoObject) instance, margs, 
debug);
                }
        }
 }

Modified: trunk/debugger/backends/mono/MonoFunctionType.cs
===================================================================
--- trunk/debugger/backends/mono/MonoFunctionType.cs    2005-09-07 13:20:40 UTC 
(rev 49632)
+++ trunk/debugger/backends/mono/MonoFunctionType.cs    2005-09-07 13:54:13 UTC 
(rev 49633)
@@ -79,102 +79,28 @@
                        get { return method_info; }
                }
 
-               protected ITargetObject Invoke (StackFrame frame, TargetAddress 
this_object,
-                                               MonoObject[] args, bool debug)
+               internal ITargetObject Invoke (ITargetAccess target, 
TargetAddress method,
+                                              MonoObject instance, 
MonoObject[] args, bool debug)
                {
-                       TargetAddress exc_object;
-
-                       MonoClassInfo class_info = klass.GetTypeInfo () as 
MonoClassInfo;
-                       if (class_info == null)
-                               return null;
-
-                       TargetAddress method = class_info.GetMethodAddress (
-                               frame.TargetAccess, Token);
-
                        if (ParameterTypes.Length != args.Length)
                                throw new ArgumentException ();
 
-                       TargetAddress[] arg_ptr = new TargetAddress 
[args.Length];
-                       for (int i = 0; i < args.Length; i++) {
-                               if (args [i].Location.HasAddress) {
-                                       arg_ptr [i] = args [i].Location.Address;
-                                       continue;
-                               }
-
-                               Heap heap = File.MonoLanguage.DataHeap;
-                               byte[] contents = args [i].RawContents;
-                               TargetLocation new_loc = heap.Allocate (
-                                       frame.TargetAccess, contents.Length);
-                               
frame.TargetAccess.TargetMemoryAccess.WriteBuffer (
-                                       new_loc.Address, contents);
-
-                               arg_ptr [i] = new_loc.Address;
-                       }
-
                        if (debug) {
-                               frame.Process.RuntimeInvoke (
-                                       frame, method, this_object, arg_ptr);
+                               target.RuntimeInvoke (method, instance, args);
                                return null;
                        }
 
-                       bool exc;
-                       TargetAddress retval = frame.Process.RuntimeInvoke (
-                               frame, method, this_object, arg_ptr, out exc);
+                       string exc_message;
+                       ITargetObject retval = target.RuntimeInvoke (
+                               method, instance, args, out exc_message);
 
-                       if (exc) {
-                               exc_object = retval;
-                               retval = TargetAddress.Null;
-                       } else {
-                               exc_object = TargetAddress.Null;
-                       }
-
-                       MonoBuiltinTypeInfo builtin = 
File.MonoLanguage.BuiltinTypes;
-                       IMonoTypeInfo object_type = 
builtin.ObjectType.GetTypeInfo ();
-                       IMonoTypeInfo string_type = 
builtin.StringType.GetTypeInfo ();
-
-                       if (retval.IsNull) {
-                               if (exc_object.IsNull)
-                                       return null;
-
-                               TargetLocation exc_loc = new 
AbsoluteTargetLocation (frame, exc_object);
-                               MonoStringObject exc_obj = (MonoStringObject) 
string_type.GetObject (exc_loc);
-                               string exc_message = (string) exc_obj.Object;
-
+                       if (exc_message != null)
                                throw new TargetException (
                                        TargetError.InvocationException, 
exc_message);
-                       }
 
-                       TargetLocation retval_loc = new AbsoluteTargetLocation 
(frame, retval);
-                       MonoObjectObject retval_obj = (MonoObjectObject) 
object_type.GetObject (retval_loc);
-
-                       if ((retval_obj == null) || 
!retval_obj.HasDereferencedObject ||
-                           (ReturnType == builtin.ObjectType))
-                               return retval_obj;
-                       else
-                               return retval_obj.DereferencedObject;
+                       return retval;
                }
 
-               internal ITargetObject Invoke (TargetLocation location, 
MonoObject[] args,
-                                              bool debug)
-               {
-                       return Invoke (location.StackFrame, location.Address, 
args, debug);
-               }
-
-               ITargetObject ITargetFunctionType.InvokeStatic (StackFrame 
frame,
-                                                               ITargetObject[] 
args,
-                                                               bool debug)
-               {
-                       MonoObject[] margs = new MonoObject [args.Length];
-                       args.CopyTo (margs, 0);
-                       return InvokeStatic (frame, margs, debug);
-               }
-
-               public ITargetObject InvokeStatic (StackFrame frame, 
MonoObject[] args,
-                                                  bool debug)
-               {
-                       return Invoke (frame, TargetAddress.Null, args, debug);
-               }
-
                protected override IMonoTypeInfo DoGetTypeInfo 
(TargetBinaryReader info)
                {
                        throw new InvalidOperationException ();
@@ -192,14 +118,14 @@
                        get { return this; }
                }
 
-               public MonoObject GetObject (TargetLocation location)
+               public MonoFunctionObject GetObject (TargetLocation location)
                {
                        return new MonoFunctionObject (this, location);
                }
 
-               public MonoFunctionObject GetStaticObject (StackFrame frame)
+               MonoObject IMonoTypeInfo.GetObject (TargetLocation location)
                {
-                       return new MonoFunctionObject (this, new 
AbsoluteTargetLocation (frame, TargetAddress.Null));
+                       return new MonoFunctionObject (this, location);
                }
        }
 }

Modified: trunk/debugger/backends/mono/MonoMember.cs
===================================================================
--- trunk/debugger/backends/mono/MonoMember.cs  2005-09-07 13:20:40 UTC (rev 
49632)
+++ trunk/debugger/backends/mono/MonoMember.cs  2005-09-07 13:54:13 UTC (rev 
49633)
@@ -150,11 +150,6 @@
                        return String.Format ("{0}({1})", Name, sb.ToString ());
                }
 
-               internal ITargetFunctionObject Get (StackFrame frame)
-               {
-                       return FunctionType.GetStaticObject (frame);
-               }
-
                protected override string MyToString ()
                {
                        return String.Format ("{0}", FunctionType);
@@ -210,7 +205,7 @@
        {
                MonoType type;
                public readonly MonoClassType Klass;
-               public readonly MonoFunctionType GetterType, SetterType;
+               public readonly MonoFunctionType Getter, Setter;
                public readonly bool CanRead, CanWrite;
 
                internal MonoPropertyInfo (MonoClassType klass, int index, 
R.PropertyInfo pinfo,
@@ -224,12 +219,12 @@
 
                        if (CanRead) {
                                R.MethodInfo getter = pinfo.GetGetMethod (true);
-                               GetterType = new MonoFunctionType (File, Klass, 
getter);
+                               Getter = new MonoFunctionType (File, Klass, 
getter);
                        }
 
                        if (CanWrite) {
                                R.MethodInfo setter = pinfo.GetSetMethod (true);
-                               SetterType = new MonoFunctionType (File, Klass, 
setter);
+                               Setter = new MonoFunctionType (File, Klass, 
setter);
                        }
                }
 
@@ -246,7 +241,7 @@
                                if (!CanRead)
                                        throw new InvalidOperationException ();
 
-                               return GetterType;
+                               return Getter;
                        }
                }
 
@@ -261,31 +256,10 @@
                                if (!CanWrite)
                                        throw new InvalidOperationException ();
 
-                               return SetterType;
+                               return Setter;
                        }
                }
 
-               internal ITargetObject Get (TargetLocation location)
-               {
-                       if (!CanRead)
-                               throw new InvalidOperationException ();
-
-                       ITargetFunctionObject func = GetterType.GetObject 
(location) as ITargetFunctionObject;
-                       if (func == null)
-                               return null;
-
-                       ITargetObject retval = func.Invoke (new MonoObject [0], 
false);
-                       return retval;
-               }
-
-               internal ITargetObject Get (StackFrame frame)
-               {
-                       if (!CanRead)
-                               throw new InvalidOperationException ();
-
-                       return GetterType.InvokeStatic (frame, new MonoObject 
[0], false);
-               }
-
                protected override string MyToString ()
                {
                        return String.Format ("{0}:{1}", CanRead, CanWrite);

Modified: trunk/debugger/backends/native/NativeFunctionObject.cs
===================================================================
--- trunk/debugger/backends/native/NativeFunctionObject.cs      2005-09-07 
13:20:40 UTC (rev 49632)
+++ trunk/debugger/backends/native/NativeFunctionObject.cs      2005-09-07 
13:54:13 UTC (rev 49633)
@@ -18,18 +18,12 @@
                        }
                }
 
-               public NativeObject Invoke (NativeObject[] args)
+               public ITargetObject Invoke (ITargetAccess target, 
ITargetObject instance,
+                                            ITargetObject[] args, bool debug)
                {
-                       return null;
+                       throw new NotSupportedException ();
                }
 
-               ITargetObject ITargetFunctionObject.Invoke (ITargetObject[] 
args, bool debug)
-               {
-                       NativeObject[] nargs = new NativeObject [args.Length];
-                       args.CopyTo (nargs, 0);
-                       return Invoke (nargs);
-               }
-
                protected override long GetDynamicSize (TargetBlob blob, 
TargetLocation location,
                                                        out TargetLocation 
dynamic_location)
                {

Modified: trunk/debugger/backends/native/NativeFunctionType.cs
===================================================================
--- trunk/debugger/backends/native/NativeFunctionType.cs        2005-09-07 
13:20:40 UTC (rev 49632)
+++ trunk/debugger/backends/native/NativeFunctionType.cs        2005-09-07 
13:54:13 UTC (rev 49633)
@@ -66,12 +66,5 @@
                {
                        return new NativeFunctionObject (this, location);
                }
-
-               ITargetObject ITargetFunctionType.InvokeStatic (StackFrame 
frame,
-                                                               ITargetObject[] 
args,
-                                                               bool debug)
-               {
-                       throw new NotImplementedException ();
-               }
        }
 }

Modified: trunk/debugger/backends/native/NativeStructType.cs
===================================================================
--- trunk/debugger/backends/native/NativeStructType.cs  2005-09-07 13:20:40 UTC 
(rev 49632)
+++ trunk/debugger/backends/native/NativeStructType.cs  2005-09-07 13:54:13 UTC 
(rev 49633)
@@ -201,7 +201,7 @@
                        }
                }
 
-               public ITargetObject GetStaticProperty (StackFrame frame, int 
index)
+               public ITargetObject GetStaticProperty (ITargetAccess target, 
int index)
                {
                        throw new InvalidOperationException ();
                }
@@ -247,21 +247,26 @@
                        }
                }
 
-               public ITargetFunctionObject GetStaticMethod (StackFrame frame, 
int index)
+               public ITargetFunctionObject GetMethod (ITargetAccess target, 
int index)
                {
                        throw new InvalidOperationException ();
                }
 
-               public ITargetFunctionObject GetConstructor (StackFrame frame, 
int index)
+               public ITargetFunctionObject GetStaticMethod (ITargetAccess 
target, int index)
                {
                        throw new InvalidOperationException ();
                }
 
-               public ITargetFunctionObject GetStaticConstructor (StackFrame 
frame, int index)
+               public ITargetFunctionObject GetConstructor (ITargetAccess 
target, int index)
                {
                        throw new InvalidOperationException ();
                }
 
+               public ITargetFunctionObject GetStaticConstructor 
(ITargetAccess target, int index)
+               {
+                       throw new InvalidOperationException ();
+               }
+
                public override NativeObject GetObject (TargetLocation location)
                {
                        return new NativeStructObject (this, location);

Modified: trunk/debugger/backends/server/library.c
===================================================================
--- trunk/debugger/backends/server/library.c    2005-09-07 13:20:40 UTC (rev 
49632)
+++ trunk/debugger/backends/server/library.c    2005-09-07 13:54:13 UTC (rev 
49633)
@@ -195,16 +195,17 @@
 
 ServerCommandError
 mono_debugger_server_call_method_invoke (ServerHandle *handle, guint64 
invoke_method,
-                                        guint64 method_argument, guint64 
object_argument,
-                                        guint32 num_params, guint64 
*param_data,
+                                        guint64 method_argument, guint32 
num_params,
+                                        guint32 blob_size, guint64 *param_data,
+                                        guint32 *offset_data, gconstpointer 
blob_data,
                                         guint64 callback_argument, gboolean 
debug)
 {
        if (!global_vtable->call_method_invoke)
                return COMMAND_ERROR_NOT_IMPLEMENTED;
 
        return (* global_vtable->call_method_invoke) (
-               handle, invoke_method, method_argument, object_argument, 
num_params,
-               param_data, callback_argument, debug);
+               handle, invoke_method, method_argument, num_params, blob_size,
+               param_data, offset_data, blob_data, callback_argument, debug);
 }
 
 ServerCommandError

Modified: trunk/debugger/backends/server/server.h
===================================================================
--- trunk/debugger/backends/server/server.h     2005-09-07 13:20:40 UTC (rev 
49632)
+++ trunk/debugger/backends/server/server.h     2005-09-07 13:54:13 UTC (rev 
49633)
@@ -205,9 +205,11 @@
        ServerCommandError    (* call_method_invoke)  (ServerHandle     *handle,
                                                       guint64           
invoke_method,
                                                       guint64           
method_argument,
-                                                      guint64           
object_argument,
                                                       guint32           
num_params,
+                                                      guint32           
glob_size,
                                                       guint64          
*param_data,
+                                                      guint32          
*offset_data,
+                                                      gconstpointer     
blob_data,
                                                       guint64           
callback_argument,
                                                       gboolean          debug);
 
@@ -397,9 +399,11 @@
 mono_debugger_server_call_method_invoke   (ServerHandle       *handle,
                                           guint64             invoke_method,
                                           guint64             method_argument,
-                                          guint64             object_argument,
                                           guint32             num_params,
+                                          guint32             blob_size,
                                           guint64            *param_data,
+                                          guint32            *offset_data,
+                                          gconstpointer       blob_data,
                                           guint64             
callback_argument,
                                           gboolean            debug);
 

Modified: trunk/debugger/backends/server/x86_64-arch.c
===================================================================
--- trunk/debugger/backends/server/x86_64-arch.c        2005-09-07 13:20:40 UTC 
(rev 49632)
+++ trunk/debugger/backends/server/x86_64-arch.c        2005-09-07 13:54:13 UTC 
(rev 49633)
@@ -613,14 +613,15 @@
 
 static ServerCommandError
 server_ptrace_call_method_invoke (ServerHandle *handle, guint64 invoke_method,
-                                 guint64 method_argument, guint64 
object_argument,
-                                 guint32 num_params, guint64 *param_data,
+                                 guint64 method_argument, guint32 num_params,
+                                 guint32 blob_size, guint64 *param_data,
+                                 gint32 *offset_data, gconstpointer blob_data,
                                  guint64 callback_argument, gboolean debug)
 {
        ServerCommandError result = COMMAND_ERROR_NONE;
        ArchInfo *arch = handle->arch;
        RuntimeInvokeData *rdata;
-       long new_rsp;
+       guint64 new_rsp;
        int i;
 
        static guint8 static_code[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00,
@@ -628,20 +629,26 @@
                                        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00,
                                        0xcc };
        int static_size = sizeof (static_code);
-       int size = static_size + (num_params + 2) * 8;
+       int size = static_size + (num_params + 3) * 8 + blob_size;
        guint8 *code = g_malloc0 (size);
-       guint32 *ptr = (guint32 *) (code + static_size);
+       guint64 *ptr = (guint64 *) (code + static_size + blob_size);
+       guint64 blob_start;
        memcpy (code, static_code, static_size);
+       memcpy (code + static_size, blob_data, blob_size);
 
-       for (i = 0; i < num_params; i++)
-               ptr [i] = param_data [i];
-       ptr [num_params] = 0;
-
        if (arch->saved_regs)
                return COMMAND_ERROR_RECURSIVE_CALL;
 
        new_rsp = INFERIOR_REG_RSP (arch->current_regs) - size;
+       blob_start = new_rsp + static_size;
 
+       for (i = 0; i < num_params; i++) {
+               if (offset_data [i] >= 0)
+                       ptr [i] = blob_start + offset_data [i];
+               else
+                       ptr [i] = param_data [i];
+       }
+
        *((guint64 *) code) = new_rsp + 24;
        *((guint64 *) (code+8)) = callback_argument;
 
@@ -658,8 +665,8 @@
 
        INFERIOR_REG_RIP (arch->current_regs) = invoke_method;
        INFERIOR_REG_RDI (arch->current_regs) = method_argument;
-       INFERIOR_REG_RSI (arch->current_regs) = object_argument;
-       INFERIOR_REG_RDX (arch->current_regs) = new_rsp + static_size;
+       INFERIOR_REG_RSI (arch->current_regs) = ptr [0];
+       INFERIOR_REG_RDX (arch->current_regs) = new_rsp + static_size + 
blob_size + 8;
        INFERIOR_REG_RCX (arch->current_regs) = new_rsp + 16;
        INFERIOR_REG_RSP (arch->current_regs) = new_rsp;
 

Modified: trunk/debugger/frontend/Expression.cs
===================================================================
--- trunk/debugger/frontend/Expression.cs       2005-09-07 13:20:40 UTC (rev 
49632)
+++ trunk/debugger/frontend/Expression.cs       2005-09-07 13:54:13 UTC (rev 
49633)
@@ -788,6 +788,10 @@
                        get { return instance == null; }
                }
 
+               public ITargetObject InstanceObject {
+                       get { return instance; }
+               }
+
                protected override Expression DoResolve (ScriptingContext 
context)
                {
                        return this;
@@ -819,7 +823,7 @@
                        ITargetMethodInfo method = OverloadResolve (context, 
arguments);
 
                        if (method.IsStatic)
-                               return stype.GetStaticMethod (frame, 
method.Index);
+                               return stype.GetStaticMethod 
(frame.TargetAccess, method.Index);
                        else if (!IsStatic)
                                return instance.GetMethod (method.Index);
                        else
@@ -1233,7 +1237,7 @@
                protected ITargetObject GetStaticProperty (ITargetStructType 
stype, StackFrame frame, ITargetPropertyInfo property)
                {
                        try {
-                               return stype.GetStaticProperty (frame, 
property.Index);
+                               return stype.GetStaticProperty 
(frame.TargetAccess, property.Index);
                        } catch (TargetInvocationException ex) {
                                throw new ScriptingException ("Can't get 
property {0}: {1}", Name, ex.Message);
                        }
@@ -1250,11 +1254,15 @@
 
                protected ITargetObject GetStaticEvent (ITargetStructType 
stype, StackFrame frame, ITargetEventInfo ev)
                {
+#if FIXME
                        try {
                                return stype.GetStaticEvent (frame, ev.Index);
                        } catch (TargetInvocationException ex) {
                                throw new ScriptingException ("Can't get event 
{0}: {1}", Name, ex.Message);
                        }
+#else
+                       throw new NotImplementedException ();
+#endif
                }
 
                protected ITargetObject GetMember (ITargetStructObject sobj, 
ITargetMemberInfo member)
@@ -2058,7 +2066,9 @@
                                objs [i] = args [i].EvaluateVariable (context);
 
                        try {
-                               ITargetObject retval = func.Invoke (objs, 
debug);
+                               ITargetObject retval = func.Invoke (
+                                       
context.CurrentFrame.Frame.TargetAccess, mg.InstanceObject,
+                                       objs, debug);
                                if (!debug && !func.Type.HasReturnValue)
                                        throw new ScriptingException ("Method 
`{0}' doesn't return a value.", Name);
 
@@ -2145,14 +2155,15 @@
                                        "for your list of arguments.", 
type_expr.Name);
 
                        ITargetFunctionObject ctor = stype.GetConstructor (
-                               frame.Frame, method.Index);
+                               frame.Frame.TargetAccess, method.Index);
 
                        ITargetObject[] args = new ITargetObject 
[arguments.Length];
                        for (int i = 0; i < arguments.Length; i++)
                                args [i] = arguments [i].EvaluateVariable 
(context);
 
                        try {
-                               return ctor.Type.InvokeStatic (frame.Frame, 
args, debug);
+                               return ctor.Invoke (
+                                       frame.Frame.TargetAccess, null, args, 
debug);
                        } catch (TargetInvocationException ex) {
                                throw new ScriptingException (
                                        "Invocation of type `{0}'s constructor 
raised an " +

Modified: trunk/debugger/interfaces/ITargetFunctionObject.cs
===================================================================
--- trunk/debugger/interfaces/ITargetFunctionObject.cs  2005-09-07 13:20:40 UTC 
(rev 49632)
+++ trunk/debugger/interfaces/ITargetFunctionObject.cs  2005-09-07 13:54:13 UTC 
(rev 49633)
@@ -6,6 +6,7 @@
                        get;
                }
 
-               ITargetObject Invoke (ITargetObject[] args, bool debug);
+               ITargetObject Invoke (ITargetAccess target, ITargetObject 
instance,
+                                     ITargetObject[] args, bool debug);
        }
 }

Modified: trunk/debugger/interfaces/ITargetFunctionType.cs
===================================================================
--- trunk/debugger/interfaces/ITargetFunctionType.cs    2005-09-07 13:20:40 UTC 
(rev 49632)
+++ trunk/debugger/interfaces/ITargetFunctionType.cs    2005-09-07 13:54:13 UTC 
(rev 49633)
@@ -20,14 +20,10 @@
 
                // <summary>
                //   The current programming language's native representation of
-               //   a method.  This is a System.Reflection.MethodInfo for 
managed
-               //   data types.
+               //   a method.
                // </summary>
                object MethodHandle {
                        get;
                }
-
-               ITargetObject InvokeStatic (StackFrame frame, ITargetObject[] 
args,
-                                           bool debug);
        }
 }

Modified: trunk/debugger/interfaces/ITargetMemoryAccess.cs
===================================================================
--- trunk/debugger/interfaces/ITargetMemoryAccess.cs    2005-09-07 13:20:40 UTC 
(rev 49632)
+++ trunk/debugger/interfaces/ITargetMemoryAccess.cs    2005-09-07 13:54:13 UTC 
(rev 49633)
@@ -1,6 +1,8 @@
 using System;
 using System.IO;
 
+using Mono.Debugger.Languages;
+
 namespace Mono.Debugger
 {
        public interface ITargetInfo
@@ -164,6 +166,15 @@
                TargetAddress CallMethod (TargetAddress method, TargetAddress 
arg1,
                                          TargetAddress arg2);
 
+               void RuntimeInvoke (TargetAddress method_argument,
+                                   ITargetObject object_argument,
+                                   ITargetObject[] param_objects);
+
+               ITargetObject RuntimeInvoke (TargetAddress method_argument,
+                                            ITargetObject object_argument,
+                                            ITargetObject[] param_objects,
+                                            out string exc_message);
+
                object Invoke (TargetAccessDelegate func, object user_data);
        }
 }

Modified: trunk/debugger/interfaces/ITargetStructType.cs
===================================================================
--- trunk/debugger/interfaces/ITargetStructType.cs      2005-09-07 13:20:40 UTC 
(rev 49632)
+++ trunk/debugger/interfaces/ITargetStructType.cs      2005-09-07 13:54:13 UTC 
(rev 49633)
@@ -93,7 +93,7 @@
                        get;
                }
 
-               ITargetObject GetStaticProperty (StackFrame frame, int index);
+               ITargetObject GetStaticProperty (ITargetAccess target, int 
index);
 
                ITargetEventInfo[] Events {
                        get;
@@ -103,8 +103,6 @@
                        get;
                }
 
-               ITargetObject GetStaticEvent (StackFrame frame, int index);
-
                ITargetMethodInfo[] Methods {
                        get;
                }
@@ -113,19 +111,20 @@
                        get;
                }
 
-               ITargetFunctionObject GetStaticMethod (StackFrame frame, int 
index);
+               ITargetFunctionObject GetMethod (ITargetAccess target, int 
index);
 
+               ITargetFunctionObject GetStaticMethod (ITargetAccess target, 
int index);
 
                ITargetMethodInfo[] Constructors {
                        get;
                }
 
-               ITargetFunctionObject GetConstructor (StackFrame frame, int 
index);
-
                ITargetMethodInfo[] StaticConstructors {
                        get;
                }
 
-               ITargetFunctionObject GetStaticConstructor (StackFrame frame, 
int index);
+               ITargetFunctionObject GetConstructor (ITargetAccess target, int 
index);
+
+               ITargetFunctionObject GetStaticConstructor (ITargetAccess 
target, int index);
        }
 }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to