Author: martin
Date: 2007-09-10 18:15:07 -0400 (Mon, 10 Sep 2007)
New Revision: 85610

Added:
   branches/martin/debugger-generics/languages/TargetMethodFrameInfo.cs
   branches/martin/debugger-generics/languages/mono/MonoGenericInst.cs
   branches/martin/debugger-generics/languages/mono/MonoGenericParameterType.cs
Modified:
   branches/martin/debugger-generics/backend/MonoThreadManager.cs
   branches/martin/debugger-generics/backend/arch/DwarfReader.cs
   branches/martin/debugger-generics/classes/Method.cs
   branches/martin/debugger-generics/classes/StackFrame.cs
   branches/martin/debugger-generics/languages/mono/MonoLanguageBackend.cs
   branches/martin/debugger-generics/languages/mono/MonoSymbolFile.cs
   branches/martin/debugger-generics/languages/mono/MonoVariable.cs
Log:
Daily backup.


Modified: branches/martin/debugger-generics/backend/MonoThreadManager.cs
===================================================================
--- branches/martin/debugger-generics/backend/MonoThreadManager.cs      
2007-09-10 22:12:20 UTC (rev 85609)
+++ branches/martin/debugger-generics/backend/MonoThreadManager.cs      
2007-09-10 22:15:07 UTC (rev 85610)
@@ -399,6 +399,9 @@
                public readonly int MonoDefaultsDelegateOffset;
                public readonly int MonoDefaultsExceptionOffset;
 
+               public readonly int MonoMethodFlagsOffset;
+               public readonly int MonoMethodInflatedOffset;
+
                public MonoMetadataInfo (TargetMemoryAccess memory, 
TargetAddress address)
                {
                        int size = memory.ReadInteger (address);
@@ -454,6 +457,9 @@
                        MonoDefaultsArrayOffset = reader.ReadInt32 ();
                        MonoDefaultsDelegateOffset = reader.ReadInt32 ();
                        MonoDefaultsExceptionOffset = reader.ReadInt32 ();
+
+                       MonoMethodFlagsOffset = reader.ReadInt32 ();
+                       MonoMethodInflatedOffset = reader.ReadInt32 ();
                }
        }
 }

Modified: branches/martin/debugger-generics/backend/arch/DwarfReader.cs
===================================================================
--- branches/martin/debugger-generics/backend/arch/DwarfReader.cs       
2007-09-10 22:12:20 UTC (rev 85609)
+++ branches/martin/debugger-generics/backend/arch/DwarfReader.cs       
2007-09-10 22:15:07 UTC (rev 85610)
@@ -2623,6 +2623,11 @@
                                return true;
                        }
 
+                       internal override TargetMethodFrameInfo GetFrameInfo 
(Thread target, StackFrame frame)
+                       {
+                               return null;
+                       }
+
                        internal override MethodSource GetTrampoline 
(TargetMemoryAccess memory, TargetAddress address)
                        {
                                return ((ILanguageBackend) 
subprog.dwarf.bfd).GetTrampoline (memory, address);

Modified: branches/martin/debugger-generics/classes/Method.cs
===================================================================
--- branches/martin/debugger-generics/classes/Method.cs 2007-09-10 22:12:20 UTC 
(rev 85609)
+++ branches/martin/debugger-generics/classes/Method.cs 2007-09-10 22:15:07 UTC 
(rev 85610)
@@ -287,6 +287,8 @@
                internal abstract MethodSource GetTrampoline 
(TargetMemoryAccess memory,
                                                              TargetAddress 
address);
 
+               internal abstract TargetMethodFrameInfo GetFrameInfo (Thread 
target, StackFrame frame);
+
                public TargetVariable GetVariableByName (TargetAddress address, 
string name)
                {
                        foreach (TargetVariable var in Locals) {

Modified: branches/martin/debugger-generics/classes/StackFrame.cs
===================================================================
--- branches/martin/debugger-generics/classes/StackFrame.cs     2007-09-10 
22:12:20 UTC (rev 85609)
+++ branches/martin/debugger-generics/classes/StackFrame.cs     2007-09-10 
22:15:07 UTC (rev 85610)
@@ -6,6 +6,8 @@
 using Mono.Debugger.Languages;
 using Mono.Debugger.Backends;
 
+using MonoLanguage = Mono.Debugger.Languages.Mono;
+
 namespace Mono.Debugger
 {
        [Serializable]
@@ -196,6 +198,7 @@
                Language language;
                bool has_source;
                Symbol name;
+               TargetMethodFrameInfo method_frame_info;
 
                internal StackFrame (Thread thread, TargetAddress address, 
TargetAddress stack_ptr,
                                     TargetAddress frame_address, Registers 
registers)
@@ -227,6 +230,9 @@
                                this.name = new Symbol (method.Name, 
method.StartAddress, 0);
                        else
                                this.name = new Symbol (method.Name, address, 
0);
+
+                       Console.WriteLine ("NEW FRAME: {0}", method);
+                       method_frame_info = method.GetFrameInfo (thread, this);
                }
 
                internal StackFrame (Thread thread, TargetAddress address, 
TargetAddress stack_ptr,
@@ -238,6 +244,8 @@
                        this.language = function.DeclaringType.Language;
                        this.name = new Symbol (function.FullName, address, 0);
                        this.location = location;
+
+                       Console.WriteLine ("NEW FRAME #1: {0}", function);
                }
 
                internal StackFrame (Thread thread, TargetAddress address, 
TargetAddress stack_ptr,

Added: branches/martin/debugger-generics/languages/TargetMethodFrameInfo.cs
===================================================================
--- branches/martin/debugger-generics/languages/TargetMethodFrameInfo.cs        
2007-09-10 22:12:20 UTC (rev 85609)
+++ branches/martin/debugger-generics/languages/TargetMethodFrameInfo.cs        
2007-09-10 22:15:07 UTC (rev 85610)
@@ -0,0 +1,6 @@
+namespace Mono.Debugger.Languages
+{
+       internal abstract class TargetMethodFrameInfo : 
DebuggerMarshalByRefObject
+       { }
+}
+

Added: branches/martin/debugger-generics/languages/mono/MonoGenericInst.cs
===================================================================
--- branches/martin/debugger-generics/languages/mono/MonoGenericInst.cs 
2007-09-10 22:12:20 UTC (rev 85609)
+++ branches/martin/debugger-generics/languages/mono/MonoGenericInst.cs 
2007-09-10 22:15:07 UTC (rev 85610)
@@ -0,0 +1,45 @@
+using System;
+using System.Text;
+using Cecil = Mono.Cecil;
+
+using Mono.Debugger;
+using Mono.Debugger.Backends;
+
+namespace Mono.Debugger.Languages.Mono
+{
+       internal class MonoGenericInst : DebuggerMarshalByRefObject
+       {
+               public MonoGenericInst (TargetMemoryAccess memory, 
TargetAddress address)
+               {
+                       Console.WriteLine ("NEW GENERIC INST: {0}", address);
+
+                       int addr_size = memory.TargetInfo.TargetAddressSize;
+
+                       int header = memory.ReadInteger (address);
+                       TargetAddress type_argv_ptr = memory.ReadAddress 
(address + addr_size);
+
+                       int type_argc = (header & 0x7ff8) >> 3;
+
+                       Console.WriteLine ("NEW GENERIC INST #2: {0:x} {1} {2}",
+                                          header, type_argc, type_argv_ptr);
+
+                       TargetType[] type_argv = new TargetType [type_argc];
+                       for (int i = 0; i < type_argc; i++) {
+                               type_argv [i] = read_type (memory, 
type_argv_ptr + i * addr_size);
+                               // Console.WriteLine ("NEW GENERIC INST #3: {0} 
{1}", i, type_argv [i]);
+                       }
+               }
+
+               static TargetType read_type (TargetMemoryAccess memory, 
TargetAddress address)
+               {
+                       TargetAddress ptr = memory.ReadAddress (address);
+
+                       TargetReader reader = new TargetReader 
(memory.ReadMemory (
+                               ptr, 8 + memory.TargetInfo.TargetAddressSize));
+
+                       Console.WriteLine ("READ TYPE: {0} {1} {2}",
+                                          address, ptr, 
reader.BinaryReader.HexDump ());
+                       return null;
+               }
+       }
+}

Added: 
branches/martin/debugger-generics/languages/mono/MonoGenericParameterType.cs
===================================================================
--- 
branches/martin/debugger-generics/languages/mono/MonoGenericParameterType.cs    
    2007-09-10 22:12:20 UTC (rev 85609)
+++ 
branches/martin/debugger-generics/languages/mono/MonoGenericParameterType.cs    
    2007-09-10 22:15:07 UTC (rev 85610)
@@ -0,0 +1,44 @@
+using System;
+using Cecil = Mono.Cecil;
+
+namespace Mono.Debugger.Languages.Mono
+{
+       internal class MonoGenericParameterType : TargetType
+       {
+               Cecil.GenericParameter gen_param;
+
+               public MonoGenericParameterType (MonoLanguageBackend mono,
+                                                Cecil.GenericParameter 
gen_param)
+                       : base (mono, TargetObjectKind.Alias)
+               {
+                       this.gen_param = gen_param;
+               }
+
+               public override string Name {
+                       get { return gen_param.Name; }
+               }
+
+               public override bool IsByRef {
+                       get { return false; }
+               }
+
+               public override bool HasFixedSize {
+                       get { return false; }
+               }
+
+               public override int Size {
+                       get { throw new InvalidOperationException (); }
+               }
+
+               internal override TargetObject GetObject (TargetLocation 
location)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               internal TargetObject GetObject (StackFrame frame, 
TargetLocation location)
+               {
+                       Console.WriteLine ("GET OBJECT: {0} {1} {2}", this, 
frame, location);
+                       return null;
+               }
+       }
+}

Modified: 
branches/martin/debugger-generics/languages/mono/MonoLanguageBackend.cs
===================================================================
--- branches/martin/debugger-generics/languages/mono/MonoLanguageBackend.cs     
2007-09-10 22:12:20 UTC (rev 85609)
+++ branches/martin/debugger-generics/languages/mono/MonoLanguageBackend.cs     
2007-09-10 22:15:07 UTC (rev 85610)
@@ -286,6 +286,10 @@
                                return new MonoPointerType (element_type);
                        }
 
+                       Cecil.GenericParameter gen_param = type as 
Cecil.GenericParameter;
+                       if (gen_param != null)
+                               return new MonoGenericParameterType (this, 
gen_param);
+
                        int rank = 0;
 
                        string full_name = type.FullName;

Modified: branches/martin/debugger-generics/languages/mono/MonoSymbolFile.cs
===================================================================
--- branches/martin/debugger-generics/languages/mono/MonoSymbolFile.cs  
2007-09-10 22:12:20 UTC (rev 85609)
+++ branches/martin/debugger-generics/languages/mono/MonoSymbolFile.cs  
2007-09-10 22:15:07 UTC (rev 85610)
@@ -105,6 +105,7 @@
        // managed version of struct _MonoDebugMethodAddress
        internal class MethodAddress
        {
+               public readonly TargetAddress MonoMethodPtr;
                public readonly TargetAddress StartAddress;
                public readonly TargetAddress EndAddress;
                public readonly TargetAddress MethodStartAddress;
@@ -133,7 +134,7 @@
                        // as written out in mono_debug_add_method.
                        reader.Position = 16;
                        ReadAddress (reader, domain); // wrapper_data
-                       ReadAddress (reader, domain); // method
+                       MonoMethodPtr = ReadAddress (reader, domain); // method
                        ReadAddress (reader, domain); // address_list
                        StartAddress = ReadAddress (reader, domain);
                        WrapperAddress = ReadAddress (reader, domain);
@@ -904,6 +905,9 @@
                                address = new MethodAddress (
                                        dynamic_reader, domain, 
file.Architecture);
 
+                               Console.WriteLine ("LOAD: {0} {1} {2} {3}", 
method, mdef, address,
+                                                  address.MonoMethodPtr);
+
                                SetAddresses (address.StartAddress, 
address.EndAddress);
                                SetMethodBounds (address.MethodStartAddress, 
address.MethodEndAddress);
 
@@ -911,6 +915,47 @@
                                        this, source, method, 
address.LineNumbers));
                        }
 
+                       internal override TargetMethodFrameInfo GetFrameInfo 
(Thread target, StackFrame frame)
+                       {
+                               Console.WriteLine ("GET METHOD INFO: {0} {1} 
{2}", this, frame, address);
+                               if (!is_loaded)
+                                       return null;
+
+                               MonoMetadataInfo metadata = 
file.MonoLanguage.MonoMetadataInfo;
+
+                               Console.WriteLine ("GET FRAME INFO #1: {0} {1} 
{2}",
+                                                  address.MonoMethodPtr,
+                                                  
metadata.MonoMethodFlagsOffset,
+                                                  
metadata.MonoMethodInflatedOffset);
+
+                               int flags = target.ReadInteger (
+                                       address.MonoMethodPtr + 
metadata.MonoMethodFlagsOffset);
+                               if ((flags & 0x0400) == 0)
+                                       return null;
+
+                               TargetReader reader = new TargetReader 
(target.ReadMemory (
+                                       address.MonoMethodPtr + 
metadata.MonoMethodInflatedOffset,
+                                       3 * target.TargetAddressSize));
+
+                               TargetAddress declaring = reader.ReadAddress ();
+                               TargetAddress class_inst_addr = 
reader.ReadAddress ();
+                               TargetAddress method_inst_addr = 
reader.ReadAddress ();
+
+                               Console.WriteLine ("GET FRAME INFO #2: {0} - 
{1} {2} {3}",
+                                                  reader.BinaryReader.HexDump 
(),
+                                                  declaring, class_inst_addr, 
method_inst_addr);
+
+                               MonoGenericInst class_inst = null;
+                               if (!class_inst_addr.IsNull)
+                                       class_inst = new MonoGenericInst 
(target, class_inst_addr);
+
+                               MonoGenericInst method_inst = null;
+                               if (!method_inst_addr.IsNull)
+                                       method_inst = new MonoGenericInst 
(target, method_inst_addr);
+
+                               return new MonoMethodFrameInfo (this, 
declaring, class_inst, method_inst);
+                       }
+
                        void get_types ()
                        {
                                if (has_types)
@@ -1058,6 +1103,30 @@
                        }
                }
 
+               protected class MonoMethodFrameInfo : TargetMethodFrameInfo
+               {
+                       public readonly MonoMethod Method;
+                       public readonly TargetAddress Declaring;
+                       public readonly MonoGenericInst ClassInst;
+                       public readonly MonoGenericInst MethodInst;
+
+                       public MonoMethodFrameInfo (MonoMethod method, 
TargetAddress declaring,
+                                                   MonoGenericInst class_inst,
+                                                   MonoGenericInst method_inst)
+                       {
+                               this.Method = method;
+                               this.Declaring = declaring;
+                               this.ClassInst = class_inst;
+                               this.MethodInst = method_inst;
+                       }
+
+                       public override string ToString ()
+                       {
+                               return String.Format ("MonoMethodFrameInfo 
({0}:{1}:{2}:{3})",
+                                                     Method, Declaring, 
ClassInst, MethodInst);
+                       }
+               }
+
                protected abstract class MonoLineNumberTable : LineNumberTable
                {
                        Method method;
@@ -1556,6 +1625,11 @@
                                SetLineNumbers (new WrapperLineNumberTable 
(this, address));
                        }
 
+                       internal override TargetMethodFrameInfo GetFrameInfo 
(Thread target, StackFrame frame)
+                       {
+                               return null;
+                       }
+
                        internal override MethodSource GetTrampoline 
(TargetMemoryAccess memory,
                                                                      
TargetAddress address)
                        {

Modified: branches/martin/debugger-generics/languages/mono/MonoVariable.cs
===================================================================
--- branches/martin/debugger-generics/languages/mono/MonoVariable.cs    
2007-09-10 22:12:20 UTC (rev 85609)
+++ branches/martin/debugger-generics/languages/mono/MonoVariable.cs    
2007-09-10 22:15:07 UTC (rev 85610)
@@ -125,6 +125,10 @@
                                return process.MonoLanguage.CreateNullObject (
                                        frame.Thread, type);
 
+                       MonoGenericParameterType gen_param = type as 
MonoGenericParameterType;
+                       if (gen_param != null)
+                               return gen_param.GetObject (frame, location);
+
                        return type.GetObject (location);
                }
 

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

Reply via email to