Example #1
0
        internal bool InitializeAfterAttach(Inferior inferior)
        {
            initialize_notifications(inferior);

            inferior.WriteAddress(debugger_info.ThreadVTablePtr,
                                  debugger_info.ThreadVTable);
            inferior.WriteAddress(debugger_info.EventHandlerPtr,
                                  debugger_info.EventHandler);
            inferior.WriteInteger(debugger_info.UsingMonoDebugger, 1);

            csharp_language = inferior.Process.CreateMonoLanguage(debugger_info);
            csharp_language.InitializeAttach(inferior);

            return(true);
        }
Example #2
0
        internal bool InitializeAfterAttach(Inferior inferior)
        {
            initialize_notifications (inferior);

            inferior.WriteAddress (debugger_info.ThreadVTablePtr,
                           debugger_info.ThreadVTable);
            inferior.WriteAddress (debugger_info.EventHandlerPtr,
                           debugger_info.EventHandler);
            inferior.WriteInteger (debugger_info.UsingMonoDebugger, 1);

            csharp_language = inferior.Process.CreateMonoLanguage (debugger_info);
            csharp_language.InitializeAttach (inferior);

            return true;
        }
Example #3
0
 internal void Detach(Inferior inferior)
 {
     inferior.WriteAddress (debugger_info.ThreadVTablePtr, TargetAddress.Null);
     inferior.WriteAddress (debugger_info.EventHandler, TargetAddress.Null);
     inferior.WriteInteger (debugger_info.UsingMonoDebugger, 0);
 }
Example #4
0
        public override bool InterpretInstruction(Inferior inferior)
        {
            switch (InstructionType)
            {
            case Type.IndirectJump:
            case Type.Jump: {
                TargetAddress target = GetEffectiveAddress(inferior);
                Registers     regs   = inferior.GetRegisters();
                regs [(int)X86_Register.RIP].SetValue(target);
                inferior.SetRegisters(regs);
                return(true);
            }

            case Type.IndirectCall:
            case Type.Call: {
                TargetAddress target = GetEffectiveAddress(inferior);
                Registers     regs   = inferior.GetRegisters();

                TargetAddress rip = new TargetAddress(
                    inferior.AddressDomain, regs [(int)X86_Register.RIP].Value);
                TargetAddress rsp = new TargetAddress(
                    inferior.AddressDomain, regs [(int)X86_Register.RSP].Value);

                inferior.WriteAddress(rsp - 8, rip + InstructionSize);

                regs [(int)X86_Register.RSP].SetValue(rsp - 8);
                regs [(int)X86_Register.RIP].SetValue(target);
                inferior.SetRegisters(regs);
                return(true);
            }

            case Type.Ret: {
                Registers regs = inferior.GetRegisters();

                TargetAddress rsp = new TargetAddress(
                    inferior.AddressDomain, regs [(int)X86_Register.RSP].Value);

                TargetAddress rip = inferior.ReadAddress(rsp);
                rsp += 8 + Displacement;

                regs [(int)X86_Register.RSP].SetValue(rsp);
                regs [(int)X86_Register.RIP].SetValue(rip);
                inferior.SetRegisters(regs);
                return(true);
            }

            case Type.Interpretable: {
                Registers regs = inferior.GetRegisters();

                TargetAddress rsp = new TargetAddress(
                    inferior.AddressDomain, regs [(int)X86_Register.RSP].Value);
                TargetAddress rbp = new TargetAddress(
                    inferior.AddressDomain, regs [(int)X86_Register.RBP].Value);
                TargetAddress rip = new TargetAddress(
                    inferior.AddressDomain, regs [(int)X86_Register.RIP].Value);

                if (Code [0] == 0x55)                 /* push %rbp */
                {
                    inferior.WriteAddress(rsp - 8, rbp);
                    regs [(int)X86_Register.RSP].SetValue(rsp - 8);
                    regs [(int)X86_Register.RIP].SetValue(rip + 1);
                    inferior.SetRegisters(regs);
                    return(true);
                }

                return(false);
            }

            default:
                return(false);
            }
        }
Example #5
0
 internal void Detach(Inferior inferior)
 {
     inferior.WriteAddress(debugger_info.ThreadVTablePtr, TargetAddress.Null);
     inferior.WriteAddress(debugger_info.EventHandler, TargetAddress.Null);
     inferior.WriteInteger(debugger_info.UsingMonoDebugger, 0);
 }