Author: martin
Date: 2007-09-10 20:29:03 -0400 (Mon, 10 Sep 2007)
New Revision: 85615

Modified:
   branches/martin/debugger-generics/languages/mono/MonoGenericInst.cs
   branches/martin/debugger-generics/languages/mono/MonoGenericParameterType.cs
   branches/martin/debugger-generics/languages/mono/MonoSymbolFile.cs
   branches/martin/debugger-generics/languages/mono/MonoType.cs
   branches/martin/debugger-generics/languages/mono/MonoVariable.cs
Log:


Modified: branches/martin/debugger-generics/languages/mono/MonoGenericInst.cs
===================================================================
--- branches/martin/debugger-generics/languages/mono/MonoGenericInst.cs 
2007-09-11 00:05:28 UTC (rev 85614)
+++ branches/martin/debugger-generics/languages/mono/MonoGenericInst.cs 
2007-09-11 00:29:03 UTC (rev 85615)
@@ -18,10 +18,14 @@
 
                        int addr_size = memory.TargetInfo.TargetAddressSize;
 
-                       int header = memory.ReadInteger (address);
+                       TargetReader blob = new TargetReader (memory.ReadMemory 
(address, 16));
+                       Console.WriteLine ("NEW GENERIC INST #1: {0} {1}",
+                                          address, blob.BinaryReader.HexDump 
());
+
+                       int header = memory.ReadInteger (address + 4);
                        TargetAddress type_argv_ptr = memory.ReadAddress 
(address + addr_size);
 
-                       int type_argc = (header & 0x7ff8) >> 3;
+                       int type_argc = header & 0x3fffff;
 
                        Console.WriteLine ("NEW GENERIC INST #2: {0:x} {1} {2}",
                                           header, type_argc, type_argv_ptr);

Modified: 
branches/martin/debugger-generics/languages/mono/MonoGenericParameterType.cs
===================================================================
--- 
branches/martin/debugger-generics/languages/mono/MonoGenericParameterType.cs    
    2007-09-11 00:05:28 UTC (rev 85614)
+++ 
branches/martin/debugger-generics/languages/mono/MonoGenericParameterType.cs    
    2007-09-11 00:29:03 UTC (rev 85615)
@@ -19,7 +19,10 @@
                }
 
                public override bool IsByRef {
-                       get { return false; }
+                       get {
+                               Console.WriteLine ("GP ISBYREF: {0}", 
Environment.StackTrace);
+                               return false;
+                       }
                }
 
                public override bool HasFixedSize {
@@ -35,7 +38,7 @@
                        throw new NotImplementedException ();
                }
 
-               internal TargetObject GetObject (StackFrame frame, 
TargetLocation location)
+               internal TargetType GetType (StackFrame frame)
                {
                        MonoMethodFrameInfo info = (MonoMethodFrameInfo) 
frame.MethodFrameInfo;
                        if (info == null)
@@ -49,8 +52,7 @@
                        else
                                inst = info.ClassInst;
 
-                       TargetType type = inst.Types [gen_param.Position];
-                       return type.GetObject (location);
+                       return inst.Types [gen_param.Position];
                }
        }
 }

Modified: branches/martin/debugger-generics/languages/mono/MonoSymbolFile.cs
===================================================================
--- branches/martin/debugger-generics/languages/mono/MonoSymbolFile.cs  
2007-09-11 00:05:28 UTC (rev 85614)
+++ branches/martin/debugger-generics/languages/mono/MonoSymbolFile.cs  
2007-09-11 00:29:03 UTC (rev 85615)
@@ -997,8 +997,7 @@
                                for (int i = 0; i < param_info.Count; i++) {
                                        parameters [i] = new MonoVariable (
                                                file.process, param_info 
[i].Name, param_types [i],
-                                               false, param_types [i].IsByRef, 
this,
-                                               address.ParamVariableInfo [i], 
0, 0);
+                                               false, this, 
address.ParamVariableInfo [i], 0, 0);
                                }
 
                                locals = new TargetVariable [method.NumLocals];
@@ -1009,21 +1008,19 @@
                                                int index = local.BlockIndex - 
1;
                                                JitLexicalBlockEntry block = 
address.LexicalBlocks [index];
                                                locals [i] = new MonoVariable (
-                                                       file.process, 
local.Name, local_types [i],
-                                                       true, local_types 
[i].IsByRef, this,
-                                                       
address.LocalVariableInfo [local.Index],
+                                                       file.process, 
local.Name, local_types [i], true,
+                                                       this, 
address.LocalVariableInfo [local.Index],
                                                        block.StartAddress, 
block.EndAddress);
                                        } else {
                                                locals [i] = new MonoVariable (
-                                                       file.process, 
local.Name, local_types [i],
-                                                       true, local_types 
[i].IsByRef, this,
-                                                       
address.LocalVariableInfo [local.Index]);
+                                                       file.process, 
local.Name, local_types [i], true,
+                                                       this, 
address.LocalVariableInfo [local.Index]);
                                        }
                                }
 
                                if (address.HasThis)
                                        this_var = new MonoVariable (
-                                               file.process, "this", 
decl_type, true,
+                                               file.process, "this", decl_type,
                                                true, this, 
address.ThisVariableInfo);
 
                                has_variables = true;

Modified: branches/martin/debugger-generics/languages/mono/MonoType.cs
===================================================================
--- branches/martin/debugger-generics/languages/mono/MonoType.cs        
2007-09-11 00:05:28 UTC (rev 85614)
+++ branches/martin/debugger-generics/languages/mono/MonoType.cs        
2007-09-11 00:29:03 UTC (rev 85615)
@@ -93,6 +93,10 @@
                        case MonoTypeEnum.MONO_TYPE_STRING:
                                return mono.BuiltinTypes.StringType;
 
+                       case MonoTypeEnum.MONO_TYPE_VALUETYPE:
+                       case MonoTypeEnum.MONO_TYPE_CLASS:
+                               return mono.GetClass (memory, data);
+
                        default:
                                break;
 

Modified: branches/martin/debugger-generics/languages/mono/MonoVariable.cs
===================================================================
--- branches/martin/debugger-generics/languages/mono/MonoVariable.cs    
2007-09-11 00:05:28 UTC (rev 85614)
+++ branches/martin/debugger-generics/languages/mono/MonoVariable.cs    
2007-09-11 00:29:03 UTC (rev 85615)
@@ -11,13 +11,12 @@
                ProcessServant process;
                TargetAddress start_liveness, end_liveness;
                TargetAddress start_scope, end_scope;
-               bool has_liveness_info, is_byref;
+               bool has_liveness_info;
 
                public MonoVariable (ProcessServant process, string name, 
TargetType type,
-                                    bool is_local, bool is_byref, Method 
method,
-                                    VariableInfo info, int start_scope_offset,
-                                    int end_scope_offset)
-                       : this (process, name, type, is_local, is_byref, 
method, info)
+                                    bool is_local, Method method, VariableInfo 
info,
+                                    int start_scope_offset, int 
end_scope_offset)
+                       : this (process, name, type, is_local, method, info)
                {
                        if (is_local) {
                                start_scope = method.StartAddress + 
start_scope_offset;
@@ -43,14 +42,12 @@
                }
 
                public MonoVariable (ProcessServant process, string name, 
TargetType type,
-                                    bool is_local, bool is_byref, Method 
method,
-                                    VariableInfo info)
+                                    bool is_local, Method method, VariableInfo 
info)
                {
                        this.process = process;
                        this.name = name;
                        this.type = type;
                        this.info = info;
-                       this.is_byref = is_byref;
 
                        start_scope = method.StartAddress;
                        end_scope = method.EndAddress;
@@ -82,7 +79,7 @@
                        get { return end_liveness; }
                }
 
-               public TargetLocation GetLocation (StackFrame frame)
+               protected TargetLocation GetLocation (StackFrame frame, bool 
is_byref)
                {
                        Register register = frame.Registers [info.Index];
                        if (info.Mode == VariableInfo.AddressMode.Register)
@@ -105,9 +102,22 @@
                        return (address >= start_liveness) && (address <= 
end_liveness);
                }
 
+               protected TargetType GetType (StackFrame frame)
+               {
+                       MonoGenericParameterType gen_param = type as 
MonoGenericParameterType;
+                       if (gen_param != null)
+                               return gen_param.GetType (frame);
+                       else
+                               return type;
+               }
+
                public override string PrintLocation (StackFrame frame)
                {
-                       TargetLocation location = GetLocation (frame);
+                       TargetType effective_type = GetType (frame);
+                       if (effective_type == null)
+                               return null;
+
+                       TargetLocation location = GetLocation (frame, 
effective_type.IsByRef);
                        if (location == null)
                                return null;
 
@@ -116,8 +126,12 @@
 
                public override TargetObject GetObject (StackFrame frame)
                {
-                       TargetLocation location = GetLocation (frame);
+                       TargetType effective_type = GetType (frame);
+                       if (effective_type == null)
+                               throw new LocationInvalidException ();
 
+                       TargetLocation location = GetLocation (frame, 
effective_type.IsByRef);
+
                        if (location == null)
                                throw new LocationInvalidException ();
 
@@ -125,11 +139,7 @@
                                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);
+                       return effective_type.GetObject (location);
                }
 
                public override bool CanWrite {
@@ -138,12 +148,16 @@
 
                public override void SetObject (StackFrame frame, TargetObject 
obj)
                {
-                       TargetLocation location = GetLocation (frame);
+                       TargetType effective_type = GetType (frame);
+                       if (effective_type == null)
+                               throw new LocationInvalidException ();
 
+                       TargetLocation location = GetLocation (frame, 
effective_type.IsByRef);
+
                        if (location == null)
                                throw new LocationInvalidException ();
 
-                       type.SetObject (frame.Thread, location, (TargetObject) 
obj);
+                       effective_type.SetObject (frame.Thread, location, 
(TargetObject) obj);
                }
 
                public override string ToString ()

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

Reply via email to