Пример #1
0
 public ReflectionReader(ModuleDefinition module)
 {
     m_module = module;
     m_reader = m_module.ImageReader;
     m_root = m_module.Image.MetadataRoot;
     m_tHeap = m_root.Streams.TablesHeap;
     m_checkDeleted = (m_tHeap.HeapSizes & 0x80) != 0;
     if (m_reader != null)
         m_tableReader = m_reader.MetadataReader.TableReader;
     m_codeReader = new CodeReader (this);
     m_sigReader = new SignatureReader (m_root, this);
     m_isCorlib = module.Assembly.Name.Name == Constants.Corlib;
 }
Пример #2
0
 public SecurityDeclarationReader(MetadataRoot root, ReflectionReader reader)
 {
     sr = new SignatureReader (root, reader);
 }
Пример #3
0
		List<DebugLocalVariableInfo> GetLocalVariablesInScope(ISymUnmanagedScope symScope)
		{
			List<DebugLocalVariableInfo> vars = new List<DebugLocalVariableInfo>();
			foreach (ISymUnmanagedVariable symVar in symScope.GetLocals()) {
				ISymUnmanagedVariable symVarCopy = symVar;
				int start;
				SignatureReader sigReader = new SignatureReader(symVar.GetSignature());
				LocalVarSig.LocalVariable locVarSig = sigReader.ReadLocalVariable(sigReader.Blob, 0, out start);
				DebugType locVarType = DebugType.CreateFromSignature(this.DebugModule, locVarSig.Type, declaringType);
				// Compiler generated?
				// NB: Display class does not have the compiler-generated flag
				if ((symVar.GetAttributes() & 1) == 1 || symVar.GetName().StartsWith("CS$")) {
					// Get display class from local variable
					if (locVarType.IsDisplayClass) {
						AddCapturedLocalVariables(
							vars,
							(int)symScope.GetStartOffset(),
							(int)symScope.GetEndOffset(),
							delegate(StackFrame context) {
								return GetLocalVariableValue(context, symVarCopy);
							},
							locVarType
						);
					}
				} else {
					DebugLocalVariableInfo locVar = new DebugLocalVariableInfo(
						symVar.GetName(),
						(int)symVar.GetAddressField1(),
						// symVar also has Get*Offset methods, but the are not implemented
						(int)symScope.GetStartOffset(),
						(int)symScope.GetEndOffset(),
						locVarType,
						delegate(StackFrame context) {
							return GetLocalVariableValue(context, symVarCopy);
						}
					);
					vars.Add(locVar);
				}
			}
			foreach(ISymUnmanagedScope childScope in symScope.GetChildren()) {
				vars.AddRange(GetLocalVariablesInScope(childScope));
			}
			return vars;
		}