protected override TargetType CreateType() { TargetType ref_type; if (type_offset == 0) ref_type = language.VoidType; else { reference = GetReference (type_offset); if (reference == null) { Console.WriteLine ( "UNKNOWN POINTER: {0}", comp_unit.RealStartOffset + type_offset); return null; } ref_type = reference.ResolveType (); if (ref_type == null) return null; } TargetFundamentalType fundamental = ref_type as TargetFundamentalType; if ((fundamental != null) && (fundamental.Name == "char")) return new NativeStringType (language, byte_size); TargetFunctionType func = ref_type as TargetFunctionType; if (func != null) return new NativeFunctionPointer (language, func); string name; if (Name != null) name = Name; else name = NativePointerType.MakePointerName (ref_type); return new NativePointerType (language, name, ref_type, byte_size); }
protected override TargetType CreateType() { reference = GetReference (type_offset); if (reference == null) return null; return reference.ResolveType (); }
protected TargetType ResolveType(DieStructureType die_struct) { if ((TypeOffset == 0) || (Name == null)) return null; if ((location == null) && !die_struct.IsUnion) return null; type_die = comp_unit.GetType (TypeOffset); if (type_die == null) return null; if ((location != null) && !read_location ()) return null; type = type_die.ResolveType (); return type; }
protected override TargetType CreateType() { reference = GetReference (type_offset); if (reference == null) { Console.WriteLine ( "UNKNOWN POINTER: {0}", comp_unit.RealStartOffset + type_offset); return null; } TargetType ref_type = reference.ResolveType (); if (ref_type == null) return null; #if false /* not sure we want this */ if (ref_type.TypeHandle == typeof (char)) return new NativeStringType (byte_size); #endif string name; if (Name != null) name = Name; else name = String.Format ("{0} []", ref_type.Name); List<DieSubrangeType> list = new List<DieSubrangeType> (); foreach (Die die in Children) { DieSubrangeType subrange = die as DieSubrangeType; if (subrange != null) list.Add (subrange); } TargetArrayBounds bounds; if (list.Count == 0) bounds = TargetArrayBounds.MakeUnboundArray (); else if ((list.Count == 1) && (list [0].UpperBound == null)) bounds = TargetArrayBounds.MakeUnboundArray (); else if ((list.Count == 1) && ((list [0].LowerBound ?? 0) == 0)) bounds = TargetArrayBounds.MakeSimpleArray ((int) list [0].UpperBound + 1); else { int[] lower = new int [list.Count]; int[] upper = new int [list.Count]; for (int i = 0; i < list.Count; i++) { lower [i] = list [i].LowerBound ?? 0; upper [i] = (int) list [i].UpperBound; } bounds = TargetArrayBounds.MakeMultiArray (lower, upper); } return new NativeArrayType ( language, name, ref_type, bounds, byte_size); }