internal ParameterInfoMirror (MethodMirror method, int pos, TypeMirror type, string name, ParameterAttributes attrs) : base (method.VirtualMachine, 0) { this.method = method; this.pos = pos; this.type = type; this.name = name; this.attrs = attrs; }
public PropertyInfoMirror (TypeMirror parent, long id, string name, MethodMirror get_method, MethodMirror set_method, PropertyAttributes attrs) : base (parent.VirtualMachine, id) { this.parent = parent; this.name = name; this.attrs = attrs; this.get_method = get_method; this.set_method = set_method; }
public PropertyValueReference (EvaluationContext ctx, PropertyInfoMirror property, object obj, TypeMirror declaringType, Value[] indexerArgs): base (ctx) { this.property = property; this.obj = obj; this.declaringType = declaringType; this.indexerArgs = indexerArgs; flags = ObjectValueFlags.Property; if (property.GetSetMethod (true) == null) flags |= ObjectValueFlags.ReadOnly; MethodMirror getter = property.GetGetMethod (true); if (getter.IsStatic) flags |= ObjectValueFlags.Global; if (getter.IsPublic) flags |= ObjectValueFlags.Public; else if (getter.IsPrivate) flags |= ObjectValueFlags.Private; else if (getter.IsFamily) flags |= ObjectValueFlags.Protected; else if (getter.IsFamilyAndAssembly) flags |= ObjectValueFlags.Internal; else if (getter.IsFamilyOrAssembly) flags |= ObjectValueFlags.InternalProtected; if (property.DeclaringType.IsValueType) flags |= ObjectValueFlags.ReadOnly; // Setting property values on structs is not supported by sdb }
public MonoProperty(StackFrame frame, LocalVariable localVariable, TypeMirror typeMirror, Mirror childMirror) { this.frame = frame; this.variable = localVariable; this.mirror = typeMirror; this.childMirror = childMirror; }
public FieldInfoMirror (TypeMirror parent, long id, string name, TypeMirror type, FieldAttributes attrs) : base (parent.VirtualMachine, id) { this.parent = parent; this.name = name; this.type = type; this.attrs = attrs; inited = true; }
public PropertyValueReference (EvaluationContext ctx, PropertyInfoMirror property, object obj, TypeMirror declaringType, MethodMirror getter, Value[] indexerArgs): base (ctx) { this.property = property; this.obj = obj; this.declaringType = declaringType; this.indexerArgs = indexerArgs; flags = GetFlags (property, getter); }
public TypeValue(TypeMirror instance) { Contract.Requires(instance != null); var props = from p in instance.GetAllProperties() where p.HasSimpleGetter() && (p.GetGetMethod(true) != null && p.GetGetMethod(true).IsStatic) || (p.GetSetMethod() != null && p.GetSetMethod().IsStatic) select p; var fields = from f in instance.GetAllFields() where f.IsStatic select f; m_instance = instance; Length = props.Count() + fields.Count(); }
void GetInfo () { if (inited) return; var info = vm.conn.Field_GetInfo (id); name = info.Name; parent = vm.GetType (info.Parent); type = vm.GetType (info.TypeId); attrs = (FieldAttributes)info.Attrs; inited = true; }
public ExpandedProperty(TypeMirror typeMirror, StackFrame frame, LocalVariable localVariable) { this.frame = frame; this.localVariable = localVariable; var properties = typeMirror.GetProperties().Cast<Mirror>(); var methods = typeMirror.GetMethods().Cast<Mirror>(); var fields = typeMirror.GetFields().Cast<Mirror>(); var children = properties.Concat(methods).Concat(fields); allProperties = children.ToList(); }
internal EnumMirror (VirtualMachine vm, TypeMirror type, PrimitiveValue value) : base (vm, type, new Value[] { value }) { if (type == null) throw new ArgumentNullException ("type"); if (value == null) throw new ArgumentNullException ("value"); if (!type.IsEnum) throw new ArgumentException ("type must be an enum type", "type"); TypeMirror t = type.EnumUnderlyingType; if (value.Value == null || !value.Value.GetType ().IsPrimitive || t != vm.RootDomain.GetCorrespondingType (value.Value.GetType ())) throw new ArgumentException ("Value '" + value.Value + "' does not match the type of the enum."); }
internal ExceptionEventRequest (VirtualMachine vm, TypeMirror exc_type, bool caught, bool uncaught) : base (vm, EventType.Exception) { if (exc_type != null) { CheckMirror (vm, exc_type); TypeMirror exception_type = vm.RootDomain.Corlib.GetType ("System.Exception", false, false); if (!exception_type.IsAssignableFrom (exc_type)) throw new ArgumentException ("The exception type does not inherit from System.Exception", "exc_type"); } this.exc_type = exc_type; this.caught = caught; this.uncaught = uncaught; }
public PropertyValueReference (EvaluationContext ctx, PropertyInfoMirror property, object obj, TypeMirror declaringType, MethodMirror getter, Value[] indexerArgs): base (ctx) { this.declaringType = declaringType; this.indexerArgs = indexerArgs; this.property = property; this.getter = getter; this.obj = obj; var objectMirror = obj as ObjectMirror; if (objectMirror != null) EnsureContextHasDomain (objectMirror.Domain); flags = GetFlags (property, getter); }
DC.StackFrame CreateStackFrame(MDB.StackFrame frame) { MDB.MethodMirror method = frame.Method; MDB.TypeMirror type = method.DeclaringType; string methodName = method.Name; if (type != null) { methodName = type.FullName + "." + methodName; } var location = new DC.SourceLocation(methodName, SoftDebuggerSession.NormalizePath(frame.FileName), frame.LineNumber); var lang = frame.Method != null ? "Managed" : "Native"; return(new DC.StackFrame(frame.ILOffset, method.FullName, location, lang, session.IsExternalCode(frame), true, type.Module.FullyQualifiedName, type.FullName)); }
internal T GetObject <T> (long id, long domain_id, long type_id) where T : ObjectMirror { lock (objects_lock) { if (objects == null) { objects = new Dictionary <long, ObjectMirror> (); } ObjectMirror obj; if (!objects.TryGetValue(id, out obj)) { /* * Obtain the domain/type of the object to determine the type of * object we need to create. */ if (domain_id == 0) { domain_id = conn.Object_GetDomain(id); } AppDomainMirror d = GetDomain(domain_id); if (type_id == 0) { type_id = conn.Object_GetType(id); } TypeMirror t = GetType(type_id); if (t.Assembly == d.Corlib && t.Namespace == "System.Threading" && t.Name == "Thread") { obj = new ThreadMirror(this, id, t, d); } else if (t.Assembly == d.Corlib && t.Namespace == "System" && t.Name == "String") { obj = new StringMirror(this, id, t, d); } else if (typeof(T) == typeof(ArrayMirror)) { obj = new ArrayMirror(this, id, t, d); } else { obj = new ObjectMirror(this, id, t, d); } objects [id] = obj; } return((T)obj); } }
internal ExceptionEventRequest(VirtualMachine vm, TypeMirror exc_type, bool caught, bool uncaught) : base(vm, EventType.Exception) { if (exc_type != null) { CheckMirror(vm, exc_type); TypeMirror exception_type = vm.RootDomain.Corlib.GetType("System.Exception", false, false); if (!exception_type.IsAssignableFrom(exc_type)) { throw new ArgumentException("The exception type does not inherit from System.Exception", "exc_type"); } } this.exc_type = exc_type; this.caught = caught; this.uncaught = uncaught; this.subclasses = true; }
public FieldValueReference (EvaluationContext ctx, FieldInfoMirror field, object obj, TypeMirror declaringType, string vname, ObjectValueFlags vflags): base (ctx) { this.field = field; this.obj = obj; this.declaringType = declaringType; this.vname = vname; flags = vflags; if (field.IsStatic) this.obj = null; flags |= GetFlags (field); if (obj is PrimitiveValue) flags |= ObjectValueFlags.ReadOnly; }
public TypeMirror[] GetNestedTypes(BindingFlags bindingAttr) { if (nested != null) { return(nested); } // FIXME: bindingAttr GetInfo(); var arr = new TypeMirror [info.nested.Length]; for (int i = 0; i < arr.Length; ++i) { arr [i] = vm.GetType(info.nested [i]); } nested = arr; return(nested); }
CustomAttributeDataMirror[] GetCAttrs(TypeMirror type, bool inherit) { // FIXME: Handle inherit if (cattrs == null) { CattrInfo[] info = vm.conn.Type_GetCustomAttributes(id, 0, false); cattrs = CustomAttributeDataMirror.Create(vm, info); } var res = new List <CustomAttributeDataMirror> (); foreach (var attr in cattrs) { if (type == null || attr.Constructor.DeclaringType == type) { res.Add(attr); } } return(res.ToArray()); }
internal TypeMirror GetType(long id) { lock (types_lock) { if (types == null) { types = new Dictionary <long, TypeMirror> (); } TypeMirror obj; if (id == 0) { return(null); } if (!types.TryGetValue(id, out obj)) { obj = new TypeMirror(this, id); types [id] = obj; } return(obj); } }
internal EnumMirror(VirtualMachine vm, TypeMirror type, PrimitiveValue value) : base(vm, type, new Value[] { value }) { if (type == null) { throw new ArgumentNullException("type"); } if (value == null) { throw new ArgumentNullException("value"); } if (!type.IsEnum) { throw new ArgumentException("type must be an enum type", "type"); } TypeMirror t = type.EnumUnderlyingType; if (value.Value == null || !value.Value.GetType().IsPrimitive || t != vm.RootDomain.GetCorrespondingType(value.Value.GetType())) { throw new ArgumentException("Value '" + value.Value + "' does not match the type of the enum."); } }
public FieldValueReference (EvaluationContext ctx, FieldInfoMirror field, object obj, TypeMirror declaringType, string vname, ObjectValueFlags vflags, FieldReferenceBatch batch = null): base (ctx) { this.field = field; this.obj = obj; this.declaringType = declaringType; this.vname = vname; this.batch = batch; flags = vflags; if (field.IsStatic) this.obj = null; var objectMirror = obj as ObjectMirror; if (objectMirror != null) EnsureContextHasDomain (objectMirror.Domain); flags |= GetFlags (field); if (obj is PrimitiveValue) flags |= ObjectValueFlags.ReadOnly; }
public FieldValueReference (EvaluationContext ctx, FieldInfoMirror field, object obj, TypeMirror declaringType, string vname, ObjectValueFlags vflags): base (ctx) { this.field = field; this.obj = obj; this.declaringType = declaringType; this.vname = vname; flags = vflags; if (field.IsStatic) { flags |= ObjectValueFlags.Global; this.obj = null; } if (field.IsPublic) flags |= ObjectValueFlags.Public; else if (field.IsPrivate) flags |= ObjectValueFlags.Private; else if (field.IsFamily) flags |= ObjectValueFlags.Protected; else if (field.IsFamilyAndAssembly) flags |= ObjectValueFlags.Internal; else if (field.IsFamilyOrAssembly) flags |= ObjectValueFlags.InternalProtected; if (obj is PrimitiveValue) flags |= ObjectValueFlags.ReadOnly; }
public bool IsAcceptableType(TypeMirror t) { return(IsAcceptable(ParseFullName(t))); }
internal TypeMirror[] GetTypes (long[] ids) { var res = new TypeMirror [ids.Length]; for (int i = 0; i < ids.Length; ++i) res [i] = GetType (ids [i]); return res; }
void GetInfo () { var info = vm.conn.Object_GetInfo (id); type = vm.GetType (info.type_id); domain = vm.GetDomain (info.domain_id); }
public EnumMirror CreateEnumMirror(TypeMirror type, PrimitiveValue value) { return(new EnumMirror(this, type, value)); }
public ExceptionEventRequest CreateExceptionRequest(TypeMirror exc_type, bool caught, bool uncaught) { return(new ExceptionEventRequest(this, exc_type, caught, uncaught)); }
DC.StackFrame CreateStackFrame(MDB.StackFrame frame) { MDB.MethodMirror method = frame.Method; MDB.TypeMirror type = method.DeclaringType; string fileName = frame.FileName; string typeFullName = null; string typeFQN = null; string methodName; if (fileName != null) { fileName = SoftDebuggerSession.NormalizePath(fileName); } if (method.VirtualMachine.Version.AtLeast(2, 12) && method.IsGenericMethod) { StringBuilder name = new StringBuilder(method.Name); name.Append('<'); if (method.VirtualMachine.Version.AtLeast(2, 15)) { bool first = true; foreach (var argumentType in method.GetGenericArguments()) { if (!first) { name.Append(", "); } name.Append(session.Adaptor.GetDisplayTypeName(argumentType.FullName)); first = false; } } name.Append('>'); methodName = name.ToString(); } else { methodName = method.Name; } // Compiler generated anonymous/lambda methods bool special_method = false; if (methodName [0] == '<' && methodName.Contains(">m__")) { int nidx = methodName.IndexOf(">m__") + 2; methodName = "AnonymousMethod" + methodName.Substring(nidx, method.Name.Length - nidx); special_method = true; } if (type != null) { string typeDisplayName = session.Adaptor.GetDisplayTypeName(type.FullName); if (SoftDebuggerAdaptor.IsGeneratedType(type)) { // The user-friendly method name is embedded in the generated type name var mn = SoftDebuggerAdaptor.GetNameFromGeneratedType(type); // Strip off the generated type name int dot = typeDisplayName.LastIndexOf('.'); var tname = typeDisplayName.Substring(0, dot); // Keep any type arguments int targs = typeDisplayName.LastIndexOf('<'); if (targs > dot + 1) { mn += typeDisplayName.Substring(targs, typeDisplayName.Length - targs); } typeDisplayName = tname; if (special_method) { typeDisplayName += "." + mn; } else { methodName = mn; } } methodName = typeDisplayName + "." + methodName; typeFQN = type.Module.FullyQualifiedName; typeFullName = type.FullName; } var location = new DC.SourceLocation(methodName, fileName, frame.LineNumber); var external = session.IsExternalCode(frame); return(new SoftDebuggerStackFrame(frame, method.FullName, location, "Managed", external, true, typeFQN, typeFullName)); }
public bool IsExternalCode (TypeMirror type) { return assemblyFilters != null && !assemblyFilters.Contains (type.Assembly); }
internal StructMirror(VirtualMachine vm, TypeMirror type, Value[] fields) : base(vm, 0) { this.type = type; this.fields = fields; }
public PointerValue(VirtualMachine vm, TypeMirror type, long addr) : base(vm, 0) { this.type = type; this.addr = addr; }
internal StringMirror(VirtualMachine vm, long id, TypeMirror type, AppDomainMirror domain) : base(vm, id, type, domain) { length = -1; }
internal EnumMirror(VirtualMachine vm, TypeMirror type, Value[] fields) : base(vm, type, fields) { }
internal T GetObject <T> (long id, long domain_id, long type_id) where T : ObjectMirror { ObjectMirror obj = null; lock (objects_lock) { if (objects == null) { objects = new Dictionary <long, ObjectMirror> (); } objects.TryGetValue(id, out obj); } if (obj == null) { /* * Obtain the domain/type of the object to determine the type of * object we need to create. Do this outside the lock. */ if (domain_id == 0 || type_id == 0) { if (conn.Version.AtLeast(2, 5)) { var info = conn.Object_GetInfo(id); domain_id = info.domain_id; type_id = info.type_id; } else { if (domain_id == 0) { domain_id = conn.Object_GetDomain(id); } if (type_id == 0) { type_id = conn.Object_GetType(id); } } } AppDomainMirror d = GetDomain(domain_id); TypeMirror t = GetType(type_id); if (t.Assembly == d.Corlib && t.Namespace == "System.Threading" && t.Name == "Thread") { obj = new ThreadMirror(this, id, t, d); } else if (t.Assembly == d.Corlib && t.Namespace == "System" && t.Name == "String") { obj = new StringMirror(this, id, t, d); } else if (typeof(T) == typeof(ArrayMirror)) { obj = new ArrayMirror(this, id, t, d); } else { obj = new ObjectMirror(this, id, t, d); } // Publish lock (objects_lock) { ObjectMirror prev_obj; if (objects.TryGetValue(id, out prev_obj)) { obj = prev_obj; } else { objects [id] = obj; } } } return((T)obj); }
CustomAttributeDataMirror[] GetCAttrs (TypeMirror type, bool inherit) { if (cattrs == null && Metadata != null && !Metadata.HasCustomAttributes) cattrs = new CustomAttributeDataMirror [0]; // FIXME: Handle inherit if (cattrs == null) { CattrInfo[] info = vm.conn.Type_GetFieldCustomAttributes (DeclaringType.Id, id, 0, false); cattrs = CustomAttributeDataMirror.Create (vm, info); } var res = new List<CustomAttributeDataMirror> (); foreach (var attr in cattrs) if (type == null || attr.Constructor.DeclaringType == type) res.Add (attr); return res.ToArray (); }
public virtual bool IsAssignableFrom (TypeMirror c) { if (c == null) throw new ArgumentNullException ("c"); CheckMirror (c); // This is complex so do it in the debuggee return vm.conn.Type_IsAssignableFrom (id, c.Id); }
DC.StackFrame CreateStackFrame(MDB.StackFrame frame, int frameIndex) { MDB.MethodMirror method = frame.Method; MDB.TypeMirror type = method.DeclaringType; string fileName = frame.FileName; string typeFullName = null; string typeFQN = null; string methodName; if (fileName != null) { fileName = SoftDebuggerSession.NormalizePath(fileName); } if (method.VirtualMachine.Version.AtLeast(2, 12) && method.IsGenericMethod) { StringBuilder name = new StringBuilder(method.Name); name.Append('<'); if (method.VirtualMachine.Version.AtLeast(2, 15)) { bool first = true; foreach (var argumentType in method.GetGenericArguments()) { if (!first) { name.Append(", "); } name.Append(session.Adaptor.GetDisplayTypeName(argumentType.FullName)); first = false; } } name.Append('>'); methodName = name.ToString(); } else { methodName = method.Name; } if (string.IsNullOrEmpty(methodName)) { methodName = "[Function Without Name]"; } // Compiler generated anonymous/lambda methods bool special_method = false; if (methodName [0] == '<' && methodName.Contains(">m__")) { int nidx = methodName.IndexOf(">m__", StringComparison.Ordinal) + 2; methodName = "AnonymousMethod" + methodName.Substring(nidx, method.Name.Length - nidx); special_method = true; } if (type != null) { string typeDisplayName = session.Adaptor.GetDisplayTypeName(type.FullName); if (SoftDebuggerAdaptor.IsGeneratedType(type)) { // The user-friendly method name is embedded in the generated type name var mn = SoftDebuggerAdaptor.GetNameFromGeneratedType(type); // Strip off the generated type name int dot = typeDisplayName.LastIndexOf('.'); var tname = typeDisplayName.Substring(0, dot); // Keep any type arguments int targs = typeDisplayName.LastIndexOf('<'); if (targs > dot + 1) { mn += typeDisplayName.Substring(targs, typeDisplayName.Length - targs); } typeDisplayName = tname; if (special_method) { typeDisplayName += "." + mn; } else { methodName = mn; } } methodName = typeDisplayName + "." + methodName; typeFQN = type.Module.FullyQualifiedName; typeFullName = type.FullName; } bool external = false; bool hidden = false; if (session.VirtualMachine.Version.AtLeast(2, 21)) { var ctx = GetEvaluationContext(frameIndex, session.EvaluationOptions); var hiddenAttr = session.Adaptor.GetType(ctx, "System.Diagnostics.DebuggerHiddenAttribute") as MDB.TypeMirror; hidden = method.GetCustomAttributes(hiddenAttr, true).Any(); } if (hidden) { external = true; } else { external = session.IsExternalCode(frame); if (!external && session.Options.ProjectAssembliesOnly && session.VirtualMachine.Version.AtLeast(2, 21)) { var ctx = GetEvaluationContext(frameIndex, session.EvaluationOptions); var nonUserCodeAttr = session.Adaptor.GetType(ctx, "System.Diagnostics.DebuggerNonUserCodeAttribute") as MDB.TypeMirror; external = method.GetCustomAttributes(nonUserCodeAttr, true).Any(); } } var location = new DC.SourceLocation(methodName, fileName, frame.LineNumber, frame.ColumnNumber, frame.Location.EndLineNumber, frame.Location.EndColumnNumber, frame.Location.SourceFileHash); string addressSpace = string.Empty; bool hasDebugInfo = false; string language; if (frame.Method != null) { if (frame.IsNativeTransition) { language = "Transition"; } else { addressSpace = method.FullName; language = "Managed"; hasDebugInfo = true; } } else { language = "Native"; } return(new SoftDebuggerStackFrame(frame, addressSpace, location, language, external, hasDebugInfo, hidden, typeFQN, typeFullName)); }
void AppendCustomAttrs (IList<CustomAttributeDataMirror> attrs, TypeMirror type, bool inherit) { if (cattrs == null && Metadata != null && !Metadata.HasCustomAttributes) cattrs = new CustomAttributeDataMirror [0]; if (cattrs == null) { CattrInfo[] info = vm.conn.Type_GetCustomAttributes (id, 0, false); cattrs = CustomAttributeDataMirror.Create (vm, info); } foreach (var attr in cattrs) { if (type == null || attr.Constructor.DeclaringType == type) attrs.Add (attr); } if (inherit && BaseType != null) BaseType.AppendCustomAttrs (attrs, type, inherit); }
void InsertCatchpoint (Catchpoint cp, BreakInfo bi, TypeMirror excType) { var request = bi.Req = vm.CreateExceptionRequest (excType, true, true); request.Count = cp.HitCount; bi.Req.Enabled = bi.Enabled; }
CustomAttributeDataMirror[] GetCustomAttrs (TypeMirror type, bool inherit) { var attrs = new List<CustomAttributeDataMirror> (); AppendCustomAttrs (attrs, type, inherit); return attrs.ToArray (); }
public ExceptionEventRequest CreateExceptionRequest(TypeMirror exc_type) { return(new ExceptionEventRequest(this, exc_type, true, true)); }
// Since protocol version 2.11 public InterfaceMappingMirror GetInterfaceMap (TypeMirror interfaceType) { if (interfaceType == null) throw new ArgumentNullException ("interfaceType"); if (!interfaceType.IsInterface) throw new ArgumentException ("Argument must be an interface.", "interfaceType"); if (IsInterface) throw new ArgumentException ("'this' type cannot be an interface itself"); if (iface_map == null) { // Query the info in bulk GetInterfaces (); var ids = new long [ifaces.Length]; for (int i = 0; i < ifaces.Length; ++i) ids [i] = ifaces [i].Id; var ifacemap = vm.conn.Type_GetInterfaceMap (id, ids); var imap = new Dictionary<TypeMirror, InterfaceMappingMirror> (); for (int i = 0; i < ifacemap.Length; ++i) { IfaceMapInfo info = ifacemap [i]; MethodMirror[] imethods = new MethodMirror [info.iface_methods.Length]; for (int j = 0; j < info.iface_methods.Length; ++j) imethods [j] = vm.GetMethod (info.iface_methods [j]); MethodMirror[] tmethods = new MethodMirror [info.iface_methods.Length]; for (int j = 0; j < info.target_methods.Length; ++j) tmethods [j] = vm.GetMethod (info.target_methods [j]); InterfaceMappingMirror map = new InterfaceMappingMirror (vm, this, vm.GetType (info.iface_id), imethods, tmethods); imap [map.InterfaceType] = map; } iface_map = imap; } InterfaceMappingMirror res; if (!iface_map.TryGetValue (interfaceType, out res)) throw new ArgumentException ("Interface not found", "interfaceType"); return res; }
public string GetLiteralType(TypeMirror t) { return(delayedType.GetLiteralType(t)); }
static bool IsValueTypeOrPrimitive (TypeMirror type) { return type != null && (type.IsValueType || type.IsPrimitive); }
internal ObjectMirror (VirtualMachine vm, long id, TypeMirror type, AppDomainMirror domain) : base (vm, id) { this.type = type; this.domain = domain; }
public bool IsAcceptableType(TypeMirror toType) { return(delayedType.IsAcceptableType(toType)); }
public FieldValueReference (EvaluationContext ctx, FieldInfoMirror field, object obj, TypeMirror declaringType) : this (ctx, field, obj, declaringType, null, ObjectValueFlags.Field) { }
void ResolveBreakpoints (TypeMirror t) { string typeName = t.FullName; types [typeName] = t; /* Handle pending breakpoints */ var resolved = new List<BreakEvent> (); //get the source file paths //full paths, from GetSourceFiles (true), are only supported by sdb protocol 2.2 and later string[] sourceFiles; if (useFullPaths) { sourceFiles = t.GetSourceFiles (true); } else { sourceFiles = t.GetSourceFiles (); //HACK: if mdb paths are windows paths but the sdb agent is on unix, it won't map paths to filenames correctly if (IsWindows) { for (int i = 0; i < sourceFiles.Length; i++) { string s = sourceFiles[i]; if (s != null && !s.StartsWith ("/")) sourceFiles[i] = System.IO.Path.GetFileName (s); } } } foreach (string s in sourceFiles) { List<TypeMirror> typesList; if (source_to_type.TryGetValue (s, out typesList)) { typesList.Add (t); } else { typesList = new List<TypeMirror> (); typesList.Add (t); source_to_type[s] = typesList; } foreach (var bp in pending_bes.OfType<Breakpoint> ()) { if (PathComparer.Compare (PathToFileName (bp.FileName), s) == 0) { Location l = GetLocFromType (t, s, bp.Line); if (l != null) { OnDebuggerOutput (false, string.Format ("Resolved pending breakpoint at '{0}:{1}' to {2}:{3}.\n", s, bp.Line, l.Method.FullName, l.ILOffset)); ResolvePendingBreakpoint (bp, l); resolved.Add (bp); } else { OnDebuggerOutput (true, string.Format ("Could not insert pending breakpoint at '{0}:{1}'. " + "Perhaps the source line does not contain any statements, or the source does not correspond " + "to the current binary.\n", s, bp.Line)); } } } foreach (var be in resolved) pending_bes.Remove (be); resolved.Clear (); } //handle pending catchpoints foreach (var cp in pending_bes.OfType<Catchpoint> ()) { if (cp.ExceptionName == typeName) { ResolvePendingCatchpoint (cp, t); resolved.Add (cp); } } foreach (var be in resolved) pending_bes.Remove (be); }
private static ParsedType OnParseFullName(TypeMirror typ) { // Parse fullName of type to ParsedType that is defined above. Examples for the parsing // are following. // 1) System.Action`1[[System.Int32, mscorlib, Version=xxx, Culture=xxx, // PublicKeyToken=xxx]] // => { nameSpace: "System", typeName: "Action", argTypeNames: ["System.Int32"] } // 2) System.Func`2[[System.Int32, mscorlib, Version=xxx, Culture=xxx, // PublicKeyToken=xxx],[System.Single, mscorlib, Version=xxx, Culture=xxx, // PublicKeyToken=xxx]] // => { nameSpace: "System", typeName: "Func", // argTypeNames: ["System.Int32", "System.Single"] } if (typ == null) { return(null); } string fullName = typ.FullName.Replace('+', '.'); string nmespace = typ.Namespace == "" ? null : typ.Namespace; string typeName = ""; string [] argTypeNames = null; string rest = fullName; if (nmespace != null) { var omit = nmespace + "."; if (!rest.StartsWith(omit, StringComparison.Ordinal)) { throw new ArgumentException("should starts with namespace"); } rest = rest.Substring(omit.Length, rest.Length - omit.Length); } string pattern = @"(.*?)`\d+(.*)"; Match m = Regex.Match(rest, pattern); if (m.Success) { typeName = m.Groups [1].Value; rest = m.Groups [2].Value; int len = rest.Length; if (rest [0] != '[' || rest [len - 1] != ']') { throw new ArgumentException("Failed to skip braces"); } rest = rest.Substring(1, len - 2); argTypeNames = ReadArgTypeNames(rest); } else { if (!rest.EndsWith(typ.Name, StringComparison.Ordinal)) { throw new ArgumentException("invalid"); } typeName = rest; } ParsedType t = new ParsedType(); t.nameSpace = nmespace; t.typeName = typeName; t.argTypeNames = argTypeNames; return(t); }
Location GetLocFromType (TypeMirror type, string file, int line) { Location target_loc = null; foreach (MethodMirror m in type.GetMethods ()) { foreach (Location l in m.Locations) { if (PathComparer.Compare (PathToFileName (l.SourceFile), file) == 0 && l.LineNumber == line) { target_loc = l; break; } } if (target_loc != null) break; } return target_loc; }
public CustomAttributeDataMirror[] GetCustomAttributes (TypeMirror attributeType, bool inherit) { if (attributeType == null) throw new ArgumentNullException ("attributeType"); return GetCAttrs (attributeType, inherit); }
void ResolvePendingCatchpoint (Catchpoint cp, TypeMirror type) { BreakInfo bi = GetBreakInfo (cp); InsertCatchpoint (cp, bi, type); SetBreakEventStatus (cp, true, null); }
internal ThreadMirror(VirtualMachine vm, long id, TypeMirror type, AppDomainMirror domain) : base(vm, id, type, domain) { }
internal ObjectMirror(VirtualMachine vm, long id, TypeMirror type, AppDomainMirror domain) : base(vm, id) { this.type = type; this.domain = domain; }