/// <summary> Implement Comparable interface for sorting DebugBreakpoints.</summary>
            public virtual int CompareTo(System.Object o)
            {
                DebugBreakpoint other = (DebugBreakpoint)o;

                //UPGRADE_NOTE: Exceptions thrown by the equivalent in .NET of method 'java.lang.Integer.compareTo' may be different. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1099'"
                return(((System.Int32)offset).CompareTo((System.Int32)other.offset));
            }
Esempio n. 2
0
        private int SetState(enum_BP_STATE state)
        {
            if (_state == enum_BP_STATE.BPS_ENABLED)
            {
                if (state == enum_BP_STATE.BPS_DISABLED || state == enum_BP_STATE.BPS_DELETED)
                {
                    if (DebugBreakpoint != null)
                    {
                        DebugBreakpoint.BreakpointHit -= DebugBreakpoint_BreakpointHit;
                        if (Engine.IsConnected)
                        {
                            if (Engine.IsProgramDestroyed)
                            {
                                // If engine is shutting down, do not wait for the delete eval to complete, to avoid
                                // blocking debugger detach if a long-running operation is in progress. This way the
                                // engine can just report successful detach right away, and breakpoints are deleted
                                // later, but as soon as it's actually possible.
                                DebugBreakpoint.DeleteAsync()
                                .SilenceException <MessageTransportException>()
                                .SilenceException <RException>()
                                .DoNotWait();
                            }
                            else
                            {
                                TaskExtensions.RunSynchronouslyOnUIThread(ct => DebugBreakpoint.DeleteAsync(ct));
                            }
                        }
                    }
                }
            }
            else
            {
                if (state == enum_BP_STATE.BPS_ENABLED)
                {
                    if (Engine.IsProgramDestroyed)
                    {
                        // Do not allow enabling breakpoints when engine is shutting down.
                        return(VSConstants.E_ABORT);
                    }

                    DebugBreakpoint = TaskExtensions.RunSynchronouslyOnUIThread(ct => Engine.DebugSession.CreateBreakpointAsync(Location, ct));
                    DebugBreakpoint.BreakpointHit += DebugBreakpoint_BreakpointHit;
                }
            }

            _state = state;
            return(VSConstants.S_OK);
        }
Esempio n. 3
0
 public BreakpointHitDetector(DebugBreakpoint bp)
 {
     Breakpoint = bp;
     Breakpoint.BreakpointHit += Breakpoint_BreakpointHit;
 }
        private int SetState(enum_BP_STATE state) {
            if (_state == enum_BP_STATE.BPS_ENABLED) {
                if (state == enum_BP_STATE.BPS_DISABLED || state == enum_BP_STATE.BPS_DELETED) {
                    if (DebugBreakpoint != null) {
                        DebugBreakpoint.BreakpointHit -= DebugBreakpoint_BreakpointHit;
                        if (Engine.IsConnected) {
                            if (Engine.IsProgramDestroyed) {
                                // If engine is shutting down, do not wait for the delete eval to complete, to avoid
                                // blocking debugger detach if a long-running operation is in progress. This way the
                                // engine can just report successful detach right away, and breakpoints are deleted
                                // later, but as soon as it's actually possible.
                                DebugBreakpoint.DeleteAsync()
                                    .SilenceException<MessageTransportException>()
                                    .SilenceException<RException>()
                                    .DoNotWait();
                            } else {
                                TaskExtensions.RunSynchronouslyOnUIThread(ct => DebugBreakpoint.DeleteAsync(ct));
                            }
                        }
                    }
                }
            } else {
                if (state == enum_BP_STATE.BPS_ENABLED) {
                    if (Engine.IsProgramDestroyed) {
                        // Do not allow enabling breakpoints when engine is shutting down.
                        return VSConstants.E_ABORT;
                    }

                    DebugBreakpoint = TaskExtensions.RunSynchronouslyOnUIThread(ct => Engine.DebugSession.CreateBreakpointAsync(Location, ct));
                    DebugBreakpoint.BreakpointHit += DebugBreakpoint_BreakpointHit;
                }
            }

            _state = state;
            return VSConstants.S_OK;
        }
 public BreakpointHitDetector(DebugBreakpoint bp) {
     Breakpoint = bp;
     Breakpoint.BreakpointHit += Breakpoint_BreakpointHit;
 }
        private void  encodeSwdData(SwfEncoder buffer)
        {
            // Encode the header.
            buffer.write32(('F') | ('W' << 8) | ('D' << 16) | (version << 24));

            // Encode one kDebugID tag.
            buffer.write32(flash.swf.DebugTags_Fields.kDebugID);
            buffer.write(debugID);

            // Encode the kDebugScript and kDebugOffset tags.
            // The kDebugScript tags are in module number order (1,2,3,...).
            // After each one of these are the associated kDebugOffset tags
            // for that module number, in ascending order
            // by line number and byte offset.

            SupportClass.CollectionsSupport.Sort(debugScripts, null);
            int id = 0;

            System.Collections.IEnumerator debugScriptIter = debugScripts.GetEnumerator();
            //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
            while (debugScriptIter.MoveNext())
            {
                //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
                DebugScript debugScript = (DebugScript)debugScriptIter.Current;
                id++;

                buffer.write32(flash.swf.DebugTags_Fields.kDebugScript);
                buffer.write32(id);
                buffer.write32(debugScript.bitmap);
                buffer.writeString(debugScript.name);
                buffer.writeString(debugScript.text);

                SupportClass.CollectionsSupport.Sort(debugScript.debugOffsets, null);
                System.Collections.IEnumerator debugOffsetIter = debugScript.debugOffsets.GetEnumerator();
                //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
                while (debugOffsetIter.MoveNext())
                {
                    //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
                    DebugOffset debugOffset = (DebugOffset)debugOffsetIter.Current;

                    buffer.write32(flash.swf.DebugTags_Fields.kDebugOffset);
                    buffer.write32(id);
                    buffer.write32(debugOffset.lineNumber);
                    buffer.write32(debugOffset.byteOffset);
                }
            }

            // Encode the kDebugRegister tags
            SupportClass.CollectionsSupport.Sort(debugRegisters, null);
            System.Collections.IEnumerator itr = debugRegisters.GetEnumerator();
            //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
            while (itr.MoveNext())
            {
                //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
                DebugRegisters debug = (DebugRegisters)itr.Current;
                int            size  = debug.registerNumbers.Length;

                buffer.write32(flash.swf.DebugTags_Fields.kDebugRegisters);
                buffer.write32(debug.offset);
                buffer.writeUI8(size);
                for (int i = 0; i < debug.registerNumbers.Length; i++)
                {
                    buffer.writeUI8(debug.registerNumbers[i]);
                    buffer.writeString(debug.variableNames[i]);
                }
            }

            // Encode the kDebugBreakpoint tags
            SupportClass.CollectionsSupport.Sort(debugBreakpoints, null);
            System.Collections.IEnumerator debugBreakpointIterator = debugBreakpoints.GetEnumerator();
            //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
            while (debugBreakpointIterator.MoveNext())
            {
                //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
                DebugBreakpoint debugBreakpoint = (DebugBreakpoint)debugBreakpointIterator.Current;

                buffer.write32(flash.swf.DebugTags_Fields.kDebugBreakpoint);
                buffer.write32(debugBreakpoint.offset);
            }
        }