Example #1
0
        /// <summary> Perform the tasks need for when an isolate is created
        /// </summary>
        internal virtual void dumpIsolateCreateEvent(IsolateCreateEvent e)
        {
            IsolateSession i_Session = m_Session.getWorkerSession(e.isolate.getId());

            i_Session.breakOnCaughtExceptions(true);

            IsolateInfo ii = addRunningIsolate(e.isolate.getId());

            ii.i_Session = i_Session;

            UpdateIsolateBreakpoints(m_BreakPointManager.BreakPoints, ii);

            i_Session.resume();

            if (ThreadsEvent != null)
            {
                ThreadsEvent(this);
            }
        }
Example #2
0
        private void commonUpdateBreakpoints(List <BreakPointInfo> breakpoints, Dictionary <BreakPointInfo, Location> breakpointLocations, IsolateSession i_Session)
        {
            Dictionary <string, int> files = new Dictionary <string, int>();

            foreach (BreakPointInfo bp in breakpoints)
            {
                if (!breakpointLocations.ContainsKey(bp))
                {
                    if (!bp.IsDeleted && bp.IsEnabled)
                    {
                        if (!files.ContainsKey(bp.FileFullPath))
                        {
                            files.Add(bp.FileFullPath, 0);
                        }
                    }
                }
            }
            int nFiles = files.Count;

            if (nFiles > 0)
            {
                // reverse loop to take latest loded swf first, and ignore old swf.
                SwfInfo[] swfInfo = (i_Session != null) ? i_Session.getSwfs() : m_Session.getSwfs();
                for (int swfC = swfInfo.Length - 1; swfC >= 0; swfC--)
                {
                    SwfInfo swf = swfInfo[swfC];
                    if (swf == null)
                    {
                        continue;
                    }
                    try
                    {
                        foreach (SourceFile src in swf.getSourceList(m_Session))
                        {
                            String localPath = PluginMain.debugManager.GetLocalPath(src);
                            if (localPath != null && files.ContainsKey(localPath) && files[localPath] == 0)
                            {
                                files[localPath] = src.getId();
                                nFiles--;
                                if (nFiles == 0)
                                {
                                    break;
                                }
                            }
                        }
                    }
                    catch (InProgressException) { }
                    if (nFiles == 0)
                    {
                        break;
                    }
                }
            }

            foreach (BreakPointInfo bp in breakpoints)
            {
                if (!breakpointLocations.ContainsKey(bp))
                {
                    if (bp.IsEnabled && !bp.IsDeleted)
                    {
                        if (files.ContainsKey(bp.FileFullPath) && files[bp.FileFullPath] != 0)
                        {
                            Location l = (i_Session != null) ? i_Session.setBreakpoint(files[bp.FileFullPath], bp.Line + 1) : m_Session.setBreakpoint(files[bp.FileFullPath], bp.Line + 1);
                            if (l != null)
                            {
                                breakpointLocations.Add(bp, l);
                            }
                        }
                    }
                }
                else
                {
                    if (bp.IsDeleted || !bp.IsEnabled)
                    {
                        // todo, i_Session does not have a clearBreakpoint method, m_Session clears them all. optimize out extra loops
                        m_Session.clearBreakpoint(breakpointLocations[bp]);
                        breakpointLocations.Remove(bp);
                    }
                }
            }
        }
        private void commonUpdateBreakpoints(List<BreakPointInfo> breakpoints, Dictionary<BreakPointInfo, Location> breakpointLocations, IsolateSession i_Session)
        {
            Dictionary<string, int> files = new Dictionary<string, int>();
            foreach (BreakPointInfo bp in breakpoints)
            {
                if (!breakpointLocations.ContainsKey(bp))
                {
                    if (!bp.IsDeleted && bp.IsEnabled)
                    {
                        if (!files.ContainsKey(bp.FileFullPath))
                        {
                            files.Add(bp.FileFullPath, int.MaxValue);
                        }
                    }
                }
            }
            int nFiles = files.Count;
            if (nFiles > 0)
            {
                // reverse loop to take latest loded swf first, and ignore old swf.
                SwfInfo[] swfInfo = (i_Session != null) ? i_Session.getSwfs() : m_Session.getSwfs();
                for (int swfC = swfInfo.Length - 1; swfC >= 0; swfC--) 
                {
                    SwfInfo swf = swfInfo[swfC];
                    if (swf == null) continue;
                    try
                    {
                        foreach (SourceFile src in swf.getSourceList(m_Session))
                        {
                            String localPath = PluginMain.debugManager.GetLocalPath(src);
                            if (localPath != null && files.ContainsKey(localPath) && files[localPath] > src.getId())
                            {
                                files[localPath] = src.getId();
                            }
                        }
                    }
                    catch (InProgressException) { }
                }
            }

            foreach (BreakPointInfo bp in breakpoints)
            {
                if (!breakpointLocations.ContainsKey(bp))
                {
                    if (bp.IsEnabled && !bp.IsDeleted)
                    {
                        if (files.ContainsKey(bp.FileFullPath) && files[bp.FileFullPath] != int.MaxValue)
                        {
                            Location l = (i_Session != null) ? i_Session.setBreakpoint(files[bp.FileFullPath], bp.Line + 1) : m_Session.setBreakpoint(files[bp.FileFullPath], bp.Line + 1);
                            if (l != null)
                            {
                                breakpointLocations.Add(bp, l);
                            }
                        }
                    }
                }
                else
                {
                    if (bp.IsDeleted || !bp.IsEnabled)
                    {
                        // todo, i_Session does not have a clearBreakpoint method, m_Session clears them all. optimize out extra loops
                        m_Session.clearBreakpoint(breakpointLocations[bp]);
                        breakpointLocations.Remove(bp);
                    }
                }
            }
        }