Esempio n. 1
0
		void ConvertScope (PdbScope scope)
		{
			ConvertSlots (scope.slots);

			foreach (var s in scope.scopes)
				ConvertScope (s);
		}
Esempio n. 2
0
        void ReadLocals(PdbScope scope, MethodSymbols symbols)
        {
            if (scope == null)
                return;

            foreach (var slot in scope.slots) {
                int index = (int) slot.slot;
                if (index < 0 || index >= symbols.Variables.Count)
                    continue;

                var variable = symbols.Variables [index];
                variable.Name = slot.name;
            }

            ReadLocals (scope.scopes, symbols);
        }
Esempio n. 3
0
 void ReadLocals(PdbScope [] scopes, MethodSymbols symbols)
 {
     foreach (var scope in scopes)
         ReadLocals (scope, symbols);
 }
Esempio n. 4
0
		internal Scope(PdbScope scope) : this()
		{
			this.Offset = (int) scope.offset;
			this.Length = (int) scope.length;
			this.ReadScope(scope.slots, scope.constants, scope.scopes);
		}
Esempio n. 5
0
 void ConvertSlots(PdbScope scope, IEnumerable<PdbSlot> slots)
 {
     int scope_idx = mdb.OpenScope ((int)scope.address);
     foreach (var slot in slots) {
         mdb.DefineLocalVariable ((int) slot.slot, slot.name);
         mdb.DefineScopeVariable (scope_idx, (int)slot.slot);
     }
     mdb.CloseScope ((int)(scope.address + scope.length));
 }
Esempio n. 6
0
        static Collection<ScopeDebugInformation> ReadScopeAndLocals(PdbScope [] scopes, MethodDebugInformation info)
        {
            var symbols = new Collection<ScopeDebugInformation> (scopes.Length);

            foreach (PdbScope scope in scopes)
                if (scope != null)
                    symbols.Add (ReadScopeAndLocals (scope, info));

            return symbols;
        }
 /*?*/
 private PdbSlot GetSlotFor(PdbScope[] pdbScopes, uint index)
 {
     PdbSlot/*?*/ result = null;
       foreach (PdbScope scope in pdbScopes) {
     foreach (PdbSlot slot in scope.slots) {
       if ((slot.flags & 1) != 0) continue;
       if (slot.slot == index) return slot;
     }
     result = this.GetSlotFor(scope.scopes, index);
     if (result != null) return result;
       }
       return result;
 }
 private void FillInScopesAndSubScopes(IMethodBody methodBody, PdbScope[] pdbScopes, List<ILocalScope> scopes)
 {
     foreach (PdbScope scope in pdbScopes) {
     scopes.Add(new PdbLocalScope(methodBody, scope));
     this.FillInScopesAndSubScopes(methodBody, scope.scopes, scopes);
       }
 }
Esempio n. 9
0
		public static void ReadScope(this IScope self, PdbSlot[] slots, PdbConstant[] constants, PdbScope[] scopes)
		{
			self.ReadVariables(slots);
			self.ReadConstants(constants);
			self.ReadScopes(scopes);
		}
Esempio n. 10
0
        internal PdbFunction(/*string module, */ ManProcSym proc, BitAccess bits)
        {
            this.token = proc.token;
            //this.module = module;
            //this.name = proc.name;
            //this.flags = proc.flags;
            this.segment = proc.seg;
            this.address = proc.off;
            this.length  = proc.len;

            if (proc.seg != 1)
            {
                throw new PdbDebugException("Segment is {0}, not 1.", proc.seg);
            }
            if (proc.parent != 0 || proc.next != 0)
            {
                throw new PdbDebugException("Warning parent={0}, next={1}",
                                            proc.parent, proc.next);
            }
            //if (proc.dbgStart != 0 || proc.dbgEnd != 0) {
            //  throw new PdbDebugException("Warning DBG start={0}, end={1}",
            //                              proc.dbgStart, proc.dbgEnd);
            //}

            int constantCount;
            int scopeCount;
            int slotCount;
            int usedNamespacesCount;

            CountScopesAndSlots(bits, proc.end, out constantCount, out scopeCount, out slotCount, out usedNamespacesCount);
            int scope    = constantCount > 0 || slotCount > 0 || usedNamespacesCount > 0 ? 1 : 0;
            int slot     = 0;
            int constant = 0;
            int usedNs   = 0;

            scopes         = new PdbScope[scopeCount + scope];
            slots          = new PdbSlot[slotCount];
            constants      = new PdbConstant[constantCount];
            usedNamespaces = new string[usedNamespacesCount];

            if (scope > 0)
            {
                scopes[0] = new PdbScope(this.address, proc.len, slots, constants, usedNamespaces);
            }

            while (bits.Position < proc.end)
            {
                ushort siz;
                ushort rec;

                bits.ReadUInt16(out siz);
                int star = bits.Position;
                int stop = bits.Position + siz;
                bits.Position = star;
                bits.ReadUInt16(out rec);

                switch ((SYM)rec)
                {
                case SYM.S_OEM: {    // 0x0404
                    OemSymbol oem;

                    bits.ReadGuid(out oem.idOem);
                    bits.ReadUInt32(out oem.typind);
                    // internal byte[]   rgl;        // user data, force 4-byte alignment

                    if (oem.idOem == msilMetaData)
                    {
                        string name = bits.ReadString();
                        if (name == "MD2")
                        {
                            ReadMD2CustomMetadata(bits);
                        }
                        else if (name == "asyncMethodInfo")
                        {
                            this.synchronizationInformation = new PdbSynchronizationInformation(bits);
                        }
                        bits.Position = stop;
                        break;
                    }
                    else
                    {
                        throw new PdbDebugException("OEM section: guid={0} ti={1}",
                                                    oem.idOem, oem.typind);
                        // bits.Position = stop;
                    }
                }

                case SYM.S_BLOCK32: {
                    BlockSym32 block = new BlockSym32();

                    bits.ReadUInt32(out block.parent);
                    bits.ReadUInt32(out block.end);
                    bits.ReadUInt32(out block.len);
                    bits.ReadUInt32(out block.off);
                    bits.ReadUInt16(out block.seg);
                    bits.SkipCString(out block.name);
                    bits.Position = stop;

                    scopes[scope++] = new PdbScope(this.address, block, bits, out slotToken);
                    bits.Position   = (int)block.end;
                    break;
                }

                case SYM.S_MANSLOT:
                    slots[slot++] = new PdbSlot(bits);
                    bits.Position = stop;
                    break;

                case SYM.S_MANCONSTANT:
                    constants[constant++] = new PdbConstant(bits);
                    bits.Position         = stop;
                    break;

                case SYM.S_UNAMESPACE:
                    bits.ReadCString(out usedNamespaces[usedNs++]);
                    bits.Position = stop;
                    break;

                case SYM.S_END:
                    bits.Position = stop;
                    break;

                default: {
                    //throw new PdbDebugException("Unknown SYM: {0}", (SYM)rec);
                    bits.Position = stop;
                    break;
                }
                }
            }

            if (bits.Position != proc.end)
            {
                throw new PdbDebugException("Not at S_END");
            }

            ushort esiz;
            ushort erec;

            bits.ReadUInt16(out esiz);
            bits.ReadUInt16(out erec);

            if (erec != (ushort)SYM.S_END)
            {
                throw new PdbDebugException("Missing S_END");
            }
        }
		static void ReadScopeAndLocals (PdbScope [] scopes, Scope parent, MethodBody body, IDictionary instructions)
		{
			foreach (PdbScope scope in scopes)
				ReadScopeAndLocals (scope, parent, body, instructions);
		}
Esempio n. 12
0
        static void ReadScopeAndLocals(PdbScope scope, ScopeSymbol parent, MethodSymbols symbols)
        {
            if (scope == null)
                return;

            ScopeSymbol s = new ScopeSymbol ();
            s.start = (int) scope.offset;
            s.end   = (int)(scope.offset + scope.length);

            if (parent != null)
                parent.Scopes.Add (s);
            else
            if (symbols.scope == null)
                symbols.scope = s;
            else
                throw new InvalidDataException () ;

            foreach (PdbSlot slot in scope.slots) {
                int index = (int) slot.slot;
                if (index < 0 || index >= symbols.Variables.Count)
                    continue;

                VariableDefinition variable = symbols.Variables [index];
                variable.Name = slot.name;

                s.Variables.Add (variable);
            }

            ReadScopeAndLocals (scope.scopes, s, symbols);
        }
Esempio n. 13
0
 static void ReadScopeAndLocals(PdbScope [] scopes, ScopeSymbol parent, MethodSymbols symbols)
 {
     foreach (PdbScope scope in scopes)
         ReadScopeAndLocals (scope, parent, symbols);
 }
Esempio n. 14
0
        static void ReadScopeAndLocals(PdbScope scope, Scope parent, MethodBody body, InstructionMapper mapper)
        {
            if (scope == null)
                return;

            Scope s = new Scope ();
            SetInstructionRange (body, mapper, s, scope.offset, scope.length);

            if (parent != null)
                parent.Scopes.Add (s);
            else
            if (body.Scope == null)
                body.Scope = s;
            else
                throw new InvalidDataException () ;

            foreach (PdbSlot slot in scope.slots) {
                int index = (int) slot.slot;
                if (index < 0 || index >= body.Variables.Count)
                    continue;

                VariableDefinition variable = body.Variables [index];
                variable.Name = slot.name;

                s.Variables.Add (variable);
            }

            ReadScopeAndLocals (scope.scopes, s, body, mapper);
        }
        internal PdbFunction(string module, ManProcSym proc, BitAccess bits)
        {
            this.token     = proc.token;
            this.module    = module;
            this.name      = proc.name;
            this.flags     = proc.flags;
            this.segment   = proc.seg;
            this.address   = proc.off;
            this.length    = proc.len;
            this.slotToken = 0;

            if (proc.seg != 1)
            {
                throw new PdbDebugException("Segment is {0}, not 1.", proc.seg);
            }
            if (proc.parent != 0 || proc.next != 0)
            {
                throw new PdbDebugException("Warning parent={0}, next={1}",
                                            proc.parent, proc.next);
            }
            if (proc.dbgStart != 0 || proc.dbgEnd != 0)
            {
                throw new PdbDebugException("Warning DBG start={0}, end={1}",
                                            proc.dbgStart, proc.dbgEnd);
            }

            int constantCount;
            int scopeCount;
            int slotCount;
            int usedNamespacesCount;

            CountScopesAndSlots(bits, proc.end, out constantCount, out scopeCount, out slotCount, out usedNamespacesCount);
            scopes = new PdbScope[scopeCount];
            int scope = 0;

            while (bits.Position < proc.end)
            {
                ushort siz;
                ushort rec;

                bits.ReadUInt16(out siz);
                int star = bits.Position;
                int stop = bits.Position + siz;
                bits.Position = star;
                bits.ReadUInt16(out rec);

                switch ((SYM)rec)
                {
                case SYM.S_OEM: {    // 0x0404
                    OemSymbol oem;

                    bits.ReadGuid(out oem.idOem);
                    bits.ReadUInt32(out oem.typind);
                    // internal byte[]   rgl;        // user data, force 4-byte alignment

                    if (oem.idOem == msilMetaData)
                    {
                        string name = bits.ReadString();
                        if (name == "MD2")
                        {
                            byte version;
                            bits.ReadUInt8(out version);
                            if (version == 4)
                            {
                                byte count;
                                bits.ReadUInt8(out count);
                                bits.Align(4);
                                while (count-- > 0)
                                {
                                    this.ReadCustomMetadata(bits);
                                }
                            }
                        }
                        bits.Position = stop;
                        break;
                    }
                    else
                    {
                        throw new PdbDebugException("OEM section: guid={0} ti={1}",
                                                    oem.idOem, oem.typind);
                        // bits.Position = stop;
                    }
                }

                case SYM.S_BLOCK32: {
                    BlockSym32 block = new BlockSym32();

                    bits.ReadUInt32(out block.parent);
                    bits.ReadUInt32(out block.end);
                    bits.ReadUInt32(out block.len);
                    bits.ReadUInt32(out this.address);
                    bits.ReadUInt16(out block.seg);
                    bits.SkipCString(out block.name);
                    bits.Position = stop;

                    scopes[scope] = new PdbScope(block, bits, out slotToken);
                    bits.Position = (int)block.end;
                    break;
                }

                case SYM.S_UNAMESPACE:
                    bits.Position = stop;
                    break;

                case SYM.S_END:
                    bits.Position = stop;
                    break;

                default: {
                    //throw new PdbDebugException("Unknown SYM: {0}", (SYM)rec);
                    bits.Position = stop;
                    break;
                }
                }
            }

            if (bits.Position != proc.end)
            {
                throw new PdbDebugException("Not at S_END");
            }

            ushort esiz;
            ushort erec;

            bits.ReadUInt16(out esiz);
            bits.ReadUInt16(out erec);

            if (erec != (ushort)SYM.S_END)
            {
                throw new PdbDebugException("Missing S_END");
            }
        }
Esempio n. 16
0
		public static void ReadScopes(this IScope self, PdbScope[] scopes)
		{
			self.Scopes.AddRange(scopes.Select(s => new Scope(s)));
		}
Esempio n. 17
0
    internal PdbScope(uint funcOffset, BlockSym32 block, BitAccess bits, out uint typind) {
      //this.segment = block.seg;
      this.address = block.off;
      this.offset = block.off - funcOffset;
      this.length = block.len;
      typind = 0;

      int constantCount;
      int scopeCount;
      int slotCount;
      int namespaceCount;
      PdbFunction.CountScopesAndSlots(bits, block.end, out constantCount, out scopeCount, out slotCount, out namespaceCount);
      constants = new PdbConstant[constantCount];
      scopes = new PdbScope[scopeCount];
      slots = new PdbSlot[slotCount];
      usedNamespaces = new string[namespaceCount];
      int constant = 0;
      int scope = 0;
      int slot = 0;
      int usedNs = 0;

      while (bits.Position < block.end) {
        ushort siz;
        ushort rec;

        bits.ReadUInt16(out siz);
        int star = bits.Position;
        int stop = bits.Position + siz;
        bits.Position = star;
        bits.ReadUInt16(out rec);

        switch ((SYM)rec) {
          case SYM.S_BLOCK32: {
              BlockSym32 sub = new BlockSym32();

              bits.ReadUInt32(out sub.parent);
              bits.ReadUInt32(out sub.end);
              bits.ReadUInt32(out sub.len);
              bits.ReadUInt32(out sub.off);
              bits.ReadUInt16(out sub.seg);
              bits.SkipCString(out sub.name);

              bits.Position = stop;
              scopes[scope++] = new PdbScope(funcOffset, sub, bits, out typind);
              break;
            }

          case SYM.S_MANSLOT:
            slots[slot++] = new PdbSlot(bits, out typind);
            bits.Position = stop;
            break;

          case SYM.S_UNAMESPACE:
            bits.ReadCString(out usedNamespaces[usedNs++]);
            bits.Position = stop;
            break;
           
          case SYM.S_END:
            bits.Position = stop;
            break;

          case SYM.S_MANCONSTANT:
            constants[constant++] = new PdbConstant(bits);
            bits.Position = stop;
            break;

          default:
            //throw new PdbException("Unknown SYM in scope {0}", (SYM)rec);
            bits.Position = stop;
            break;
        }
      }

      if (bits.Position != block.end) {
        throw new Exception("Not at S_END");
      }

      ushort esiz;
      ushort erec;
      bits.ReadUInt16(out esiz);
      bits.ReadUInt16(out erec);

      if (erec != (ushort)SYM.S_END) {
        throw new Exception("Missing S_END");
      }
    }
Esempio n. 18
0
        internal PdbScope(uint funcAddress, BlockSym32 block, BitAccess bits, out uint typind)
        {
            this.segment = block.seg;
            this.address = block.off - funcAddress;
            this.length  = block.len;
            typind       = 0;

            int constantCount;
            int scopeCount;
            int slotCount;
            int namespaceCount;

            PdbFunction.CountScopesAndSlots(bits, block.end, out constantCount, out scopeCount, out slotCount, out namespaceCount);
            constants      = new PdbConstant[constantCount];
            scopes         = new PdbScope[scopeCount];
            slots          = new PdbSlot[slotCount];
            usedNamespaces = new string[namespaceCount];
            int constant = 0;
            int scope    = 0;
            int slot     = 0;
            int usedNs   = 0;

            while (bits.Position < block.end)
            {
                ushort siz;
                ushort rec;

                bits.ReadUInt16(out siz);
                int star = bits.Position;
                int stop = bits.Position + siz;
                bits.Position = star;
                bits.ReadUInt16(out rec);

                switch ((SYM)rec)
                {
                case SYM.S_BLOCK32: {
                    BlockSym32 sub = new BlockSym32();

                    bits.ReadUInt32(out sub.parent);
                    bits.ReadUInt32(out sub.end);
                    bits.ReadUInt32(out sub.len);
                    bits.ReadUInt32(out sub.off);
                    bits.ReadUInt16(out sub.seg);
                    bits.SkipCString(out sub.name);

                    bits.Position   = stop;
                    scopes[scope++] = new PdbScope(funcAddress, sub, bits, out typind);
                    break;
                }

                case SYM.S_MANSLOT:
                    slots[slot++] = new PdbSlot(bits, out typind);
                    bits.Position = stop;
                    break;

                case SYM.S_UNAMESPACE:
                    bits.ReadCString(out usedNamespaces[usedNs++]);
                    bits.Position = stop;
                    break;

                case SYM.S_END:
                    bits.Position = stop;
                    break;

                case SYM.S_MANCONSTANT:
                    constants[constant++] = new PdbConstant(bits);
                    bits.Position         = stop;
                    break;

                default:
                    throw new PdbException("Unknown SYM in scope {0}", (SYM)rec);
                    // bits.Position = stop;
                }
            }

            if (bits.Position != block.end)
            {
                throw new Exception("Not at S_END");
            }

            ushort esiz;
            ushort erec;

            bits.ReadUInt16(out esiz);
            bits.ReadUInt16(out erec);

            if (erec != (ushort)SYM.S_END)
            {
                throw new Exception("Missing S_END");
            }
        }
Esempio n. 19
0
 private List<INamespaceScope> GetNamespaceScopes(ushort[] usingCounts, PdbScope pdbScope)
 {
     int usedNamespaceCount = 0;
       int numScopes = usingCounts.Length;
       List<INamespaceScope> result = new List<INamespaceScope>(numScopes);
       for (int i = 0; i < numScopes; i++) {
     int numUsings = usingCounts[i];
     List<IUsedNamespace> usings = new List<IUsedNamespace>(numUsings);
     while (numUsings-- > 0 && usedNamespaceCount < pdbScope.usedNamespaces.Length) {
       usings.Add(this.GetUsedNamespace(pdbScope.usedNamespaces[usedNamespaceCount++]));
     }
     result.Add(new NamespaceScope(usings.AsReadOnly()));
       }
       return result;
 }
 /// <summary>
 /// Allocates a range of CLR IL operations that comprise a lexical scope, specified as an IL offset and a length.
 /// </summary>
 internal PdbLocalScope(IMethodBody methodBody, PdbScope pdbScope)
 {
     this.methodBody = methodBody;
     this.pdbScope   = pdbScope;
 }
Esempio n. 21
0
 /// <summary>
 /// Allocates a range of CLR IL operations that comprise a lexical scope, specified as an IL offset and a length.
 /// </summary>
 internal PdbLocalScope(IMethodBody methodBody, PdbScope pdbScope)
 {
     this.methodBody = methodBody;
       this.pdbScope = pdbScope;
 }
Esempio n. 22
0
        static void ReadScopeAndLocals(PdbScope [] scopes, Scope parent, MethodBody body, InstructionMapper mapper)
        {
            foreach (PdbScope scope in scopes)
                ReadScopeAndLocals (scope, parent, body, mapper);

            CreateRootScope (body);
        }
Esempio n. 23
0
        static ScopeDebugInformation ReadScopeAndLocals(PdbScope scope, MethodDebugInformation info)
        {
            var parent = new ScopeDebugInformation ();
            parent.Start = new InstructionOffset ((int) scope.offset);
            parent.End = new InstructionOffset ((int) (scope.offset + scope.length));

            if (!scope.slots.IsNullOrEmpty()) {
                parent.variables = new Collection<VariableDebugInformation> (scope.slots.Length);

                foreach (PdbSlot slot in scope.slots) {
                    if (slot.flags == 1) // parameter names
                        continue;

                    var index = (int) slot.slot;
                    var variable = new VariableDebugInformation (index, slot.name);
                    if (slot.flags == 4)
                        variable.IsDebuggerHidden = true;
                    parent.variables.Add (variable);
                }
            }

            if (!scope.constants.IsNullOrEmpty ()) {
                parent.constants = new Collection<ConstantDebugInformation> (scope.constants.Length);

                foreach (var constant in scope.constants) {
                    parent.constants.Add (new ConstantDebugInformation (
                        constant.name,
                        (TypeReference) info.method.Module.LookupToken ((int) constant.token),
                        constant.value));
                }
            }

            parent.scopes = ReadScopeAndLocals (scope.scopes, info);

            return parent;
        }
Esempio n. 24
0
        static void ReadScopeAndLocals(PdbScope scope, Scope parent, MethodBody body, InstructionMapper mapper)
        {
            //Scope s = new Scope ();
            //s.Start = GetInstruction (body, instructions, (int) scope.address);
            //s.End = GetInstruction (body, instructions, (int) scope.length - 1);

            //if (parent != null)
            //	parent.Scopes.Add (s);
            //else
            //	body.Scopes.Add (s);

            if (scope == null)
                return;

            foreach (PdbSlot slot in scope.slots) {
                int index = (int) slot.slot;
                if (index < 0 || index >= body.Variables.Count)
                    continue;

                VariableDefinition variable = body.Variables [index];
                variable.Name = slot.name;

                //s.Variables.Add (variable);
            }

            ReadScopeAndLocals (scope.scopes, null /* s */, body, mapper);
        }
Esempio n. 25
0
    internal PdbFunction(/*string module, */ManProcSym proc, BitAccess bits) {
      this.token = proc.token;
      //this.module = module;
      //this.name = proc.name;
      //this.flags = proc.flags;
      this.segment = proc.seg;
      this.address = proc.off;
      //this.length = proc.len;

      if (proc.seg != 1) {
        throw new PdbDebugException("Segment is {0}, not 1.", proc.seg);
      }
      if (proc.parent != 0 || proc.next != 0) {
        throw new PdbDebugException("Warning parent={0}, next={1}",
                                    proc.parent, proc.next);
      }
      //if (proc.dbgStart != 0 || proc.dbgEnd != 0) {
      //  throw new PdbDebugException("Warning DBG start={0}, end={1}",
      //                              proc.dbgStart, proc.dbgEnd);
      //}

      int constantCount;
      int scopeCount;
      int slotCount;
      int usedNamespacesCount;
      CountScopesAndSlots(bits, proc.end, out constantCount, out scopeCount, out slotCount, out usedNamespacesCount);
      int scope = constantCount > 0 || slotCount > 0 || usedNamespacesCount > 0 ? 1 : 0;
      int slot = 0;
      int constant = 0;
      int usedNs = 0;
      scopes = new PdbScope[scopeCount+scope];
      slots = new PdbSlot[slotCount];
      constants = new PdbConstant[constantCount];
      usedNamespaces = new string[usedNamespacesCount];

      if (scope > 0)
        scopes[0] = new PdbScope(this.address, proc.len, slots, constants, usedNamespaces);

      while (bits.Position < proc.end) {
        ushort siz;
        ushort rec;

        bits.ReadUInt16(out siz);
        int star = bits.Position;
        int stop = bits.Position + siz;
        bits.Position = star;
        bits.ReadUInt16(out rec);

        switch ((SYM)rec) {
          case SYM.S_OEM: {          // 0x0404
              OemSymbol oem;

              bits.ReadGuid(out oem.idOem);
              bits.ReadUInt32(out oem.typind);
              // internal byte[]   rgl;        // user data, force 4-byte alignment

              if (oem.idOem == msilMetaData) {
                string name = bits.ReadString();
                if (name == "MD2") {
                  byte version;
                  bits.ReadUInt8(out version);
                  if (version == 4) {
                    byte count;
                    bits.ReadUInt8(out count);
                    bits.Align(4);
                    while (count-- > 0)
                      this.ReadCustomMetadata(bits);
                  }
                } else if (name == "asyncMethodInfo") {
                  this.synchronizationInformation = new PdbSynchronizationInformation(bits);
                }
                bits.Position = stop;
                break;
              } else {
                throw new PdbDebugException("OEM section: guid={0} ti={1}",
                                            oem.idOem, oem.typind);
                // bits.Position = stop;
              }
            }

          case SYM.S_BLOCK32: {
              BlockSym32 block = new BlockSym32();

              bits.ReadUInt32(out block.parent);
              bits.ReadUInt32(out block.end);
              bits.ReadUInt32(out block.len);
              bits.ReadUInt32(out block.off);
              bits.ReadUInt16(out block.seg);
              bits.SkipCString(out block.name);
              bits.Position = stop;

              scopes[scope++] = new PdbScope(this.address, block, bits, out slotToken);
              bits.Position = (int)block.end;
              break;
            }

          case SYM.S_MANSLOT:
            slots[slot++] = new PdbSlot(bits);
            bits.Position = stop;
            break;

          case SYM.S_MANCONSTANT:
            constants[constant++] = new PdbConstant(bits);
            bits.Position = stop;
            break;

          case SYM.S_UNAMESPACE:
            bits.ReadCString(out usedNamespaces[usedNs++]);
            bits.Position = stop;
            break;

          case SYM.S_END:
            bits.Position = stop;
            break;

          default: {
              //throw new PdbDebugException("Unknown SYM: {0}", (SYM)rec);
              bits.Position = stop;
              break;
            }
        }
      }

      if (bits.Position != proc.end) {
        throw new PdbDebugException("Not at S_END");
      }

      ushort esiz;
      ushort erec;
      bits.ReadUInt16(out esiz);
      bits.ReadUInt16(out erec);

      if (erec != (ushort)SYM.S_END) {
        throw new PdbDebugException("Missing S_END");
      }
    }
Esempio n. 26
0
		private static void AssertScopes(PdbScope[] originalScopes, PdbScope[] scopes)
		{
			AssertLists(originalScopes, scopes);

			for (int i = 0; i < originalScopes.Length; i++)
			{
				Assert.AreEqual(originalScopes[i].offset, scopes[i].offset);
				Assert.AreEqual(originalScopes[i].length, scopes[i].length);

				AssertSlots(originalScopes[i].slots, scopes[i].slots);
				AssertConstants(originalScopes[i].constants, scopes[i].constants);

				AssertScopes(originalScopes[i].scopes, scopes[i].scopes);
			}
		}