ReadAddress() публичный абстрактный Метод

public abstract ReadAddress ( TargetAddress address ) : TargetAddress
address TargetAddress
Результат TargetAddress
Пример #1
0
        internal bool TryUnwind(ThreadServant thread, TargetMemoryAccess memory,
                                Mode mode, TargetAddress until)
        {
            StackFrame new_frame = null;

            try {
                new_frame = last_frame.UnwindStack(memory);
            } catch (TargetException) {
            }

            if (!TryCallback(thread, memory, ref new_frame, true))
            {
                if ((new_frame == null) || !IsFrameOkForMode(new_frame, mode))
                {
                    if (!tried_lmf)
                    {
                        tried_lmf = true;
                        if (thread.LMFAddress.IsNull)
                        {
                            return(false);
                        }
                        lmf_address = memory.ReadAddress(thread.LMFAddress);
                    }

                    if (!lmf_address.IsNull)
                    {
                        new_frame = TryLMF(thread, memory);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }

            if (new_frame == null)
            {
                return(false);
            }

            // Sanity check; don't loop.
            if (new_frame.StackPointer <= last_frame.StackPointer)
            {
                return(false);
            }

            if (!until.IsNull && (new_frame.StackPointer >= until))
            {
                return(false);
            }

            AddFrame(new_frame);
            return(true);
        }
Пример #2
0
        internal bool TryUnwind(ThreadServant thread, TargetMemoryAccess memory,
					 Mode mode, TargetAddress until)
        {
            StackFrame new_frame = null;
            try {
                new_frame = last_frame.UnwindStack (memory);
            } catch (TargetException) {
            }

            if (!TryCallback (thread, memory, ref new_frame, true)) {
                if ((new_frame == null) || !IsFrameOkForMode (new_frame, mode)) {
                    if (!tried_lmf) {
                        tried_lmf = true;
                        if (thread.LMFAddress.IsNull)
                            return false;
                        lmf_address = memory.ReadAddress (thread.LMFAddress);
                    }

                    if (!lmf_address.IsNull)
                        new_frame = TryLMF (thread, memory);
                    else
                        return false;
                }
            }

            if (new_frame == null)
                return false;

            // Sanity check; don't loop.
            if (new_frame.StackPointer <= last_frame.StackPointer)
                return false;

            if (!until.IsNull && (new_frame.StackPointer >= until))
                return false;

            AddFrame (new_frame);
            return true;
        }
Пример #3
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);
        }
Пример #4
0
            public static MonoTypeTable CreateTypeTable(MonoSymbolFile file,
								     TargetMemoryAccess memory,
								     TargetAddress ptr)
            {
                TargetAddress first_chunk = memory.ReadAddress (ptr + 8);
                return new MonoTypeTable (file, ptr, first_chunk);
            }
Пример #5
0
        internal bool GetTrampoline(TargetMemoryAccess memory, TargetAddress address,
					     out TargetAddress trampoline, out bool is_start)
        {
            if (!has_got || (address < plt_start) || (address > plt_end)) {
                is_start = false;
                trampoline = TargetAddress.Null;
                return false;
            }

            Instruction target_insn = Architecture.ReadInstruction (memory, address);
            if ((target_insn == null) || !target_insn.HasInstructionSize ||
                ((target_insn.InstructionType != Instruction.Type.Jump) &&
                 (target_insn.InstructionType != Instruction.Type.IndirectJump))) {
                is_start = false;
                trampoline = TargetAddress.Null;
                return false;
            }

            TargetAddress call_target = target_insn.GetEffectiveAddress (memory);
            if (call_target.IsNull) {
                is_start = false;
                trampoline = TargetAddress.Null;
                return false;
            }

            if (call_target != address + target_insn.InstructionSize) {
                is_start = false;
                trampoline = call_target;
                return true;
            }

            is_start = true;
            trampoline = memory.ReadAddress (got_start + 3 * info.TargetAddressSize);
            return true;
        }