InsertExceptionCatchPoint() private method

private InsertExceptionCatchPoint ( Thread target, ThreadGroup group, TargetType exception ) : Event
target Thread
group ThreadGroup
exception Mono.Debugger.Languages.TargetType
return Event
Esempio n. 1
0
        public int InsertBreakEvent(DL.BreakEvent be, bool enable)
        {
            CancelRuntimeInvokes();
            DL.Breakpoint bp = be as DL.Breakpoint;
            MD.Event      ev = null;

            if (bp != null)
            {
                MD.SourceLocation   location = new MD.SourceLocation(bp.FileName, bp.Line);
                MD.SourceBreakpoint sbp      = new MD.SourceBreakpoint(session, ThreadGroup.Global, location);
                mdbAdaptor.InitializeBreakpoint(sbp);
                session.AddEvent(sbp);
                ev = sbp;
            }
            else if (be is Catchpoint)
            {
                lock (pendingCatchpoints) {
                    Catchpoint    cp  = (Catchpoint)be;
                    ML.TargetType exc = null;
                    if (process != null)
                    {
                        foreach (Module mod in process.Modules)
                        {
                            exc = mod.Language.LookupType(cp.ExceptionName);
                            if (exc != null)
                            {
                                break;
                            }
                        }
                    }
                    if (exc != null)
                    {
                        ev = session.InsertExceptionCatchPoint(process.MainThread, ThreadGroup.Global, exc);
                    }
                    else
                    {
                        pendingCatchpoints.Add(cp);
                        return(-1);
                    }
                }
            }

            ev.IsEnabled = enable;

            if (!initializing)
            {
                lock (debugger) {
                    mdbAdaptor.ActivateEvent(ev);
                }
            }

            if (bp != null && !running && !initializing && activeThread.CurrentFrame != null && !string.IsNullOrEmpty(bp.ConditionExpression) && bp.BreakIfConditionChanges)
            {
                // Initial expression evaluation
                MdbEvaluationContext ctx = new MdbEvaluationContext(activeThread, activeThread.CurrentFrame, null, SessionOptions.EvaluationOptions);
                ML.TargetObject      ob  = EvaluateExp(ctx, bp.ConditionExpression);
                if (ob != null)
                {
                    lastConditionValue [ev.Index] = evaluator.TargetObjectToExpression(ctx, ob).Value;
                }
            }

            events [ev.Index] = be;
            return(ev.Index);
        }