Example #1
0
        public DebugBlockScope(DebugEnvironment envr)
        {
            this.debugEnv = envr;
            IDebugSymbol container = this.debugEnv.context.GetContainer();

            this.BaseClass = new DebugMethodScope(this.debugEnv, container as CDebugMethodSymbol);
        }
Example #2
0
        public IDebugSymbol GetContainer()
        {
            IDebugContainerField container = null;
            IDebugSymbol         pRetVal   = null;

            if ((HRESULT)HResult.S_OK == this.m_SymbolProvider.GetContainerField(this.m_Address, out container))
            {
                pRetVal = SymbolHelper.SymbolFromDebugField(this, container as IDebugField);
            }

            return(pRetVal);
        }
Example #3
0
        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);
        }
Example #4
0
        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);
        }
Example #5
0
 public EnumSingleSymbol(IDebugSymbol symbol){
   this.symbol = symbol;
   this.atEnd = false;
 }
Example #6
0
 public  void Reset() {
   this.m_Fields.Reset();
   this.m_Current = null;
 }
Example #7
0
    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;
    }
Example #8
0
 public  CEnumLocalSymbols(IEnumDebugFields fields, IDebugContext context) {
   this.m_Fields = fields;
   this.m_Context = context;
   this.m_Current = null;
   this.m_IsEnumeratingClosureClass = false;
   this.m_DisplayRetunLocal = false;
 }
Example #9
0
 public void Reset(){
   if (this.m_FieldEnumerator != null)
     this.m_FieldEnumerator.Reset();
   this.m_Current = null;
 }
Example #10
0
 public bool MoveNext(){
   bool pRetVal = false;
   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_FieldEnumerator != null)
     while (this.m_FieldEnumerator.Current != null){
       this.m_FieldEnumerator.MoveNext();
       if (this.m_FieldEnumerator.Current != null && this.m_FieldEnumerator.Current.Name.IndexOf(": ") < 0){
         CDebugSymbol sym = this.m_FieldEnumerator.Current as CDebugSymbol;
         this.m_Current = new CDebugFieldSymbol(sym.m_Field, this.m_Parent, this.m_Context);
         pRetVal = true;
         break;
       }
     }
   return pRetVal;
 }
Example #11
0
 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);
   }
 }
Example #12
0
    public  bool MoveNext() {

      bool pRetVal = false;

      if (null != this.m_Current) {
        this.m_Current = null;
      } else {
        // Skip the first element
        this.m_Fields.Skip(1);
      }

      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) {
          this.m_Current = symbol;
          pRetVal = true;
        }
      }
      return pRetVal;
    }
Example #13
0
 public  CEnumSymbols(IEnumDebugFields fields, IDebugContext context) {
   this.m_Fields = fields;
   this.m_Context = context;
   this.m_Current = null;
 }
Example #14
0
        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;
            }
        }
Example #15
0
 public EnumSingleSymbol(IDebugSymbol symbol)
 {
     this.symbol = symbol;
     this.atEnd  = false;
 }