Author: martin
Date: 2005-09-23 15:37:30 -0400 (Fri, 23 Sep 2005)
New Revision: 50618

Removed:
   trunk/debugger/languages/native/NativeObject.cs
   trunk/debugger/languages/native/NativeType.cs
Modified:
   trunk/debugger/ChangeLog
   trunk/debugger/arch/DwarfReader.cs
   trunk/debugger/interfaces/ILanguage.cs
   trunk/debugger/languages/mono/MonoLanguageBackend.cs
   trunk/debugger/languages/native/NativeArrayObject.cs
   trunk/debugger/languages/native/NativeArrayType.cs
   trunk/debugger/languages/native/NativeEnumObject.cs
   trunk/debugger/languages/native/NativeEnumType.cs
   trunk/debugger/languages/native/NativeFunctionType.cs
   trunk/debugger/languages/native/NativeFundamentalObject.cs
   trunk/debugger/languages/native/NativeFundamentalType.cs
   trunk/debugger/languages/native/NativeLanguage.cs
   trunk/debugger/languages/native/NativeOpaqueObject.cs
   trunk/debugger/languages/native/NativeOpaqueType.cs
   trunk/debugger/languages/native/NativePointerObject.cs
   trunk/debugger/languages/native/NativePointerType.cs
   trunk/debugger/languages/native/NativeStringObject.cs
   trunk/debugger/languages/native/NativeStringType.cs
   trunk/debugger/languages/native/NativeStructObject.cs
   trunk/debugger/languages/native/NativeStructType.cs
   trunk/debugger/languages/native/NativeTypeAlias.cs
Log:
2005-09-23  Martin Baulig  <[EMAIL PROTECTED]>

        * languages/native/NativeType.cs: Removed; use `TargetType' instead.

        * languages/native/NativeObject.cs: Removed; use `TargetObject' instead.



Modified: trunk/debugger/ChangeLog
===================================================================
--- trunk/debugger/ChangeLog    2005-09-23 19:36:37 UTC (rev 50617)
+++ trunk/debugger/ChangeLog    2005-09-23 19:37:30 UTC (rev 50618)
@@ -1,5 +1,11 @@
 2005-09-23  Martin Baulig  <[EMAIL PROTECTED]>
 
+       * languages/native/NativeType.cs: Removed; use `TargetType' instead.
+
+       * languages/native/NativeObject.cs: Removed; use `TargetObject' instead.
+
+2005-09-23  Martin Baulig  <[EMAIL PROTECTED]>
+
        * arch/StabsReader.cs: Removed for the moment until someone fully
        implements PowerPC support.
 

Modified: trunk/debugger/arch/DwarfReader.cs
===================================================================
--- trunk/debugger/arch/DwarfReader.cs  2005-09-23 19:36:37 UTC (rev 50617)
+++ trunk/debugger/arch/DwarfReader.cs  2005-09-23 19:37:30 UTC (rev 50618)
@@ -2527,11 +2527,11 @@
                {
                        DwarfReader dwarf;
                        string name;
-                       NativeType type;
+                       TargetType type;
                        TargetBinaryReader location;
                        int offset;
 
-                       public TargetVariable (DwarfReader dwarf, string name, 
NativeType type,
+                       public TargetVariable (DwarfReader dwarf, string name, 
TargetType type,
                                               TargetBinaryReader location)
                        {
                                this.dwarf = dwarf;
@@ -2540,7 +2540,7 @@
                                this.location = location;
                        }
 
-                       public TargetVariable (DwarfReader dwarf, string name, 
NativeType type,
+                       public TargetVariable (DwarfReader dwarf, string name, 
TargetType type,
                                               int offset)
                        {
                                this.dwarf = dwarf;
@@ -2557,7 +2557,7 @@
                                get { return type; }
                        }
 
-                       public NativeType Type {
+                       public TargetType Type {
                                get { return type; }
                        }
 
@@ -2633,13 +2633,15 @@
                        string name;
                        long offset;
                        bool resolved, ok, type_created;
-                       NativeType type;
+                       protected readonly ILanguage language;
+                       TargetType type;
 
                        public DieType (DwarfBinaryReader reader, 
CompilationUnit comp_unit,
                                        long offset, AbbrevEntry abbrev)
                                : base (reader, comp_unit, abbrev)
                        {
                                this.offset = offset;
+                               this.language = reader.Bfd.Language;
                                comp_unit.AddType (offset, this);
 
                                if (name != null)
@@ -2660,7 +2662,7 @@
                                return comp_unit.GetType (offset);
                        }
 
-                       public NativeType ResolveType ()
+                       public TargetType ResolveType ()
                        {
                                if (resolved)
                                        return type;
@@ -2681,7 +2683,7 @@
                                return type;
                        }
 
-                       protected abstract NativeType CreateType ();
+                       protected abstract TargetType CreateType ();
 
                        protected virtual void PopulateType ()
                        { }
@@ -2694,10 +2696,10 @@
                                }
                        }
                        
-                       public NativeType Type {
+                       public TargetType Type {
                                get {
                                        if (!HasType)
-                                               return NativeType.VoidType;
+                                               return (TargetType) 
language.VoidType;
                                        else
                                                return type;
                                }
@@ -2717,13 +2719,13 @@
                                this.name = name;
                        }
 
-                       internal NativeType GetAlias (string name)
+                       internal TargetType GetAlias (string name)
                        {
                                if (this.name == null) {
                                        this.name = name;
                                        return Type;
                                } else
-                                       return new NativeTypeAlias (name, 
this.name, Type);
+                                       return new NativeTypeAlias (language, 
name, this.name, Type);
                        }
 
                        public override string ToString ()
@@ -2770,15 +2772,15 @@
                                }
                        }
 
-                       protected override NativeType CreateType ()
+                       protected override TargetType CreateType ()
                        {
                                kind = GetMonoType (
                                        (DwarfBaseTypeEncoding) encoding, 
byte_size);
 
                                if (kind == FundamentalKind.Unknown)
-                                       return new NativeOpaqueType (Name, 
byte_size);
+                                       return new NativeOpaqueType (language, 
Name, byte_size);
 
-                               return new NativeFundamentalType (Name, kind, 
byte_size);
+                               return new NativeFundamentalType (language, 
Name, kind, byte_size);
                        }
 
                        protected FundamentalKind GetMonoType 
(DwarfBaseTypeEncoding encoding,
@@ -2853,7 +2855,7 @@
                                }
                        }
 
-                       protected override NativeType CreateType ()
+                       protected override TargetType CreateType ()
                        {
                                reference = GetReference (type_offset);
                                if (reference == null) {
@@ -2863,14 +2865,14 @@
                                        return null;
                                }
 
-                               NativeType ref_type = reference.ResolveType ();
+                               TargetType ref_type = reference.ResolveType ();
                                if (ref_type == null)
                                        return null;
 
                                NativeFundamentalType fundamental = ref_type as 
NativeFundamentalType;
                                if ((fundamental != null) &&
                                    (fundamental.FundamentalKind == 
FundamentalKind.Char))
-                                       return new NativeStringType (byte_size);
+                                       return new NativeStringType (language, 
byte_size);
 
                                string name;
                                if (Name != null)
@@ -2878,7 +2880,7 @@
                                else
                                        name = String.Format ("{0}*", 
ref_type.Name);
 
-                               return new NativePointerType (name, ref_type, 
byte_size);
+                               return new NativePointerType (language, name, 
ref_type, byte_size);
                        }
                }
 
@@ -2973,7 +2975,7 @@
                                get { return stride_size; }
                        }
 
-                       protected override NativeType CreateType ()
+                       protected override TargetType CreateType ()
                        {
                                reference = GetReference (type_offset);
                                if (reference == null) {
@@ -2983,7 +2985,7 @@
                                        return null;
                                }
 
-                               NativeType ref_type = reference.ResolveType ();
+                               TargetType ref_type = reference.ResolveType ();
                                if (ref_type == null)
                                        return null;
 
@@ -3011,8 +3013,9 @@
                                        break;
                                }
 
-                               return new NativeArrayType (name, ref_type,
-                                                           
subrange.LowerBound, subrange.UpperBound, byte_size);
+                               return new NativeArrayType (
+                                       language, name, ref_type,
+                                       subrange.LowerBound, 
subrange.UpperBound, byte_size);
                        }
                }
 
@@ -3077,7 +3080,7 @@
                                }
                        }
 
-                       protected override NativeType CreateType ()
+                       protected override TargetType CreateType ()
                        {
                                int num_elements = 0;
                                string name;
@@ -3103,7 +3106,7 @@
                                        i++;
                                }
 
-                               return new NativeEnumType (name, byte_size, 
names, values);
+                               return new NativeEnumType (language, name, 
byte_size, names, values);
                        }
                }
 
@@ -3130,7 +3133,7 @@
                                }
                        }
 
-                       protected override NativeType CreateType ()
+                       protected override TargetType CreateType ()
                        {
                                reference = GetReference (type_offset);
                                if (reference == null)
@@ -3168,13 +3171,13 @@
                                }
                        }
 
-                       protected override NativeType CreateType ()
+                       protected override TargetType CreateType ()
                        {
                                reference = GetReference (type_offset);
                                if (reference == null)
                                        return null;
 
-                               type = new NativeTypeAlias (Name, 
reference.Name);
+                               type = new NativeTypeAlias (language, Name, 
reference.Name);
                                return type;
                        }
 
@@ -3276,9 +3279,9 @@
                        NativeFieldInfo[] fields;
                        new NativeStructType type;
 
-                       protected override NativeType CreateType ()
+                       protected override TargetType CreateType ()
                        {
-                               type = new NativeStructType (Name, fields, 
byte_size);
+                               type = new NativeStructType (language, Name, 
fields, byte_size);
                                return type;
                        }
 
@@ -3294,9 +3297,9 @@
                                        if ((member == null) || !member.Resolve 
(this))
                                                continue;
 
-                                       NativeType mtype = member.Type;
+                                       TargetType mtype = member.Type;
                                        if (mtype == null)
-                                               mtype = NativeType.VoidType;
+                                               mtype = (TargetType) 
language.VoidType;
 
                                        NativeFieldInfo field;
                                        if (member.IsBitfield)
@@ -3358,7 +3361,7 @@
                                }
                        }
 
-                       protected override NativeType CreateType ()
+                       protected override TargetType CreateType ()
                        {
                                if (!prototyped)
                                        return null;
@@ -3369,15 +3372,15 @@
                                                return null;
                                }
 
-                               NativeType ret_type = null;
+                               TargetType ret_type = null;
                                if (return_type != null)
                                        ret_type = return_type.ResolveType ();
                                if (ret_type == null)
-                                       ret_type = NativeType.VoidType;
+                                       ret_type = (TargetType) 
language.VoidType;
 
-                               NativeType[] param_types = new NativeType [0];
+                               TargetType[] param_types = new TargetType [0];
                                NativeFunctionType func_type = new 
NativeFunctionType (
-                                       "test", ret_type, param_types);
+                                       language, "test", ret_type, 
param_types);
                                return func_type;
                        }
 
@@ -3494,7 +3497,7 @@
                                if (reference == null)
                                        return false;
 
-                               NativeType type = reference.ResolveType ();
+                               TargetType type = reference.ResolveType ();
                                if (!use_constant) {
                                        TargetBinaryReader locreader = new 
TargetBinaryReader (
                                                       location_block, 
target_info);
@@ -3568,7 +3571,7 @@
                        byte[] location;
                        bool resolved, ok;
                        DieType type_die;
-                       NativeType type;
+                       TargetType type;
                        ITargetInfo target_info;
                        int bit_offset, bit_size;
                        int offset;
@@ -3611,7 +3614,7 @@
                                }
                        }
 
-                       protected NativeType ResolveType (DieStructureType 
die_struct)
+                       protected TargetType ResolveType (DieStructureType 
die_struct)
                        {
                                if ((TypeOffset == 0) || (Name == null))
                                        return null;
@@ -3630,7 +3633,7 @@
                                return type;
                        }
 
-                       public NativeType Type {
+                       public TargetType Type {
                                get {
                                        if (!resolved)
                                                throw new 
InvalidOperationException ();

Modified: trunk/debugger/interfaces/ILanguage.cs
===================================================================
--- trunk/debugger/interfaces/ILanguage.cs      2005-09-23 19:36:37 UTC (rev 
50617)
+++ trunk/debugger/interfaces/ILanguage.cs      2005-09-23 19:37:30 UTC (rev 
50618)
@@ -28,6 +28,10 @@
                        get;
                }
 
+               ITargetType VoidType {
+                       get;
+               }
+
                ITargetClassType DelegateType {
                        get;
                }

Modified: trunk/debugger/languages/mono/MonoLanguageBackend.cs
===================================================================
--- trunk/debugger/languages/mono/MonoLanguageBackend.cs        2005-09-23 
19:36:37 UTC (rev 50617)
+++ trunk/debugger/languages/mono/MonoLanguageBackend.cs        2005-09-23 
19:37:30 UTC (rev 50618)
@@ -890,6 +890,10 @@
                        get { return builtin_types.IntType; }
                }
 
+               ITargetType ILanguage.VoidType {
+                       get { return builtin_types.VoidType; }
+               }
+
                ITargetClassType ILanguage.ExceptionType {
                        get { return builtin_types.ExceptionType; }
                }

Modified: trunk/debugger/languages/native/NativeArrayObject.cs
===================================================================
--- trunk/debugger/languages/native/NativeArrayObject.cs        2005-09-23 
19:36:37 UTC (rev 50617)
+++ trunk/debugger/languages/native/NativeArrayObject.cs        2005-09-23 
19:37:30 UTC (rev 50618)
@@ -2,7 +2,7 @@
 
 namespace Mono.Debugger.Languages.Native
 {
-       internal class NativeArrayObject : NativeObject, ITargetArrayObject
+       internal class NativeArrayObject : TargetObject, ITargetArrayObject
        {
                int lower_bound;
                int upper_bound;

Modified: trunk/debugger/languages/native/NativeArrayType.cs
===================================================================
--- trunk/debugger/languages/native/NativeArrayType.cs  2005-09-23 19:36:37 UTC 
(rev 50617)
+++ trunk/debugger/languages/native/NativeArrayType.cs  2005-09-23 19:37:30 UTC 
(rev 50618)
@@ -2,22 +2,40 @@
 
 namespace Mono.Debugger.Languages.Native
 {
+       internal class NativeArrayType : TargetType, ITargetArrayType
+       {
+               string name;
+               int size;
 
-       internal class NativeArrayType : NativeType, ITargetArrayType
-       {
-               public NativeArrayType (string name, NativeType element_type, 
int lower_bound, int upper_bound, int size)
-                       : base (name, TargetObjectKind.Array, size, true)
+               public NativeArrayType (ILanguage language, string name, 
TargetType element_type,
+                                       int lower_bound, int upper_bound, int 
size)
+                       : base (language, TargetObjectKind.Array)
                {
+                       this.name = name;
+                       this.size = size;
+
                        this.element_type = element_type;
                        this.lower_bound = lower_bound;
                        this.upper_bound = upper_bound;
                }
          
-               NativeType element_type;
+               TargetType element_type;
                int lower_bound;
                int upper_bound;
 
-               public NativeType ElementType {
+               public override string Name {
+                       get { return name; }
+               }
+
+               public override int Size {
+                       get { return size; }
+               }
+
+               public override bool HasFixedSize {
+                       get { return true; }
+               }
+
+               public TargetType ElementType {
                        get {
                                return element_type;
                        }
@@ -41,7 +59,7 @@
                        }
                }
 
-               public override NativeObject GetObject (TargetLocation location)
+               public override TargetObject GetObject (TargetLocation location)
                {
                        return new NativeArrayObject (this, location, 
lower_bound, upper_bound);
                }

Modified: trunk/debugger/languages/native/NativeEnumObject.cs
===================================================================
--- trunk/debugger/languages/native/NativeEnumObject.cs 2005-09-23 19:36:37 UTC 
(rev 50617)
+++ trunk/debugger/languages/native/NativeEnumObject.cs 2005-09-23 19:37:30 UTC 
(rev 50618)
@@ -2,7 +2,7 @@
 
 namespace Mono.Debugger.Languages.Native
 {
-       internal class NativeEnumObject : NativeObject, ITargetEnumObject
+       internal class NativeEnumObject : TargetObject, ITargetEnumObject
        {
                new NativeEnumType type;
 

Modified: trunk/debugger/languages/native/NativeEnumType.cs
===================================================================
--- trunk/debugger/languages/native/NativeEnumType.cs   2005-09-23 19:36:37 UTC 
(rev 50617)
+++ trunk/debugger/languages/native/NativeEnumType.cs   2005-09-23 19:37:30 UTC 
(rev 50618)
@@ -2,17 +2,23 @@
 
 namespace Mono.Debugger.Languages.Native
 {
-       internal class NativeEnumType : NativeType, ITargetEnumType
+       internal class NativeEnumType : TargetType, ITargetEnumType
        {
+               string name;
+               int size;
+
                string[] element_names;
                int[] element_values;
 
                NativeFieldInfo[] members;
                NativeFieldInfo value;
 
-               public NativeEnumType (string name, int size, string[] 
element_names, int[] element_values)
-                       : base (name, TargetObjectKind.Enum, size, true)
+               public NativeEnumType (ILanguage language, string name, int 
size,
+                                      string[] element_names, int[] 
element_values)
+                       : base (language, TargetObjectKind.Enum)
                {
+                       this.name = name;
+                       this.size = size;
                        this.element_names = element_names;
                        this.element_values = element_values;
 
@@ -24,6 +30,18 @@
                        }
                }
 
+               public override string Name {
+                       get { return name; }
+               }
+
+               public override int Size {
+                       get { return size; }
+               }
+
+               public override bool HasFixedSize {
+                       get { return true; }
+               }
+
                public string[] ElementNames {
                        get {
                                return element_names;
@@ -59,7 +77,7 @@
                        }
                }
 
-               public override NativeObject GetObject (TargetLocation location)
+               public override TargetObject GetObject (TargetLocation location)
                {
                        return new NativeEnumObject (this, location);
                }

Modified: trunk/debugger/languages/native/NativeFunctionType.cs
===================================================================
--- trunk/debugger/languages/native/NativeFunctionType.cs       2005-09-23 
19:36:37 UTC (rev 50617)
+++ trunk/debugger/languages/native/NativeFunctionType.cs       2005-09-23 
19:37:30 UTC (rev 50618)
@@ -2,18 +2,33 @@
 
 namespace Mono.Debugger.Languages.Native
 {
-       internal class NativeFunctionType : NativeType, ITargetFunctionType
+       internal class NativeFunctionType : TargetType, ITargetFunctionType
        {
-               NativeType return_type;
-               NativeType[] parameter_types;
+               string name;
+               TargetType return_type;
+               TargetType[] parameter_types;
 
-               public NativeFunctionType (string name, NativeType return_type, 
NativeType[] parameter_types)
-                       : base (name, TargetObjectKind.Function, 0)
+               public NativeFunctionType (ILanguage language, string name,
+                                          TargetType return_type, TargetType[] 
parameter_types)
+                       : base (language, TargetObjectKind.Function)
                {
+                       this.name = name;
                        this.return_type = return_type;
                        this.parameter_types = parameter_types;
                }
 
+               public override string Name {
+                       get { return name; }
+               }
+
+               public override int Size {
+                       get { return Language.TargetInfo.TargetAddressSize; }
+               }
+
+               public override bool HasFixedSize {
+                       get { return true; }
+               }
+
                public override bool IsByRef {
                        get {
                                return false;
@@ -22,17 +37,17 @@
 
                public bool HasReturnValue {
                        get {
-                               return return_type != VoidType;
+                               return return_type != Language.VoidType;
                        }
                }
 
-               public NativeType ReturnType {
+               public TargetType ReturnType {
                        get {
                                return return_type;
                        }
                }
 
-               public NativeType[] ParameterTypes {
+               public TargetType[] ParameterTypes {
                        get {
                                return parameter_types;
                        }
@@ -74,7 +89,7 @@
                        }
                }
 
-               public override NativeObject GetObject (TargetLocation location)
+               public override TargetObject GetObject (TargetLocation location)
                {
                        throw new NotSupportedException ();
                }

Modified: trunk/debugger/languages/native/NativeFundamentalObject.cs
===================================================================
--- trunk/debugger/languages/native/NativeFundamentalObject.cs  2005-09-23 
19:36:37 UTC (rev 50617)
+++ trunk/debugger/languages/native/NativeFundamentalObject.cs  2005-09-23 
19:37:30 UTC (rev 50618)
@@ -2,9 +2,9 @@
 
 namespace Mono.Debugger.Languages.Native
 {
-       internal class NativeFundamentalObject : NativeObject, 
ITargetFundamentalObject
+       internal class NativeFundamentalObject : TargetObject, 
ITargetFundamentalObject
        {
-               public NativeFundamentalObject (NativeType type, TargetLocation 
location)
+               public NativeFundamentalObject (TargetType type, TargetLocation 
location)
                        : base (type, location)
                { }
 
@@ -14,37 +14,14 @@
                        throw new InvalidOperationException ();
                }
 
-               public virtual object GetObject (ITargetAccess target)
-               {
-                       try {
-                               TargetBlob blob;
-                               if (type.HasFixedSize)
-                                       blob = location.ReadMemory (type.Size);
-                               else
-                                       blob = GetDynamicContents (location, 
MaximumDynamicSize);
-
-                               return GetObject (blob, location);
-                       } catch (TargetException ex) {
-                               throw new LocationInvalidException (ex);
-                       }
-               }
-
                internal void SetObject (object obj)
                {
-                       try {
-                               byte [] data = CreateObject (obj);
-                               if (!type.HasFixedSize || (data == null) ||
-                                   (data.Length != type.Size))
-                                       throw new NotSupportedException ();
-
-                               RawContents = data;
-                       } catch (TargetException ex) {
-                               throw new LocationInvalidException (ex);
-                       }
                }
 
-               protected object GetObject (TargetBlob blob, TargetLocation 
locaction)
+               public virtual object GetObject (ITargetAccess target)
                {
+                       TargetBlob blob = location.ReadMemory (Type.Size);
+
                        switch (((NativeFundamentalType) type).FundamentalKind) 
{
                        case FundamentalKind.Boolean:
                                return blob.Contents [0] != 0;

Modified: trunk/debugger/languages/native/NativeFundamentalType.cs
===================================================================
--- trunk/debugger/languages/native/NativeFundamentalType.cs    2005-09-23 
19:36:37 UTC (rev 50617)
+++ trunk/debugger/languages/native/NativeFundamentalType.cs    2005-09-23 
19:37:30 UTC (rev 50618)
@@ -2,16 +2,33 @@
 
 namespace Mono.Debugger.Languages.Native
 {
-       internal class NativeFundamentalType : NativeType, 
ITargetFundamentalType
+       internal class NativeFundamentalType : TargetType, 
ITargetFundamentalType
        {
+               string name;
+               int size;
                FundamentalKind fundamental_kind;
 
-               public NativeFundamentalType (string name, FundamentalKind 
kind, int size)
-                       : base (name, TargetObjectKind.Fundamental, size)
+               public NativeFundamentalType (ILanguage language, string name,
+                                             FundamentalKind kind, int size)
+                       : base (language, TargetObjectKind.Fundamental)
                {
+                       this.name = name;
+                       this.size = size;
                        this.fundamental_kind = kind;
                }
 
+               public override string Name {
+                       get { return name; }
+               }
+
+               public override int Size {
+                       get { return size; }
+               }
+
+               public override bool HasFixedSize {
+                       get { return true; }
+               }
+
                public override bool IsByRef {
                        get {
                                switch (fundamental_kind) {
@@ -33,7 +50,7 @@
                        }
                }
 
-               public override NativeObject GetObject (TargetLocation location)
+               public override TargetObject GetObject (TargetLocation location)
                {
                        return new NativeFundamentalObject (this, location);
                }

Modified: trunk/debugger/languages/native/NativeLanguage.cs
===================================================================
--- trunk/debugger/languages/native/NativeLanguage.cs   2005-09-23 19:36:37 UTC 
(rev 50617)
+++ trunk/debugger/languages/native/NativeLanguage.cs   2005-09-23 19:37:30 UTC 
(rev 50618)
@@ -11,6 +11,7 @@
                NativeFundamentalType integer_type;
                NativeFundamentalType long_type;
                NativePointerType pointer_type;
+               NativeOpaqueType void_type;
                ITargetInfo info;
 
                public NativeLanguage (BfdContainer bfd_container, ITargetInfo 
info)
@@ -18,9 +19,10 @@
                        this.bfd_container = bfd_container;
                        this.info = info;
 
-                       integer_type = new NativeFundamentalType ("int", 
FundamentalKind.Int32, 4);
-                       long_type = new NativeFundamentalType ("long", 
FundamentalKind.Int64, 8);
-                       pointer_type = new NativePointerType ("void *", 
info.TargetAddressSize);
+                       integer_type = new NativeFundamentalType (this, "int", 
FundamentalKind.Int32, 4);
+                       long_type = new NativeFundamentalType (this, "long", 
FundamentalKind.Int64, 8);
+                       pointer_type = new NativePointerType (this, "void *", 
info.TargetAddressSize);
+                       void_type = new NativeOpaqueType (this, "void", 0);
                }
 
                public string Name {
@@ -43,6 +45,10 @@
                        get { return pointer_type; }
                }
 
+               public ITargetType VoidType {
+                       get { return void_type; }
+               }
+
                public ITargetInfo TargetInfo {
                        get { return info; }
                }

Deleted: trunk/debugger/languages/native/NativeObject.cs
===================================================================
--- trunk/debugger/languages/native/NativeObject.cs     2005-09-23 19:36:37 UTC 
(rev 50617)
+++ trunk/debugger/languages/native/NativeObject.cs     2005-09-23 19:37:30 UTC 
(rev 50618)
@@ -1,131 +0,0 @@
-using System;
-
-namespace Mono.Debugger.Languages.Native
-{
-       internal abstract class NativeObject : MarshalByRefObject, ITargetObject
-       {
-               protected ITargetType type;
-               protected TargetLocation location;
-
-               public NativeObject (ITargetType type, TargetLocation location)
-               {
-                       this.type = type;
-                       this.location = location;
-               }
-
-               public ITargetType Type {
-                       get {
-                               return type;
-                       }
-               }
-
-               public string TypeName {
-                       get {
-                               return type.Name;
-                       }
-               }
-
-               public TargetObjectKind Kind {
-                       get {
-                               return type.Kind;
-                       }
-               }
-
-               public bool IsNull {
-                       get {
-                               if (!location.HasAddress)
-                                       return false;
-                               else
-                                       return location.Address.IsNull;
-                       }
-               }
-
-               public virtual byte[] RawContents {
-                       get {
-                               try {
-                                       return location.ReadBuffer (type.Size);
-                               } catch (TargetException ex) {
-                                       throw new LocationInvalidException (ex);
-                               }
-                       }
-                       set {
-                               try {
-                                       if (!type.HasFixedSize || (value.Length 
!= type.Size))
-                                               throw new ArgumentException ();
-                                       location.WriteBuffer (value);
-                               } catch (TargetException ex) {
-                                       throw new LocationInvalidException (ex);
-                               }
-                       }
-               }
-
-               protected virtual int MaximumDynamicSize {
-                       get {
-                               return -1;
-                       }
-               }
-
-               public virtual long DynamicSize {
-                       get {
-                               if (type.HasFixedSize)
-                                       throw new InvalidOperationException ();
-
-                               try {
-                                       TargetLocation dynamic_location;
-                                       TargetBlob blob = location.ReadMemory 
(type.Size);
-                                       return GetDynamicSize (blob, location, 
out dynamic_location);
-                               } catch (TargetException ex) {
-                                       throw new LocationInvalidException (ex);
-                               }
-                       }
-               }
-
-               public virtual byte[] GetRawDynamicContents (int max_size)
-               {
-                       if (type.HasFixedSize)
-                               throw new InvalidOperationException ();
-
-                       try {
-                               return GetDynamicContents (location, 
max_size).Contents;
-                       } catch (TargetException ex) {
-                               throw new LocationInvalidException (ex);
-                       }
-               }
-
-               protected virtual TargetBlob GetDynamicContents (TargetLocation 
location,
-                                                                int max_size)
-               {
-                       try {
-                               TargetLocation dynamic_location;
-                               TargetBlob blob = location.ReadMemory 
(type.Size);
-                               long size = GetDynamicSize (blob, location, out 
dynamic_location);
-
-                               if ((max_size > 0) && (size > (long) max_size))
-                                       size = max_size;
-
-                               return dynamic_location.ReadMemory ((int) size);
-                       } catch (TargetException ex) {
-                               throw new LocationInvalidException (ex);
-                       }
-               }
-
-               protected abstract long GetDynamicSize (TargetBlob blob, 
TargetLocation location,
-                                                       out TargetLocation 
dynamic_location);
-
-               public TargetLocation Location {
-                       get {
-                               return location;
-                       }
-               }
-
-               public virtual string Print (ITargetAccess target)
-               {
-                       return ToString ();
-               }
-
-               public override string ToString ()
-               {
-                       return String.Format ("{0} [{1}]", GetType (), Type);
-               }
-       }
-}

Modified: trunk/debugger/languages/native/NativeOpaqueObject.cs
===================================================================
--- trunk/debugger/languages/native/NativeOpaqueObject.cs       2005-09-23 
19:36:37 UTC (rev 50617)
+++ trunk/debugger/languages/native/NativeOpaqueObject.cs       2005-09-23 
19:37:30 UTC (rev 50618)
@@ -2,7 +2,7 @@
 
 namespace Mono.Debugger.Languages.Native
 {
-       internal class NativeOpaqueObject : NativeObject
+       internal class NativeOpaqueObject : TargetObject
        {
                public NativeOpaqueObject (NativeOpaqueType type, 
TargetLocation location)
                        : base (type, location)
@@ -13,11 +13,6 @@
                {
                        throw new InvalidOperationException ();
                }
-
-               public override string ToString ()
-               {
-                       return TargetBinaryReader.HexDump (RawContents);
-               }
        }
 }
 

Modified: trunk/debugger/languages/native/NativeOpaqueType.cs
===================================================================
--- trunk/debugger/languages/native/NativeOpaqueType.cs 2005-09-23 19:36:37 UTC 
(rev 50617)
+++ trunk/debugger/languages/native/NativeOpaqueType.cs 2005-09-23 19:37:30 UTC 
(rev 50618)
@@ -2,19 +2,37 @@
 
 namespace Mono.Debugger.Languages.Native
 {
-       internal class NativeOpaqueType : NativeType
+       internal class NativeOpaqueType : TargetType
        {
-               public NativeOpaqueType (string name, int size)
-                       : base (name, TargetObjectKind.Opaque, size)
-               { }
+               string name;
+               int size;
 
+               public NativeOpaqueType (ILanguage language, string name, int 
size)
+                       : base (language, TargetObjectKind.Opaque)
+               {
+                       this.name = name;
+                       this.size = size;
+               }
+
+               public override string Name {
+                       get { return name; }
+               }
+
+               public override int Size {
+                       get { return size; }
+               }
+
+               public override bool HasFixedSize {
+                       get { return true; }
+               }
+
                public override bool IsByRef {
                        get {
                                return false;
                        }
                }
 
-               public override NativeObject GetObject (TargetLocation location)
+               public override TargetObject GetObject (TargetLocation location)
                {
                        return new NativeOpaqueObject (this, location);
                }

Modified: trunk/debugger/languages/native/NativePointerObject.cs
===================================================================
--- trunk/debugger/languages/native/NativePointerObject.cs      2005-09-23 
19:36:37 UTC (rev 50617)
+++ trunk/debugger/languages/native/NativePointerObject.cs      2005-09-23 
19:37:30 UTC (rev 50618)
@@ -2,7 +2,7 @@
 
 namespace Mono.Debugger.Languages.Native
 {
-       internal class NativePointerObject : NativeObject, ITargetPointerObject
+       internal class NativePointerObject : TargetObject, ITargetPointerObject
        {
                new NativePointerType type;
 

Modified: trunk/debugger/languages/native/NativePointerType.cs
===================================================================
--- trunk/debugger/languages/native/NativePointerType.cs        2005-09-23 
19:36:37 UTC (rev 50617)
+++ trunk/debugger/languages/native/NativePointerType.cs        2005-09-23 
19:37:30 UTC (rev 50618)
@@ -2,20 +2,39 @@
 
 namespace Mono.Debugger.Languages.Native
 {
-       internal class NativePointerType : NativeType, ITargetPointerType
+       internal class NativePointerType : TargetType, ITargetPointerType
        {
-               public NativePointerType (string name, int size)
-                       : base (name, TargetObjectKind.Pointer, size)
-               { }
+               string name;
+               int size;
 
-               public NativePointerType (string name, NativeType target_type, 
int size)
-                       : base (name, TargetObjectKind.Pointer, size)
+               public NativePointerType (ILanguage language, string name, int 
size)
+                       : base (language, TargetObjectKind.Pointer)
                {
+                       this.name = name;
+                       this.size = size;
+               }
+
+               public NativePointerType (ILanguage language, string name,
+                                         TargetType target_type, int size)
+                       : this (language, name, size)
+               {
                        this.target_type = target_type;
                }
 
-               NativeType target_type;
+               TargetType target_type;
 
+               public override string Name {
+                       get { return name; }
+               }
+
+               public override int Size {
+                       get { return size; }
+               }
+
+               public override bool HasFixedSize {
+                       get { return true; }
+               }
+
                public override bool IsByRef {
                        get {
                                return true;
@@ -40,7 +59,7 @@
                        }
                }
 
-               public NativeType StaticType {
+               public TargetType StaticType {
                        get {
                                if (target_type == null)
                                        throw new InvalidOperationException ();
@@ -55,7 +74,7 @@
                        }
                }
 
-               public override NativeObject GetObject (TargetLocation location)
+               public override TargetObject GetObject (TargetLocation location)
                {
                        return new NativePointerObject (this, location);
                }

Modified: trunk/debugger/languages/native/NativeStringObject.cs
===================================================================
--- trunk/debugger/languages/native/NativeStringObject.cs       2005-09-23 
19:36:37 UTC (rev 50617)
+++ trunk/debugger/languages/native/NativeStringObject.cs       2005-09-23 
19:37:30 UTC (rev 50618)
@@ -5,11 +5,11 @@
 {
        internal class NativeStringObject : NativeFundamentalObject
        {
-               public NativeStringObject (NativeType type, TargetLocation 
location)
+               public NativeStringObject (TargetType type, TargetLocation 
location)
                        : base (type, location)
                { }
 
-               protected override int MaximumDynamicSize {
+               protected int MaximumDynamicSize {
                        get {
                                return NativeStringType.MaximumStringLength;
                        }

Modified: trunk/debugger/languages/native/NativeStringType.cs
===================================================================
--- trunk/debugger/languages/native/NativeStringType.cs 2005-09-23 19:36:37 UTC 
(rev 50617)
+++ trunk/debugger/languages/native/NativeStringType.cs 2005-09-23 19:37:30 UTC 
(rev 50618)
@@ -6,8 +6,8 @@
        {
                static int max_string_length = 100;
 
-               public NativeStringType (int size)
-                       : base ("char *", FundamentalKind.String, size)
+               public NativeStringType (ILanguage language, int size)
+                       : base (language, "char *", FundamentalKind.String, 
size)
                { }
 
                public override bool IsByRef {
@@ -26,7 +26,7 @@
                        }
                }
 
-               public override NativeObject GetObject (TargetLocation location)
+               public override TargetObject GetObject (TargetLocation location)
                {
                        return new NativeStringObject (this, location);
                }

Modified: trunk/debugger/languages/native/NativeStructObject.cs
===================================================================
--- trunk/debugger/languages/native/NativeStructObject.cs       2005-09-23 
19:36:37 UTC (rev 50617)
+++ trunk/debugger/languages/native/NativeStructObject.cs       2005-09-23 
19:37:30 UTC (rev 50618)
@@ -2,7 +2,7 @@
 
 namespace Mono.Debugger.Languages.Native
 {
-       internal class NativeStructObject : NativeObject, ITargetStructObject
+       internal class NativeStructObject : TargetObject, ITargetStructObject
        {
                new NativeStructType type;
 
@@ -25,7 +25,7 @@
 
                public void SetField (int index, ITargetObject obj)
                {
-                       type.SetField (location, index, (NativeObject) obj);
+                       type.SetField (location, index, (TargetObject) obj);
                }
 
                public ITargetObject GetProperty (int index)

Modified: trunk/debugger/languages/native/NativeStructType.cs
===================================================================
--- trunk/debugger/languages/native/NativeStructType.cs 2005-09-23 19:36:37 UTC 
(rev 50617)
+++ trunk/debugger/languages/native/NativeStructType.cs 2005-09-23 19:37:30 UTC 
(rev 50618)
@@ -5,12 +5,12 @@
        [Serializable]
        internal abstract class NativeStructMember : ITargetMemberInfo
        {
-               public readonly NativeType Type;
+               public readonly TargetType Type;
                public readonly string Name;
                public readonly int Index;
                public readonly bool IsStatic;
 
-               public NativeStructMember (NativeType type, string name, int 
index, bool is_static)
+               public NativeStructMember (TargetType type, string name, int 
index, bool is_static)
                {
                        this.Type = type;
                        this.Name = name;
@@ -58,13 +58,13 @@
                bool has_const_value;
                int const_value;
 
-               public NativeFieldInfo (NativeType type, string name, int 
index, int offset)
+               public NativeFieldInfo (TargetType type, string name, int 
index, int offset)
                        : base (type, name, index, false)
                {
                        this.offset = offset;
                }
 
-               public NativeFieldInfo (NativeType type, string name, int 
index, int offset,
+               public NativeFieldInfo (TargetType type, string name, int 
index, int offset,
                                        int bit_offset, int bit_size)
                        : this (type, name, index, offset)
                {
@@ -73,7 +73,7 @@
                        this.is_bitfield = true;
                }
 
-               public NativeFieldInfo (NativeType type, string name, int index,
+               public NativeFieldInfo (TargetType type, string name, int index,
                                        bool has_const_value, int const_value)
                        : base (type, name, index, false)
                {
@@ -149,16 +149,22 @@
                }
        }
 
-       internal class NativeStructType : NativeType, ITargetStructType
+       internal class NativeStructType : TargetType, ITargetStructType
        {
+               string name;
+               int size;
                NativeFieldInfo[] fields;
 
-               internal NativeStructType (string name, int size)
-                       : base (name, TargetObjectKind.Struct, size)
-               { }
+               internal NativeStructType (ILanguage language, string name, int 
size)
+                       : base (language, TargetObjectKind.Struct)
+               {
+                       this.name = name;
+                       this.size = size;
+               }
 
-               internal NativeStructType (string name, NativeFieldInfo[] 
fields, int size)
-                       : this (name, size)
+               internal NativeStructType (ILanguage language, string name,
+                                          NativeFieldInfo[] fields, int size)
+                       : this (language, name, size)
                {
                        this.fields = fields;
                }
@@ -168,6 +174,18 @@
                        this.fields = fields;
                }
 
+               public override string Name {
+                       get { return name; }
+               }
+
+               public override int Size {
+                       get { return size; }
+               }
+
+               public override bool HasFixedSize {
+                       get { return true; }
+               }
+
                public override bool IsByRef {
                        get {
                                return false;
@@ -259,12 +277,12 @@
                        return true;
                }
 
-               public override NativeObject GetObject (TargetLocation location)
+               public override TargetObject GetObject (TargetLocation location)
                {
                        return new NativeStructObject (this, location);
                }
 
-               internal NativeObject GetField (TargetLocation location, int 
index)
+               internal TargetObject GetField (TargetLocation location, int 
index)
                {
                        NativeFieldInfo field = fields [index];
 
@@ -278,7 +296,7 @@
                        return field.Type.GetObject (field_loc);
                }
 
-               internal void SetField (TargetLocation location, int index, 
NativeObject obj)
+               internal void SetField (TargetLocation location, int index, 
TargetObject obj)
                {
                        NativeFieldInfo field = fields [index];
 

Deleted: trunk/debugger/languages/native/NativeType.cs
===================================================================
--- trunk/debugger/languages/native/NativeType.cs       2005-09-23 19:36:37 UTC 
(rev 50617)
+++ trunk/debugger/languages/native/NativeType.cs       2005-09-23 19:37:30 UTC 
(rev 50618)
@@ -1,69 +0,0 @@
-using System;
-
-namespace Mono.Debugger.Languages.Native
-{
-       internal abstract class NativeType : MarshalByRefObject, ITargetType
-       {
-               protected readonly TargetObjectKind kind;
-
-               string name;
-               bool has_fixed_size;
-               int size;
-
-               protected NativeType (string name, TargetObjectKind kind, int 
size)
-                       : this (name, kind, size, true)
-               { }
-
-               protected NativeType (string name, TargetObjectKind kind, int 
size, bool has_fixed_size)
-               {
-                       this.name = name;
-                       this.size = size;
-                       this.kind = kind;
-                       this.has_fixed_size = has_fixed_size;
-               }
-
-               public static readonly NativeType VoidType = new 
NativeOpaqueType ("void", 0);
-
-               public TargetObjectKind Kind {
-                       get {
-                               return kind;
-                       }
-               }
-
-               public ILanguage Language {
-                       get {
-                               throw new NotImplementedException ();
-                       }
-               }
-
-               public string Name {
-                       get {
-                               return name;
-                       }
-               }
-
-               public abstract bool IsByRef {
-                       get;
-               }
-
-               public virtual bool HasFixedSize {
-                       get {
-                               return has_fixed_size;
-                       }
-               }
-
-               public virtual int Size {
-                       get {
-                               return size;
-                       }
-               }
-
-               public abstract NativeObject GetObject (TargetLocation 
location);
-
-               public override string ToString ()
-               {
-                       return String.Format ("{0} [{1}:{2}:{3}:{4}]", GetType 
(),
-                                             Name, IsByRef, HasFixedSize, 
Size);
-               }
-       }
-}

Modified: trunk/debugger/languages/native/NativeTypeAlias.cs
===================================================================
--- trunk/debugger/languages/native/NativeTypeAlias.cs  2005-09-23 19:36:37 UTC 
(rev 50617)
+++ trunk/debugger/languages/native/NativeTypeAlias.cs  2005-09-23 19:37:30 UTC 
(rev 50618)
@@ -2,23 +2,39 @@
 
 namespace Mono.Debugger.Languages.Native
 {
-       internal class NativeTypeAlias : NativeType, ITargetTypeAlias
+       internal class NativeTypeAlias : TargetType, ITargetTypeAlias
        {
-               public NativeTypeAlias (string name, string target_name)
-                       : base (name, TargetObjectKind.Alias, 0)
+               string name;
+
+               public NativeTypeAlias (ILanguage language, string name, string 
target_name)
+                       : base (language, TargetObjectKind.Alias)
                {
                        this.target_name = target_name;
+                       this.name = name;
                }
 
-               public NativeTypeAlias (string name, string target_name, 
NativeType target)
-                       : this (name, target_name)
+               public NativeTypeAlias (ILanguage language, string name, string 
target_name,
+                                       TargetType target)
+                       : this (language, name, target_name)
                {
                        this.target_type = target;
                }
 
                string target_name;
-               NativeType target_type;
+               TargetType target_type;
 
+               public override string Name {
+                       get { return name; }
+               }
+
+               public override int Size {
+                       get { return 0; }
+               }
+
+               public override bool HasFixedSize {
+                       get { return true; }
+               }
+
                public override bool IsByRef {
                        get {
                                return false;
@@ -29,7 +45,7 @@
                        get { return target_name; }
                }
 
-               public NativeType TargetType {
+               public TargetType TargetType {
                        get { return target_type; }
                        set { target_type = value; }
                }
@@ -38,7 +54,7 @@
                        get { return target_type; }
                }
 
-               public override NativeObject GetObject (TargetLocation location)
+               public override TargetObject GetObject (TargetLocation location)
                {
                        if (target_type == null)
                                return null;

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

Reply via email to