public virtual void registers(int offset, RegisterRecord r) { // Create a DebugRegister for the specified registers/byteOffset pair. DebugRegisters debug = new DebugRegisters(this, offset + adjust, r); debugRegisters.Add(debug); }
/// <summary> Implement Comparable interface for sorting DebugRegisters.</summary> public virtual int CompareTo(System.Object o) { DebugRegisters other = (DebugRegisters)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)); }
static int Main(string[] args) { DebugClient cli = null; DebugControl ctrl = null; DebugSymbols sym = null; DebugRegisters reg = null; try { cli = new DebugClient(); ctrl = new DebugControl(cli); sym = new DebugSymbols(cli); reg = new DebugRegisters(cli); ctrl.Execute(OutputControl.ToAllClients, "sxe ibp", ExecuteOptions.Default); cli.CreateProcessAndAttach( "notepad.exe", CreateProcessOptions.DebugOnlyThisProcess, 0, ProcessAttachMode.InvasiveResumeProcess); ctrl.WaitForEvent(); UInt64 currentAddress = reg.InstructionOffset; sym.SymbolOptions |= SymbolOptions.LoadLines; sym.SetSymbolPath("srv*"); // Make sure that symsrv.dll is in the path! sym.Reload(); DebugFormatter formatter = new DebugFormatter(cli); string addrInfo1 = String.Format(formatter, "Current address {0:x} \"{0:y}\"", currentAddress); Console.Out.WriteLine(addrInfo1); string addrInfo2 = String.Format(formatter, "Current address +0n16 is {0:x} \"{0:ys}\"", currentAddress + 16); Console.Out.WriteLine(addrInfo2); Console.Out.WriteLine(String.Format(formatter, "Zero address is {0} \"{0:ys}\"", 0)); cli.DebugOutput += new EventHandler <DebugOutputEventArgs>(HandleOutput); ctrl.Output(OutputModes.Normal, "Debugger output: Current address is {0:x} \"{0:ys}\"", currentAddress); Console.Out.WriteLine("Current address (32-bit formatted) is {0}", DebugFormatter.FormatAddress(currentAddress, AddressFormatOptions.Force32Bit)); Console.Out.WriteLine("Current address (64-bit formatted) is {0}", DebugFormatter.FormatAddress(currentAddress, AddressFormatOptions.Force64Bit)); } catch (Exception e) { Console.Error.WriteLine("Exception thrown: {0}", e); return(1); } finally { if (cli != null) { cli.Dispose(); } if (ctrl != null) { ctrl.Dispose(); } if (sym != null) { sym.Dispose(); } if (reg != null) { reg.Dispose(); } } return(0); }
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); } }