Пример #1
0
        // Sets the next statement to the given stack frame and code context.
        int IDebugThread2.SetNextStatement(IDebugStackFrame2 stackFrame, IDebugCodeContext2 codeContext)
        {
            // CLRDBG TODO: This implementation should be changed to call an MI command
            ulong         addr  = ((AD7MemoryAddress)codeContext).Address;
            AD7StackFrame frame = ((AD7StackFrame)stackFrame);

            if (frame.ThreadContext.Level != 0 || frame.Thread != this || !frame.ThreadContext.pc.HasValue || _engine.DebuggedProcess.MICommandFactory.Mode == MIMode.Clrdbg)
            {
                return(Constants.S_FALSE);
            }
            string toFunc   = EngineUtils.GetAddressDescription(_engine.DebuggedProcess, addr);
            string fromFunc = EngineUtils.GetAddressDescription(_engine.DebuggedProcess, frame.ThreadContext.pc.Value);

            if (toFunc != fromFunc)
            {
                return(Constants.S_FALSE);
            }
            string result = frame.EvaluateExpression("$pc=" + EngineUtils.AsAddr(addr));

            if (result != null)
            {
                _engine.DebuggedProcess.ThreadCache.MarkDirty();
                return(Constants.S_OK);
            }
            return(Constants.S_FALSE);
        }
Пример #2
0
        // Sets the next statement to the given stack frame and code context.
        int IDebugThread2.SetNextStatement(IDebugStackFrame2 stackFrame, IDebugCodeContext2 codeContext)
        {
            ulong         addr  = ((AD7MemoryAddress)codeContext).Address;
            AD7StackFrame frame = ((AD7StackFrame)stackFrame);

            if (frame.ThreadContext.Level != 0 || frame.Thread != this || !frame.ThreadContext.pc.HasValue)
            {
                return(Constants.S_FALSE);
            }
            string toFunc   = EngineUtils.GetAddressDescription(_engine.DebuggedProcess, addr);
            string fromFunc = EngineUtils.GetAddressDescription(_engine.DebuggedProcess, frame.ThreadContext.pc.Value);

            if (toFunc != fromFunc)
            {
                return(Constants.S_FALSE);
            }
            string result = frame.EvaluateExpression("$pc=" + EngineUtils.AsAddr(addr, _engine.DebuggedProcess.Is64BitArch));

            if (result != null)
            {
                _engine.DebuggedProcess.ThreadCache.MarkDirty();
                return(Constants.S_OK);
            }
            return(Constants.S_FALSE);
        }