ReadString() public abstract method

public abstract ReadString ( TargetAddress address ) : string
address TargetAddress
return string
Exemplo n.º 1
0
            public static RangeEntry Create(MonoSymbolFile file, TargetMemoryAccess memory,
							 TargetReader reader, byte[] contents)
            {
                int domain = reader.BinaryReader.ReadInt32 ();
                int index = reader.BinaryReader.ReadInt32 ();

                TargetAddress wrapper_data = reader.ReadAddress ();
                TargetAddress method = reader.ReadAddress ();
                reader.ReadAddress (); /* address_list */
                TargetAddress code_start = reader.ReadAddress ();
                TargetAddress wrapper_addr = reader.ReadAddress ();
                int code_size = reader.BinaryReader.ReadInt32 ();

                WrapperEntry wrapper = null;

                if (!wrapper_data.IsNull) {
                    int wrapper_size = 4 + 3 * memory.TargetMemoryInfo.TargetAddressSize;

                    TargetReader wrapper_reader = new TargetReader (
                        memory.ReadMemory (wrapper_data, wrapper_size));

                    TargetAddress name_address = wrapper_reader.ReadAddress ();
                    TargetAddress cil_address = wrapper_reader.ReadAddress ();
                    int wrapper_type = wrapper_reader.BinaryReader.ReadInt32 ();

                    string name = "<" + memory.ReadString (name_address) + ">";
                    string cil_code = memory.ReadString (cil_address);

                    wrapper = new WrapperEntry (
                        wrapper_addr, (WrapperType) wrapper_type, name, cil_code);
                }

                return new RangeEntry (
                    file, domain, index, wrapper, method,
                    code_start, code_start + code_size, contents);
            }
Exemplo n.º 2
0
        internal MonoSymbolFile(MonoLanguageBackend language, Process process,
					 TargetMemoryAccess memory, TargetAddress address)
        {
            this.MonoLanguage = language;
            this.TargetMemoryInfo = memory.TargetMemoryInfo;
            this.Architecture = process.Architecture;
            this.process = process;

            ThreadManager = process.ThreadManager;

            int address_size = TargetMemoryInfo.TargetAddressSize;
            int int_size = TargetMemoryInfo.TargetIntegerSize;

            ranges = ArrayList.Synchronized (new ArrayList ());
            range_hash = Hashtable.Synchronized (new Hashtable ());
            type_hash = Hashtable.Synchronized (new Hashtable ());
            class_entry_by_token = Hashtable.Synchronized (new Hashtable ());

            Index = memory.ReadInteger (address);
            address += int_size;
            TargetAddress image_file_addr = memory.ReadAddress (address);
            address += address_size;
            ImageFile = memory.ReadString (image_file_addr);
            MonoImage = memory.ReadAddress (address);
            address += address_size;
            TargetAddress type_table_ptr = memory.ReadAddress (address);
            address += address_size;

            TypeTable = MonoTypeTable.CreateTypeTable (this, memory, type_table_ptr);

            string shadow_location = language.GetShadowCopyLocation (ImageFile);
            if (shadow_location != null)
                ImageFile = shadow_location;

            try {
                Assembly = Cecil.AssemblyDefinition.ReadAssembly (ImageFile);
            } catch (Exception ex) {
                throw new SymbolTableException (
                    "Cannot load symbol file `{0}': {1}", ImageFile, ex);
            }

            ModuleDefinition = Assembly.MainModule;

            Report.Debug (DebugFlags.JitSymtab, "SYMBOL TABLE READER: {0}", ImageFile);

            string mdb_file = ImageFile + ".mdb";

            try {
                File = C.MonoSymbolFile.ReadSymbolFile (ModuleDefinition, mdb_file);
                if (File == null)
                    Report.Error ("Cannot load symbol file `{0}'", mdb_file);
                else if (ModuleDefinition.Mvid != File.Guid) {
                    Report.Error ("Symbol file `{0}' does not match assembly `{1}'",
                              mdb_file, ImageFile);
                    File = null;
                }
            } catch (C.MonoSymbolFileException ex) {
                Report.Error (ex.Message);
            } catch (Exception ex) {
                Report.Error ("Cannot load symbol file `{0}': {1}", mdb_file, ex);
            }

            symtab = new MonoSymbolTable (this);

            name = Assembly.Name.FullName;

            module = process.Session.GetModule (name);
            if (module == null) {
                module = process.Session.CreateModule (name, this);
            } else {
                module.LoadModule (this);
            }

            #if FIXME
            if ((File != null) && (File.OffsetTable.IsAspxSource)) {
                Console.WriteLine ("ASPX SOURCE: {0} {1}", this, File);
            }
            #endif

            process.SymbolTableManager.AddSymbolFile (this);
        }