ReadInstruction() private method

private ReadInstruction ( TargetMemoryAccess memory, TargetAddress address ) : Instruction
memory TargetMemoryAccess
address TargetAddress
return Mono.Debugger.Architectures.Instruction
示例#1
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);
        }