Beispiel #1
0
        private static void PrepareContextForSingleStep(DebuggeeThread thread)
        {
            var threadContext = thread.GetThreadContext();

            threadContext.GetRegisterByName("tf").Value = true;
            threadContext.Flush();
        }
Beispiel #2
0
        private void SignalStepOver(DebuggeeThread thread, DebuggerAction nextAction)
        {
            // Stepping over means step one instruction, but skip call instructions.
            // Therefore, if the current instruction is a call, we set a temporary breakpoint
            // to the next instruction and continue execution, otherwise we perform a normal step.

            var threadContext = thread.GetThreadContext();
            var eip           = (uint)threadContext.GetRegisterByName("eip").Value;

            var info = _disassemblers[thread.Process];

            info.Reader.Position = eip;
            var instruction = info.Disassembler.ReadNextInstruction();

            switch (instruction.Mnemonic)
            {
            case X86Mnemonic.Call:
            case X86Mnemonic.Call_Far:
                _stepOverBreakpoint = new Int3Breakpoint(thread.Process, (IntPtr)info.Reader.Position, true);
                _session.SignalDebuggerLoop(nextAction);
                break;

            default:
                SignalStepIn(thread, nextAction);
                break;
            }
        }