Example #1
0
        SourcecodeSegment SetIP(bool simulate, string filename, int line, int column)
        {
            process.AssertPaused();

            SourcecodeSegment segment = SourcecodeSegment.Resolve(this.MethodInfo.DebugModule, filename, null, line, column);

            if (segment != null && segment.CorFunction.GetToken() == this.MethodInfo.MetadataToken)
            {
                try {
                    if (simulate)
                    {
                        CorILFrame.CanSetIP((uint)segment.ILStart);
                    }
                    else
                    {
                        // Invalidates all frames and chains for the current thread
                        CorILFrame.SetIP((uint)segment.ILStart);
                        process.NotifyResumed(DebuggeeStateAction.Keep);
                        process.NotifyPaused(PausedReason.SetIP);
                        process.RaisePausedEvents();
                    }
                } catch {
                    return(null);
                }
                return(segment);
            }
            return(null);
        }
        public bool SetIP(string filename, int line, int column, bool dryRun)
        {
            this.Process.AssertPaused();

            foreach (var symbolSource in this.Process.Debugger.SymbolSources)
            {
                foreach (var seq in symbolSource.GetSequencePoints(this.Module, filename, line, column))
                {
                    if (seq.MethodDefToken == this.MethodInfo.GetMetadataToken())
                    {
                        try {
                            if (dryRun)
                            {
                                CorILFrame.CanSetIP((uint)seq.ILOffset);
                            }
                            else
                            {
                                CorILFrame.SetIP((uint)seq.ILOffset);
                                // Invalidates all frames and chains for the current thread
                                this.Process.NotifyResumed(DebuggeeStateAction.Keep);
                                this.Process.NotifyPaused();
                            }
                        } catch {
                            return(false);
                        }
                        return(true);
                    }
                }
            }
            return(false);
        }
Example #3
0
        SourcecodeSegment SetIP(bool simulate, string filename, int line, int column)
        {
            process.AssertPaused();

            SourcecodeSegment suggestion = new SourcecodeSegment(filename, line, column, column);
            ICorDebugFunction corFunction;
            int ilOffset;

            if (!suggestion.GetFunctionAndOffset(this.Module, false, out corFunction, out ilOffset))
            {
                return(null);
            }
            else
            {
                if (corFunction.Token != methodProps.Token)
                {
                    return(null);
                }
                else
                {
                    try {
                        if (simulate)
                        {
                            CorILFrame.CanSetIP((uint)ilOffset);
                        }
                        else
                        {
                            // invalidates all frames and chains for the current thread
                            CorILFrame.SetIP((uint)ilOffset);
                            process.NotifyPaused(new PauseSession(PausedReason.SetIP));
                            process.Pause(false);
                        }
                    } catch {
                        return(null);
                    }
                    return(GetSegmentForOffet((uint)ilOffset));
                }
            }
        }
Example #4
0
        bool SetIP(int ilOffset, bool simulate)
        {
            process.AssertPaused();

            try {
                if (simulate)
                {
                    CorILFrame.CanSetIP((uint)ilOffset);
                }
                else
                {
                    // Invalidates all frames and chains for the current thread
                    CorILFrame.SetIP((uint)ilOffset);
                    process.NotifyResumed(DebuggeeStateAction.Keep);
                    process.NotifyPaused(PausedReason.SetIP);
                    process.RaisePausedEvents();
                }
            } catch {
                return(false);
            }
            return(true);
        }