Author: martin
Date: 2007-09-27 11:32:27 -0400 (Thu, 27 Sep 2007)
New Revision: 86506
Modified:
trunk/debugger/ChangeLog
trunk/debugger/languages/mono/MonoClassInfo.cs
trunk/debugger/languages/mono/MonoClassType.cs
trunk/debugger/languages/mono/MonoFundamentalType.cs
trunk/debugger/languages/mono/MonoLanguageBackend.cs
trunk/debugger/languages/mono/MonoObjectType.cs
trunk/debugger/languages/mono/MonoVoidType.cs
Log:
2007-09-27 Martin Baulig <[EMAIL PROTECTED]>
* languages/mono/MonoLanguageBackend.cs
(MonoLanguageBackend.ReadMonoClass): Use
MonoClassInfo.ReadMonoClass() to create the `MonoClassInfo', then
create a `MonoClassType'.
(MonoLanguageBackend.CreateClassInfo): Renamed into
CreateCoreType(); create the MonoClassType here and not inside
MonoClassInfo's .ctor.
* languages/mono/MonoClassType.cs
(MonoClassType.ReadClassType): Removed.
* languages/mono/MonoClassInfo.cs
(MonoClassInfo.ClassType): Removed.
Modified: trunk/debugger/ChangeLog
===================================================================
--- trunk/debugger/ChangeLog 2007-09-27 15:16:28 UTC (rev 86505)
+++ trunk/debugger/ChangeLog 2007-09-27 15:32:27 UTC (rev 86506)
@@ -1,5 +1,21 @@
2007-09-27 Martin Baulig <[EMAIL PROTECTED]>
+ * languages/mono/MonoLanguageBackend.cs
+ (MonoLanguageBackend.ReadMonoClass): Use
+ MonoClassInfo.ReadMonoClass() to create the `MonoClassInfo', then
+ create a `MonoClassType'.
+ (MonoLanguageBackend.CreateClassInfo): Renamed into
+ CreateCoreType(); create the MonoClassType here and not inside
+ MonoClassInfo's .ctor.
+
+ * languages/mono/MonoClassType.cs
+ (MonoClassType.ReadClassType): Removed.
+
+ * languages/mono/MonoClassInfo.cs
+ (MonoClassInfo.ClassType): Removed.
+
+2007-09-27 Martin Baulig <[EMAIL PROTECTED]>
+
* languages/mono/MonoObjectType.cs
(MonoObjectType): Replace the public .ctor with a static
Create() method.
Modified: trunk/debugger/languages/mono/MonoClassInfo.cs
===================================================================
--- trunk/debugger/languages/mono/MonoClassInfo.cs 2007-09-27 15:16:28 UTC
(rev 86505)
+++ trunk/debugger/languages/mono/MonoClassInfo.cs 2007-09-27 15:32:27 UTC
(rev 86506)
@@ -13,7 +13,6 @@
public readonly TargetAddress GenericClass;
public readonly Cecil.TypeDefinition CecilType;
- public readonly MonoClassType ClassType;
public readonly TargetType Type;
int[] field_offsets;
@@ -75,8 +74,6 @@
reader.Offset += 2;
int type = reader.ReadByte ();
- ClassType = new MonoClassType (file, typedef, this);
-
GenericClass = reader.PeekAddress
(info.KlassGenericClassOffset);
GenericContainer = reader.PeekAddress
(info.KlassGenericContainerOffset);
ParentClass = reader.PeekAddress
(info.KlassParentOffset);
Modified: trunk/debugger/languages/mono/MonoClassType.cs
===================================================================
--- trunk/debugger/languages/mono/MonoClassType.cs 2007-09-27 15:16:28 UTC
(rev 86505)
+++ trunk/debugger/languages/mono/MonoClassType.cs 2007-09-27 15:32:27 UTC
(rev 86506)
@@ -448,74 +448,6 @@
return null;
}
- internal static TargetType ReadMonoClass (MonoLanguageBackend
language,
- TargetMemoryAccess
target, TargetAddress address)
- {
- TargetReader reader = new TargetReader (
- target.ReadMemory (address,
language.MonoMetadataInfo.KlassSize));
-
- TargetAddress image = reader.ReadAddress ();
- MonoSymbolFile file = language.GetImage (image);
-
- reader.ReadAddress ();
- TargetAddress element_class = reader.ReadAddress ();
-
- if (file == null)
- return null;
-
- reader.Offset =
language.MonoMetadataInfo.KlassTokenOffset;
- uint token = reader.BinaryReader.ReadUInt32 ();
-
- reader.Offset =
language.MonoMetadataInfo.KlassByValArgOffset;
- TargetAddress byval_data_addr = reader.ReadAddress ();
- reader.Offset += 2;
- int type = reader.ReadByte ();
-
- reader.Offset =
language.MonoMetadataInfo.KlassGenericClassOffset;
- TargetAddress generic_class = reader.ReadAddress ();
-
- reader.Offset =
language.MonoMetadataInfo.KlassGenericContainerOffset;
- TargetAddress generic_container = reader.ReadAddress ();
-
- if (!generic_class.IsNull || !generic_container.IsNull)
- return null;
-
- if ((type == 0x11) || (type == 0x12)) { //
MONO_TYPE_(VALUETYPE|CLASS)
- Cecil.TypeDefinition tdef;
-
- if ((token & 0xff000000) != 0x02000000)
- return null;
-
- token &= 0x00ffffff;
- tdef = (Cecil.TypeDefinition)
file.ModuleDefinition.LookupByToken (
- Cecil.Metadata.TokenType.TypeDef, (int)
token);
-
- if (tdef != null)
- return file.LookupMonoType (tdef);
- } else if (type == 0x1d) { // MONO_TYPE_SZARRAY
- TargetType eklass = ReadMonoClass (language,
target, element_class);
- if (eklass == null)
- return null;
-
- return new MonoArrayType (eklass, 1);
- } else if (type == 0x14) { // MONO_TYPE_ARRAY
- TargetType eklass = ReadMonoClass (language,
target, element_class);
- if (eklass == null)
- return null;
-
- TargetBlob array_data = target.ReadMemory (
- byval_data_addr,
language.MonoMetadataInfo.ArrayTypeSize);
- TargetReader array_reader = new TargetReader
(array_data);
-
- array_reader.ReadAddress ();
- int rank = array_reader.ReadByte ();
-
- return new MonoArrayType (eklass, rank);
- }
-
- return null;
- }
-
int GetFieldOffset (TargetMemoryAccess target, TargetFieldInfo
field)
{
ResolveClass (target, true);
Modified: trunk/debugger/languages/mono/MonoFundamentalType.cs
===================================================================
--- trunk/debugger/languages/mono/MonoFundamentalType.cs 2007-09-27
15:16:28 UTC (rev 86505)
+++ trunk/debugger/languages/mono/MonoFundamentalType.cs 2007-09-27
15:32:27 UTC (rev 86506)
@@ -6,7 +6,6 @@
internal class MonoFundamentalType : TargetFundamentalType
{
MonoSymbolFile file;
- MonoClassInfo class_info;
MonoClassType class_type;
Cecil.TypeDefinition typedef;
@@ -139,8 +138,7 @@
protected void create_type (TargetMemoryAccess memory,
TargetAddress klass)
{
- class_info = file.MonoLanguage.CreateClassInfo (file,
typedef, memory, klass);
- class_type = new MonoClassType (file, typedef,
class_info);
+ class_type = file.MonoLanguage.CreateCoreType (file,
typedef, memory, klass);
file.MonoLanguage.AddCoreType (typedef, this,
class_type, klass);
}
@@ -149,11 +147,11 @@
}
public override TargetClassType ClassType {
- get { return class_info.ClassType; }
+ get { return class_type; }
}
internal MonoClassType MonoClassType {
- get { return class_info.ClassType; }
+ get { return class_type; }
}
}
}
Modified: trunk/debugger/languages/mono/MonoLanguageBackend.cs
===================================================================
--- trunk/debugger/languages/mono/MonoLanguageBackend.cs 2007-09-27
15:16:28 UTC (rev 86505)
+++ trunk/debugger/languages/mono/MonoLanguageBackend.cs 2007-09-27
15:32:27 UTC (rev 86506)
@@ -88,8 +88,7 @@
mono_defaults.Offset = info.MonoDefaultsArrayOffset;
TargetAddress klass = mono_defaults.ReadAddress ();
Cecil.TypeDefinition array_type =
corlib.ModuleDefinition.Types ["System.Array"];
- MonoClassInfo array_info = mono.CreateClassInfo
(corlib, array_type, memory, klass);
- ArrayType = array_info.ClassType;
+ ArrayType = mono.CreateCoreType (corlib, array_type,
memory, klass);
mono.AddCoreType (array_type, ArrayType, ArrayType,
klass);
mono_defaults.Offset = info.MonoDefaultsDelegateOffset;
@@ -101,8 +100,7 @@
mono_defaults.Offset = info.MonoDefaultsExceptionOffset;
klass = mono_defaults.ReadAddress ();
Cecil.TypeDefinition exception_type =
corlib.ModuleDefinition.Types ["System.Exception"];
- MonoClassInfo exception_info = mono.CreateClassInfo
(corlib, exception_type, memory, klass);
- ExceptionType = exception_info.ClassType;
+ ExceptionType = mono.CreateCoreType (corlib,
exception_type, memory, klass);
mono.AddCoreType (exception_type, ExceptionType,
ExceptionType, klass);
}
}
@@ -345,8 +343,14 @@
if (type != null)
return type;
+ MonoClassInfo info;
+
try {
- type = MonoClassType.ReadMonoClass (this,
target, klass_address);
+ info = MonoClassInfo.ReadClassInfo (this,
target, klass_address);
+ if (info == null)
+ return null;
+
+ type = info.SymbolFile.LookupMonoClass
(info.CecilType);
} catch {
return null;
}
@@ -652,13 +656,15 @@
return info;
}
- internal MonoClassInfo CreateClassInfo (MonoSymbolFile file,
Cecil.TypeDefinition typedef,
- TargetMemoryAccess
memory, TargetAddress klass)
+ internal MonoClassType CreateCoreType (MonoSymbolFile file,
Cecil.TypeDefinition typedef,
+ TargetMemoryAccess
memory, TargetAddress klass)
{
MonoClassInfo info = MonoClassInfo.ReadClassInfo (file,
typedef, memory, klass);
class_info_by_addr.Add (klass, info);
class_info_by_type.Add (typedef, info);
- return info;
+
+ MonoClassType type = new MonoClassType (file, typedef,
info);
+ return type;
}
#endregion
Modified: trunk/debugger/languages/mono/MonoObjectType.cs
===================================================================
--- trunk/debugger/languages/mono/MonoObjectType.cs 2007-09-27 15:16:28 UTC
(rev 86505)
+++ trunk/debugger/languages/mono/MonoObjectType.cs 2007-09-27 15:32:27 UTC
(rev 86506)
@@ -8,7 +8,6 @@
{
MonoSymbolFile file;
Cecil.TypeDefinition typedef;
- MonoClassInfo class_info;
MonoClassType class_type;
protected MonoObjectType (MonoSymbolFile file,
Cecil.TypeDefinition typedef, int size)
@@ -36,8 +35,7 @@
protected void create_type (TargetMemoryAccess memory,
TargetAddress klass)
{
- class_info = file.MonoLanguage.CreateClassInfo (file,
typedef, memory, klass);
- class_type = new MonoClassType (file, typedef,
class_info);
+ class_type = file.MonoLanguage.CreateCoreType (file,
typedef, memory, klass);
file.MonoLanguage.AddCoreType (typedef, this,
class_type, klass);
}
Modified: trunk/debugger/languages/mono/MonoVoidType.cs
===================================================================
--- trunk/debugger/languages/mono/MonoVoidType.cs 2007-09-27 15:16:28 UTC
(rev 86505)
+++ trunk/debugger/languages/mono/MonoVoidType.cs 2007-09-27 15:32:27 UTC
(rev 86506)
@@ -8,7 +8,6 @@
{
MonoSymbolFile file;
Cecil.TypeDefinition typedef;
- MonoClassInfo class_info;
MonoClassType class_type;
protected MonoVoidType (MonoSymbolFile file,
Cecil.TypeDefinition typedef)
@@ -33,8 +32,7 @@
protected void create_type (TargetMemoryAccess memory,
TargetAddress klass)
{
- class_info = file.MonoLanguage.CreateClassInfo (file,
typedef, memory, klass);
- class_type = new MonoClassType (file, typedef,
class_info);
+ class_type = file.MonoLanguage.CreateCoreType (file,
typedef, memory, klass);
file.MonoLanguage.AddCoreType (typedef, this,
class_type, klass);
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches