Ejemplo n.º 1
0
        void OnBreakpoint(object sender, CorBreakpointEventArgs e)
        {
            lock (debugLock) {
                if (evaluating)
                {
                    e.Continue = true;
                    return;
                }
            }
            OnStopped();
            e.Continue = false;
            // If a breakpoint is hit while stepping, cancel the stepping operation
            if (stepper != null && stepper.IsActive())
            {
                stepper.Deactivate();
            }
            SetActiveThread(e.Thread);
            TargetEventArgs args = new TargetEventArgs(TargetEventType.TargetHitBreakpoint);

            args.Process   = GetProcess(process);
            args.Thread    = GetThread(e.Thread);
            args.Backtrace = new Backtrace(new CorBacktrace(e.Thread, this));
            OnTargetEvent(args);
        }
Ejemplo n.º 2
0
        void OnBreakpoint(object sender, CorBreakpointEventArgs e)
        {
            lock (debugLock) {
                if (evaluating)
                {
                    e.Continue = true;
                    return;
                }
            }

            BreakEventInfo binfo;

            if (breakpoints.TryGetValue(e.Breakpoint, out binfo))
            {
                e.Continue = true;
                Breakpoint bp = (Breakpoint)binfo.BreakEvent;

                if (bp.HitCount > 1)
                {
                    // Just update the count and continue
                    binfo.UpdateHitCount(bp.HitCount - 1);
                    return;
                }

                if (!string.IsNullOrEmpty(bp.ConditionExpression))
                {
                    string res = EvaluateExpression(e.Thread, bp.ConditionExpression);
                    if (bp.BreakIfConditionChanges)
                    {
                        if (res == bp.LastConditionValue)
                        {
                            return;
                        }
                        bp.LastConditionValue = res;
                    }
                    else
                    {
                        if (res != null && res.ToLower() == "false")
                        {
                            return;
                        }
                    }
                }
                switch (bp.HitAction)
                {
                case HitAction.CustomAction:
                    // If custom action returns true, execution must continue
                    if (binfo.RunCustomBreakpointAction(bp.CustomActionId))
                    {
                        return;
                    }
                    break;

                case HitAction.PrintExpression: {
                    string exp = EvaluateTrace(e.Thread, bp.TraceExpression);
                    binfo.UpdateLastTraceValue(exp);
                    return;
                }
                }
            }

            OnStopped();
            e.Continue = false;
            // If a breakpoint is hit while stepping, cancel the stepping operation
            if (stepper != null && stepper.IsActive())
            {
                stepper.Deactivate();
            }
            SetActiveThread(e.Thread);
            TargetEventArgs args = new TargetEventArgs(TargetEventType.TargetHitBreakpoint);

            args.Process   = GetProcess(process);
            args.Thread    = GetThread(e.Thread);
            args.Backtrace = new Backtrace(new CorBacktrace(e.Thread, this));
            OnTargetEvent(args);
        }