Exemple #1
0
        public bool CheckBreakPointRequest(Event evt)
        {
            var bpe = evt as BreakpointEvent;

            if (bpe != null)
            {
                BreakPoint bp = null;
                if (rbps.TryGetValue(bpe.Request as BreakpointEventRequest, out bp))
                {
                    CodeRecord rec = bp.Record;
                    lock ( DataStore )
                    {
                        rec.Hit(bp.Location.LineNumber);

                        if (bp.Location.LineNumber == bp.Record.GetFirstLine())
                        {
                            rec.CallCount++;
                        }

                        if (!HitCount)
                        {
                            bpe.Request.Disable();
                        }
                    }
                }
            }
            return(bpe != null);
        }
Exemple #2
0
        public bool CheckBreakPointRequest(Event evt, out bool terminate)
        {
            var bpe = evt as BreakpointEvent;

            if (bpe == null)
            {
                terminate = false;
            }
            else
            {
                terminate = $"{bpe.Method.DeclaringType.FullName}.{bpe.Method.Name}" == TerminatorMethod;
                BreakPoint bp = null;
                if (rbps.TryGetValue(bpe.Request as BreakpointEventRequest, out bp))
                {
                    CodeRecord rec = bp.Record;
                    lock ( DataStore )
                    {
                        rec.Hit(bp.Location.LineNumber);

                        if (bp.Location.LineNumber == bp.Record.GetFirstLine())
                        {
                            rec.CallCount++;
                        }

                        if (!HitCount)
                        {
                            bpe.Request.Disable();
                        }
                    }
                }
            }
            return(bpe != null);
        }
Exemple #3
0
        void MarkType(TypeMirror t)
        {
            MarkAssembly(t.Assembly);

            if (loadedTypes.Contains(t.FullName))
            {
                return;
            }

            Log("adding matched type {0}", t.FullName);

            loadedTypes.Add(t.FullName);

            var meths = t.GetMethods();

            // make a record for all methods defined by this type
            foreach (var m in meths)
            {
                CodeRecord rec;
                if (!records.TryGetValue(m.FullName, out rec))
                {
                    Log("adding matched method {0}", m.FullName);
                    rec = new CodeRecord()
                    {
                        ClassName      = m.DeclaringType.CSharpName,
                        Assembly       = m.DeclaringType.Assembly.GetName().FullName,
                        Name           = m.Name,
                        FullMethodName = m.FullName,
                        SourceFile     = m.SourceFile,
                    };
                    rec.AddLines(m.LineNumbers.ToArray());

                    if (!bps.ContainsKey(m.FullName))
                    {
                        bps [m.FullName] = new List <BreakPoint> ();
                        // add a break on each line
                        Log("adding {0} breakpoints", m.Locations.Count);
                        foreach (var l in m.Locations)
                        {
                            var bp = VirtualMachine.CreateBreakpointRequest(l);
                            var b  = new BreakPoint()
                            {
                                Location = l, Record = rec, Request = bp
                            };
                            bps [m.FullName].Add(b);
                            rbps [bp]  = b;
                            bp.Enabled = true;
                        }
                    }

                    records.Add(m.FullName, rec);
                    DataStore.RegisterMethod(rec);
                }
            }
        }
Exemple #4
0
        void MarkType( TypeMirror t )
        {
            MarkAssembly( t.Assembly );

            if ( loadedTypes.Contains( t.FullName ) ) return;

            Log("adding matched type {0}",t.FullName);

            loadedTypes.Add( t.FullName );

            var meths = t.GetMethods ();
            // make a record for all methods defined by this type
            foreach (var m in meths) {
                CodeRecord rec;
                if (!records.TryGetValue (m.FullName, out rec)) {
                    Log("adding matched method {0}",m.FullName);
                    rec = new CodeRecord () { 
                        ClassName = m.DeclaringType.CSharpName,
                        Assembly = m.DeclaringType.Assembly.GetName().FullName,
                        Name = m.Name,
                        FullMethodName = m.FullName,
                        SourceFile = m.SourceFile,
                    };
                    rec.AddLines( m.LineNumbers.ToArray() );
                    
                    if (!bps.ContainsKey (m.FullName)) {
                        bps [m.FullName] = new List<BreakPoint> ();
                        // add a break on each line
                        Log("adding {0} breakpoints", m.Locations.Count);
                        foreach (var l in m.Locations) {
                            var bp = VirtualMachine.CreateBreakpointRequest (l);
                            var b = new BreakPoint () { Location = l, Record = rec, Request = bp };
                            bps [m.FullName].Add (b);
                            rbps [bp] = b;
                            bp.Enabled = true;
                        }
                    }
                    
                    records.Add (m.FullName, rec);
                    DataStore.RegisterMethod (rec);
                } 
            }



        }