internal EnumDebugPropertySymbols(IEnumSymbol enumSymbols, IDebugProperty parent, IDebugValue containerValue, CommonExpressionEvaluator evaluator) { this.enumSymbols = enumSymbols; this.parent = parent; this.containerValue = containerValue; this.evaluator = evaluator; }
public virtual BaseProperty MakeProperty(IDebugPropertySymbol symbol, IDebugProperty parent, IDebugValue containerValue) { IDebugMethodSymbol getter = symbol.GetGetter(); IDebugValue value = null; if (getter != null /*&& (context.flags & EvaluationFlags.NoFuncEval) == 0*/) { IEnumSymbol parameters = getter.GetParameters(); if (parameters == null || parameters.Count == 0) { IDebugValue[] arguments = null; if ((getter.Modifiers & SymbolModifiers.Static) == 0) { arguments = new IDebugValue[] { containerValue } } ; else { arguments = new IDebugValue[0]; } value = getter.Evaluate(containerValue, arguments); } } return(this.MakeProperty(symbol.Name, symbol.Type, value, parent)); }
public override IEnumDebugProperty EnumChildren(EnumerationKind kind, int radix, int timeout, bool allowFuncEval) { if (this.value == null || this.value.IsNullReference()) { return(null); } if (this.structuralType.StructuralType == StructTypes.Tuple) { IDebugStructuralType classType = (IDebugStructuralType)this.value.RuntimeType(); IEnumSymbol enumSymbol = classType.GetMembers(null, true, SymbolKind.Field | SymbolKind.Property, SymbolModifiers.All); return(new EnumDebugPropertySymbols(enumSymbol, this, this.value, this.evaluator)); } else if (this.structuralType.StructuralType == StructTypes.Union) { // TODO: Handle Union Types, Properly IDebugStructuralType structType = (IDebugStructuralType)this.value.RuntimeType(); IEnumSymbol enumSymbol = structType.GetMembers(null, true, SymbolKind.Field | SymbolKind.Property, SymbolModifiers.All); return(new EnumDebugPropertySymbols(enumSymbol, this, this.value, this.evaluator)); } else if (this.structuralType.StructuralType == StructTypes.Intersection) { // TODO: Handle Intersection Types, Properly return(null); } return(null); }
public override IEnumDebugProperty EnumChildren(EnumerationKind kind, int radix, int timeout, bool allowFuncEval) { if (this.value == null || this.value.IsNullReference()) { return(null); } IDebugType typ = this.value.RuntimeType(); IDebugClassType classType = null; IDebugStreamType streamType = null; if ((classType = typ as IDebugClassType) != null) { //IEnumSymbol enumSymbol = new CEnumClosureClassSymbols(this.value, this.context); IEnumSymbol enumSymbol = classType.GetClosureClassMembers(this.value); //IEnumSymbol enumSymbol = classType.GetMembers(null, true, SymbolKind.Field|SymbolKind.Property, SymbolModifiers.All); return(new EnumDebugPropertySymbols(enumSymbol, this, this.value, this.evaluator)); } else if ((streamType = typ as IDebugStreamType) != null) { //IDebugStreamType classType = (IDebugStreamType)this.value.RuntimeType(); IEnumSymbol enumSymbol = streamType.GetMembers(null, true, SymbolKind.Field | SymbolKind.Property, SymbolModifiers.All); return(new EnumDebugPropertySymbols(enumSymbol, this, this.value, this.evaluator)); } else { return(null); } }
public virtual IEnumDebugProperty EnumChildren(EnumerationKind kind, int radix, int timeout, bool allowFuncEval) { IEnumSymbol enumSymbols = null; if (kind == EnumerationKind.Locals) { enumSymbols = this.method.GetLocals(); } else if (kind == EnumerationKind.Arguments) { enumSymbols = this.method.GetParameters(); } else if (kind == EnumerationKind.LocalsPlusArguments) { IEnumSymbol thisEnum = new EnumSingleSymbol(this.method.GetThis()); IEnumSymbol localsEnum = this.method.GetLocals(); IEnumSymbol paramsEnum = this.method.GetParameters(); return(new AggregateEnumDebugProperty(this.MakeEnumDebugProperty(thisEnum), this.MakeEnumDebugProperty(paramsEnum), this.MakeEnumDebugProperty(localsEnum))); } else if (kind == EnumerationKind.This) { enumSymbols = new EnumSingleSymbol(this.method.GetThis()); } return(this.MakeEnumDebugProperty(enumSymbols)); }
public DebugMethod(DebugEnvironment envr, CDebugMethodSymbol method, DebugMethodScope scope) { this.debugEnv = envr; this.methodSymbol = method; this.DeclaringType = method.GetDeclaringType().CompilerType; SymbolModifiers modifier = this.methodSymbol.Modifiers; if ((modifier & SymbolModifiers.Abstract) != 0) { this.Flags |= MethodFlags.Abstract; } if ((modifier & SymbolModifiers.Final) != 0) { this.Flags |= MethodFlags.Final; } if ((modifier & SymbolModifiers.Private) != 0) { this.Flags |= MethodFlags.Private; } if ((modifier & SymbolModifiers.Public) != 0) { this.Flags |= MethodFlags.Public; } if ((modifier & SymbolModifiers.Static) != 0) { this.Flags |= MethodFlags.Static; } this.Scope = scope; if (this.methodSymbol != null) { IDebugFieldSymbol thisSymbol = this.methodSymbol.GetThis(); if (thisSymbol != null) { this.ThisParameter = new This(new DebugClassNode(this.debugEnv, thisSymbol.Type, thisSymbol.GetValue(null))); } ParameterList pList = new ParameterList(); IEnumSymbol param = methodSymbol.GetParameters(); if (param != null) { for (int i = 1; ; i++) { if (param.Current == null) { break; } ParameterField paramField = new DebugParameterField(this.debugEnv, param.Current, new Identifier(param.Current.Name), null, scope); paramField.DeclaringType = scope; pList[i] = new Parameter(paramField.Name, paramField.Type); pList[i].ArgumentListIndex = i; param.MoveNext(); } } this.Parameters = pList; } }
public override IEnumDebugProperty EnumChildren(EnumerationKind kind, int radix, int timeout, bool allowFuncEval) { if (this.value == null || this.value.IsNullReference()) { return(null); } IDebugClassType classType = (IDebugClassType)this.value.RuntimeType(); IEnumSymbol enumCountSymbol = classType.GetMembers("Count", true, SymbolKind.Property, SymbolModifiers.All); IEnumSymbol enumElementsSymbol = classType.GetMembers("elements", true, SymbolKind.Field, SymbolModifiers.All); return(new AggregateEnumDebugProperty( new EnumDebugPropertySymbols(enumCountSymbol, this, this.value, this.evaluator), new EnumDebugPropertySymbols(enumElementsSymbol, this, this.value, this.evaluator))); }
public virtual IEnumDebugProperty EnumChildren(EnumerationKind kind, int radix, int timeout, bool allowFuncEval) { IDebugClassType classType = this.type as IDebugClassType; if (classType != null) { IEnumDebugTypes enumBaseClasses = classType.GetBaseClasses(); IEnumSymbol enumMembers = classType.GetMembers(null, true, SymbolKind.Field, SymbolModifiers.All); return(new AggregateEnumDebugProperty( new EnumDebugPropertySymbols(enumMembers, this, this.containerValue, this.evaluator), new EnumDebugPropertyTypes(enumBaseClasses, this, containerValue, this.evaluator))); } return(null); }
public override MemberList GetMembersNamed(Identifier name) { MemberList returnList = new MemberList(); CDebugClassType classType = this.GetDebugType as CDebugClassType; if (classType != null) { IEnumSymbol members = classType.GetMembers(name.Name, true, SymbolKind.Field | SymbolKind.Property, SymbolModifiers.All); if (members != null) { while (members.Current != null) { if (members.Current.Name == name.Name) { Field fieldMember = new DebugFieldNode(this.debugEnv, members.Current, name, this.Value, this, 0); SymbolModifiers modifier = members.Current.Modifiers; if ((modifier & SymbolModifiers.Abstract) != 0) { fieldMember.Flags |= FieldFlags.None; } if ((modifier & SymbolModifiers.Final) != 0) { fieldMember.Flags |= FieldFlags.None; } if ((modifier & SymbolModifiers.Private) != 0) { fieldMember.Flags |= FieldFlags.Private; } if ((modifier & SymbolModifiers.Public) != 0) { fieldMember.Flags |= FieldFlags.Public; } if ((modifier & SymbolModifiers.Static) != 0) { fieldMember.Flags |= FieldFlags.Static; } returnList.Add(fieldMember); break; } members.MoveNext(); } } } return(returnList); }
public override string GetValue(uint radix, uint timeout) { if (this.value == null || this.value.IsNullReference()) { return("null"); } else { IDebugClassType classType = (IDebugClassType)this.value.RuntimeType(); IDebugFieldSymbol countSymbol; IDebugValue count = null; IEnumSymbol enumCountSymbol = classType.GetMembers("count", true, SymbolKind.Field, SymbolModifiers.All); if ((countSymbol = enumCountSymbol.Current as IDebugFieldSymbol) != null) { count = countSymbol.GetValue(this.value); } return("{length = " + count.GetValue().ToString() + "}"); } }
public override IEnumDebugProperty EnumChildren(EnumerationKind kind, int radix, int timeout, bool allowFuncEval) { if (this.value == null || this.value.IsNullReference()) { return(null); } IDebugClassType classType = (IDebugClassType)this.value.RuntimeType(); if (classType.Name.IndexOf("closure") >= 0) { IEnumSymbol closureSymbol = classType.GetClosureClassMembers(this.value); return(new EnumDebugPropertySymbols(closureSymbol, this, this.value, this.evaluator)); } else { IEnumSymbol enumSymbol = classType.GetMembers(null, true, SymbolKind.Field | SymbolKind.Property, SymbolModifiers.All); IEnumDebugTypes enumBaseClasses = classType.GetBaseClasses(); return(new AggregateEnumDebugProperty( new EnumDebugPropertyTypes(enumBaseClasses, this, this.value, this.evaluator), new EnumDebugPropertySymbols(enumSymbol, this, this.value, this.evaluator))); } }
public override MemberList GetMembersNamed(Identifier name) { MemberList returnList = new MemberList(); IDebugSymbol container = this.debugEnv.context.GetContainer(); CDebugMethodSymbol methodSymbol = null; if ((methodSymbol = container as CDebugMethodSymbol) != null) { if (name.Name == "this") { returnList.Add(new DebugFieldNode(this.debugEnv, methodSymbol.GetThis(), name, null, null, 0)); } else { IEnumSymbol param = methodSymbol.GetParameters(); if (param != null) { for (int i = 1; ; i++) { if (param.Current == null) { break; } if (param.Current.Name == name.Name) { DebugParameterField paramField = new DebugParameterField(this.debugEnv, param.Current, name, null, this); paramField.DeclaringType = this; paramField.Parameter = this.DeclaringMethod.Parameters[i]; returnList.Add(paramField); break; } param.MoveNext(); } } } } return(returnList); }
public override MemberList GetMembersNamed(Identifier name) { MemberList returnList = new MemberList(); IDebugSymbol container = this.debugEnv.context.GetContainer(); CDebugMethodSymbol methodSymbol = null; if ((methodSymbol = container as CDebugMethodSymbol) != null) { if (name.Name == "this") { returnList.Add(new DebugFieldNode(this.debugEnv, methodSymbol.GetThis(), name, null, null, 0)); } else { IEnumSymbol locals = methodSymbol.GetLocals(); if (locals != null) { for (int i = 0; ; i++) { if (locals.Current == null) { break; } if (locals.Current.Name == name.Name) { Field localField = new DebugFieldNode(this.debugEnv, locals.Current, name, null, this, i); localField.DeclaringType = this; returnList.Add(localField); break; } locals.MoveNext(); } } } } return(returnList); }
internal EnumDebugPropertySymbols(IEnumSymbol enumSymbols, IDebugProperty parent, IDebugValue containerValue, CommonExpressionEvaluator evaluator){ this.enumSymbols = enumSymbols; this.parent = parent; this.containerValue = containerValue; this.evaluator = evaluator; }
private IEnumDebugProperty MakeEnumDebugProperty(IEnumSymbol enumSymbols){ return new EnumDebugPropertySymbols(enumSymbols, null, null, this.evaluator); }
private IDebugProperty EvaluateExpression(uint evalFlags, uint timeout, IDebugContext context, String resultType) { if (this.debugContext == null) { this.debugContext = new DebugEnvironment(); } this.debugContext.context = context; BlockScope scope = new DebugBlockScope(this.debugContext); ErrorNodeList errors = new ErrorNodeList(); if (this.cciExpr.compiledExpression == null) { this.cciExpr.compiledExpression = (Expression)this.cciExpr.EE.ExprCompiler.CompileParseTree(this.cciExpr.ParsedExpr, scope, new Module(), errors); if (errors.Count > 0) { this.cciExpr.compiledExpression = null; } } if (this.cciExpr.compiledExpression != null) { StackFrame currentFrame = new StackFrame(); IDebugMethodSymbol methodSym = this.debugContext.context.GetContainer() as CDebugMethodSymbol; if (methodSym != null) { IDebugFieldSymbol thisSymbol = methodSym.GetThis(); if (thisSymbol != null) { currentFrame.thisObject = new Literal(thisSymbol.GetValue(null), ((MethodScope )scope.BaseClass).ThisType); } else { currentFrame.thisObject = null; } currentFrame.parameters[0] = currentFrame.thisObject; IEnumSymbol locals = methodSym.GetLocals(); if (locals != null) { for (int i = 0; ; i++) { if (locals.Current == null) { break; } Field localField = new DebugFieldNode(this.debugContext, locals.Current, new Identifier(locals.Current.Name), null, null, i); currentFrame.locals[i] = localField.GetValue(null); locals.MoveNext(); } } IEnumSymbol param = methodSym.GetParameters(); if (param != null) { for (int i = 1; ; i++) { if (param.Current == null) { break; } Field paramField = new DebugFieldNode(this.debugContext, param.Current, new Identifier(param.Current.Name), null, null, i); currentFrame.parameters[i] = paramField.GetValue(null); param.MoveNext(); } } } if (this.cciExpr.EE.ExprEvaluator == null) { this.cciExpr.EE.ExprEvaluator = new Evaluator(); } this.cciExpr.EE.ExprEvaluator.stackFrame = currentFrame; Literal resultExpr = this.cciExpr.EE.ExprEvaluator.VisitExpression(this.cciExpr.compiledExpression) as Literal; if (resultExpr != null) { if (resultExpr.Value is IDebugValue && resultExpr.Type is IDebugInfo) //already wrapped for use by debugger { return(this.cciExpr.EE.MakeProperty(this.cciExpr.Expr, ((IDebugInfo)resultExpr.Type).GetDebugType, (IDebugValue)resultExpr.Value, null)); } else if (resultExpr.Value is IDebugValue) { return(this.cciExpr.EE.MakeProperty(this.cciExpr.Expr, ((IDebugValue)resultExpr.Value).RuntimeType(), (IDebugValue)resultExpr.Value, null)); } if (resultExpr.Value != null) { return(new ExpressionEvalProperty(this.cciExpr.Expr, resultExpr.Type.FullName, resultExpr.Value.ToString(), resultExpr, this.cciExpr.EE)); } } else { return(new ExpressionEvalProperty(this.cciExpr.Expr, String.Empty, "Error Evaluating Expression.", null, this.cciExpr.EE)); } } else if (errors.Count > 0) { return(new ExpressionEvalProperty(this.cciExpr.Expr, String.Empty, errors[0].GetMessage(), null, this.cciExpr.EE)); } return(new ExpressionEvalProperty(this.cciExpr.Expr, String.Empty, "Unknown Compiler Error.", null, this.cciExpr.EE)); }
public bool MoveNext() { bool pRetVal = false; IDebugSymbol saveCurrent = this.m_Current; if (null != this.m_Current) { this.m_Current = null; } else { // Skip the first element this.m_Current = this.Current; this.m_Current = null; } if (this.m_IsEnumeratingClosureClass){ if (this.m_ClosureClassFields.MoveNext()){ this.m_Current = this.m_ClosureClassFields.Current; pRetVal = true; } else{ this.m_IsEnumeratingClosureClass = false; this.m_Current = saveCurrent; pRetVal = this.MoveNext(); } } else{ IDebugField field = null; int fetched = 0; IDebugField[] fields = new IDebugField[1]; this.m_Fields.Next(1, fields, out fetched); if (null != fields[0]){ field = fields[0]; IDebugSymbol symbol = null; symbol = SymbolHelper.SymbolFromDebugField(this.m_Context, field); if (null != symbol){ if (symbol.Name.StartsWith("SS$Closure Class Local")){ this.m_IsEnumeratingClosureClass = true; this.m_ClosureClassFields = new CEnumClosureClassSymbols(((IDebugFieldSymbol) symbol).GetValue(null), this.m_Context); this.m_Current = this.m_ClosureClassFields.Current; pRetVal = true; } else if (String.Compare(symbol.Name, "return value") == 0){ this.m_ReturnLocal = symbol; if (this.m_DisplayRetunLocal){ this.m_Current = symbol; pRetVal = true; } else{ this.m_Current = symbol; pRetVal = this.MoveNext(); } } else if (String.Compare(symbol.Name, "SS$Display Return Local") == 0){ if (this.m_ReturnLocal != null){ this.m_Current = this.m_ReturnLocal; pRetVal = true; } else{ this.m_DisplayRetunLocal = true; pRetVal = this.MoveNext(); } } else{ this.m_Current = symbol; pRetVal = true; } } } } return pRetVal; }
public CEnumClosureClassSymbols(IDebugValue parent, IDebugContext context){ this.m_Context = context; this.m_Parent = parent; this.m_ClassType = parent.RuntimeType() as IDebugClassType; this.m_Current = null; if (this.m_Parent != null && this.m_ClassType != null){ this.m_FieldEnumerator = this.m_ClassType.GetMembers(null, true, SymbolKind.Field, SymbolModifiers.All); } }
private IEnumDebugProperty MakeEnumDebugProperty(IEnumSymbol enumSymbols) { return(new EnumDebugPropertySymbols(enumSymbols, null, null, this.evaluator)); }
public DebugFieldNode(DebugEnvironment envr, IDebugSymbol symbol, Identifier name, IDebugValue container, TypeNode declaringType, int id) { this.debugEnv = envr; this.Symbol = symbol; this.Container = container; this.Name = name; this.index = id; this.DeclaringType = declaringType; switch (symbol.Type.Kind) { case TypeKind.Class: this.Type = new DebugClassNode(this.debugEnv, this.Symbol.Type, ((IDebugFieldSymbol )symbol).GetValue(Container)); break; case TypeKind.Stream: this.Type = symbol.Type.CompilerType; break; case TypeKind.Tuple: StructTypes sType = ((IDebugStructuralType)this.Symbol.Type).StructuralType; switch (sType) { case StructTypes.Tuple: FieldList list = new FieldList(); IEnumSymbol symbols = ((IDebugStructuralType)this.Symbol.Type).GetMembers(null, true, SymbolKind.Field, SymbolModifiers.All); if (symbols != null) { while (symbols.Current != null) { Field fieldMember = new DebugFieldNode(this.debugEnv, symbols.Current, new Identifier(symbols.Current.Name), ((IDebugFieldSymbol )symbol).GetValue(Container), null, 0); SymbolModifiers modifier = symbols.Current.Modifiers; if ((modifier & SymbolModifiers.Abstract) != 0) { fieldMember.Flags |= FieldFlags.None; } if ((modifier & SymbolModifiers.Final) != 0) { fieldMember.Flags |= FieldFlags.None; } if ((modifier & SymbolModifiers.Private) != 0) { fieldMember.Flags |= FieldFlags.Private; } if ((modifier & SymbolModifiers.Public) != 0) { fieldMember.Flags |= FieldFlags.Public; } if ((modifier & SymbolModifiers.Static) != 0) { fieldMember.Flags |= FieldFlags.Static; } list.Add(fieldMember); symbols.MoveNext(); } } Class dummy = new Class(); dummy.DeclaringModule = new Module(); this.Type = TupleType.For(list, dummy); break; case StructTypes.Union: // HACK: Need a better way for identifying return types this.Type = TypeUnion.For(SymbolHelper.GetTypeList(this.Symbol.Type.FullName, this.debugEnv.context), new Module()); break; case StructTypes.Intersection: // TODO: Need to figure out Intersection Types, I think depends on figuring out return Type //this.Type = TypeIntersection.For(typeList, new Module()); this.Type = new Class(); break; } /*FieldList list = new FieldList(); * IEnumSymbol symbols = ((IDebugStructuralType) this.Symbol.Type).GetMembers(null, true, SymbolKind.Field, SymbolModifiers.All); * if (symbols != null){ * while(symbols.Current != null){ * list.Add(new DebugFieldNode(this.debugEnv, symbols.Current, new Identifier(symbols.Current.Name), null, null, 0)); * symbols.MoveNext(); * } * } * Class dummy = new Class(); * dummy.DeclaringModule = new Module(); * this.Type = TupleType.For(list, dummy);*/ break; case TypeKind.Primitive: switch (this.Symbol.Type.TypeCode) { case TypeCode.Boolean: this.Type = SystemTypes.Boolean; break; case TypeCode.Char: this.Type = SystemTypes.Char; break; case TypeCode.Int16: this.Type = SystemTypes.Int16; break; case TypeCode.UInt16: this.Type = SystemTypes.UInt32; break; case TypeCode.Int32: this.Type = SystemTypes.Int32; break; case TypeCode.UInt32: this.Type = SystemTypes.UInt32; break; case TypeCode.Int64: this.Type = SystemTypes.Int64; break; case TypeCode.UInt64: this.Type = SystemTypes.UInt64; break; case TypeCode.Double: this.Type = SystemTypes.Double; break; case TypeCode.Single: this.Type = SystemTypes.Single; break; case TypeCode.SByte: this.Type = SystemTypes.Int8; break; case TypeCode.Byte: this.Type = SystemTypes.UInt8; break; case TypeCode.String: this.Type = SystemTypes.String; break; } break; case TypeKind.Enum: this.Type = new DebugEnumNode(this.debugEnv, this.Symbol.Type); break; } }