/// <summary> /// 调试信息事件 /// </summary> /// <param name="debugMessage"></param> private static void DebugMessage(String debugMessage) { DebugEventArgs debugEventArgs = new DebugEventArgs(); debugEventArgs.DebugMessage = debugMessage; DebugEvent?.Invoke(null, debugEventArgs); }
public void Parse(BinaryReader r) { DebugEvent parsedChild = null; bool endEvent = false; do { if (parsedChild != null) { AddChildEvent(parsedChild); parsedChild.Parse(r); parsedChild = null; } var command = (Command)r.ReadUInt32(); switch (command) { case Command.kStartStruct: parsedChild = new StructDebugEvent(ReadString(r), ReadString(r)); break; case Command.kFloat: AddChildEvent(new FloatDebugEvent(ReadString(r), r.ReadSingle())); break; case Command.kString: AddChildEvent(new StringDebugEvent(ReadString(r), ReadString(r))); break; case Command.kInt32: AddChildEvent(new Int32DebugEvent(ReadString(r), r.ReadInt32())); break; case Command.kInt64: AddChildEvent(new Int64DebugEvent(ReadString(r), r.ReadInt64())); break; case Command.kUInt32: AddChildEvent(new UInt32DebugEvent(ReadString(r), r.ReadUInt32())); break; case Command.kUInt64: AddChildEvent(new UInt64DebugEvent(ReadString(r), r.ReadUInt64())); break; case Command.kEndStruct: endEvent = true; break; case Command.kEndFunctionCall: var result = ReadString(r); displayName += " = " + result; endEvent = true; break; default: throw new ArgumentOutOfRangeException(); } } while (!endEvent && r.BaseStream.Position != r.BaseStream.Length); }
public void Run() { while (eventQueue.isEmpty == false) { var e = eventQueue.Pop(); if (e.time < this.clock) { throw new Exception("No time travel plz"); } this.clock = e.time; e.Handle(); if (simulationParameters.debugType == DebugType.Always) { DebugEvent.DebugNow(this, false, e); } } // force update awake time foreach (var r in relays) { r.UpdateAwakeTime(); } if (simulationParameters.debugType != DebugType.Never) { debugWriter.Write("`"); debugWriter.Close(); } }
public int GetEventCount(DebugEvent which) { int count; _eventCounts.TryGetValue(which, out count); return(count); }
public void Test() { #if DEVELOPMENT_BUILD DebugEvent.Invoke(); #else ReleaseEvent.Invoke(); #endif }
/// <summary> /// /// </summary> private void OnCreateVM(DebugEvent e) { uint vm = e.GetVm(); vms.Add(vm, vm.ToString("X")); UpdateVirtualMachinesUI(); }
/// <summary> /// /// </summary> private void OnDestroyVM(DebugEvent e) { uint vm = e.GetVm(); vms.Remove(vm); UpdateVirtualMachinesUI(); }
/// <summary> /// /// </summary> private void OnNameVM(DebugEvent e) { uint vm = e.GetVm(); vms[vm] = e.GetMessageStr(); UpdateVirtualMachinesUI(); }
public static void BuildOutput(this DebugEvent debugEvent) { if (OutputActive) { BuildOutput(debugEvent.EventOrderingNumber + "[" + debugEvent.EventTime.ToString(DateTimeFormatString) + "]" + debugEvent.MethodName + ": " + debugEvent.Message); } }
public virtual void AddPendingEvent(DebugEvent e) { DecodaPINVOKE.IEvtHandler_AddPendingEvent(swigCPtr, DebugEvent.getCPtr(e)); if (DecodaPINVOKE.SWIGPendingException.Pending) { throw DecodaPINVOKE.SWIGPendingException.Retrieve(); } }
public PacketEvent(DebugEvent ev, uint f1, uint f2, uint f3, uint dsize, byte[] data) { this.devent = ev; this.field0 = f1; this.field1 = f2; this.field2 = f3; this.dataSize = dsize; this.data = data; }
private static void SetEventProperties(DebugEvent debugEvent, IEventRequest request, SuspendPolicy suspendPolicy, IVirtualMachine virtualMachine, IThreadReference thread, bool manualResume) { Contract.Requires <ArgumentNullException>(debugEvent != null, "debugEvent"); debugEvent.Properties.AddProperty(typeof(IEventRequest), request); debugEvent.Properties.AddProperty(typeof(SuspendPolicy), suspendPolicy); debugEvent.Properties.AddProperty(typeof(IVirtualMachine), virtualMachine); debugEvent.Properties.AddProperty(typeof(IThreadReference), thread); debugEvent.Properties.AddProperty("ManualResume", manualResume); }
// ReSharper restore UnusedMember.Global #endregion #region "Event Handlers" /// <summary> /// Report a debug message /// </summary> /// <param name="message">Debug message</param> protected void OnDebugEvent(string message) { if (DebugEvent == null && WriteToConsoleIfNoListener && !SkipConsoleWriteIfNoDebugListener) { ConsoleMsgUtils.ShowDebugCustom(message, emptyLinesBeforeMessage: EmptyLinesBeforeDebugMessages); } DebugEvent?.Invoke(message); }
/// <summary> /// Prints out a summary of all the events /// </summary> /// <param name="timeSpans">Should timespans between events be printed?</param> /// <param name="printTotal">Should the total time of all events be printed?</param> /// <param name="clearEvents">Should the events be cleared after printing?</param> /// <param name="deactivate">Should DebugTools be deactivated after printing?</param> /// <param name="printLabel">Should the labels for the times be printed?</param> /// <param name="longDurationThreshold">What is the duration for a timespan between two events to be marked as "long".</param> public static void Print(bool timeSpans = true, bool printTotal = true, bool clearEvents = false, bool deactivate = false, bool printLabel = false, int longDurationThreshold = 250) { Active = false; if (OutputActive) { if (Events.Any()) { File.WriteAllText(OutputFile, string.Empty); //clear output file DebugEvent lastDebugEvent = null; foreach (var debugEvent in Events.Where(x => x != null).OrderBy(x => x.EventOrderingNumber)) { if (timeSpans && lastDebugEvent != null) { var totalMillisecondDifference = ((int)((debugEvent.EventTime - lastDebugEvent.EventTime).TotalMilliseconds)); BuildOutput(""); BuildOutput(" " + totalMillisecondDifference.ToString() + (printLabel ? " ms" : "") + (totalMillisecondDifference > longDurationThreshold ? " !---------LONG--------!" : "")); BuildOutput(""); } debugEvent.BuildOutput(); lastDebugEvent = debugEvent; } if (printTotal) { BuildOutput(""); BuildOutput("----------------------------------------------"); BuildOutput(""); BuildOutput("Total Time: " + (Events.Last().EventTime - Events.First().EventTime).TotalMilliseconds + (printLabel ? " ms" : "")); BuildOutput(""); } if (clearEvents) { Events.Clear(); } if (deactivate) { Active = false; return; } PrintOutput(); } } Active = true; }
private static void AssertIsNotSingleStep(DebugEvent evt) { var exception = evt.As <ExceptionDetail>(); if (exception == null) { return; } Assert.NotEqual(ExceptionReason.ExceptionSingleStep, exception.Exception.Reason); }
public void RecordEvent(DebugEvent which, string property = null) { _eventCounts.AddOrUpdate(which, 1, (i, value) => value + 1); if (property != null) { _properties.Add(property); } Logger.Instance.TraceExtra(typeof(DisposableTracerFull), "{0}: {1}{2}", _itemId, which, property, property == null ? "" : (" " + property)); }
/// <summary> Process the incoming debug event queue</summary> internal virtual void processEvents() { while (m_Session != null && m_Session.getEventCount() > 0) { DebugEvent e = m_Session.nextEvent(); if (e is TraceEvent) { dumpTraceLine(e.information); if (TraceEvent != null) { TraceEvent(this, e.information); } } else if (e is SwfLoadedEvent) { if (PluginMain.settingObject.VerboseOutput) { dumpSwfLoadedEvent((SwfLoadedEvent)e); } } else if (e is SwfUnloadedEvent) { if (PluginMain.settingObject.VerboseOutput) { dumpSwfUnloadedEvent((SwfUnloadedEvent)e); } } else if (e is BreakEvent) { // we ignore these for now } else if (e is FileListModifiedEvent) { // we ignore this } else if (e is FunctionMetaDataAvailableEvent) { // we ignore this } else if (e is FaultEvent) { dumpFaultLine((FaultEvent)e); } else { if (PluginMain.settingObject.VerboseOutput) { System.Collections.IDictionary args = new System.Collections.Hashtable(); args["type"] = e; //$NON-NLS-1$ args["info"] = e.information; //$NON-NLS-1$ TraceManager.AddAsync(replaceInlineReferences(TextHelper.GetString("Info.UnknownEvent"), args)); } } } }
protected void OnDebug(DebugEventArgs e) { if (DebugEvent != null) { // 如果有对象注册 foreach (DebugEventHandler de in DebugEvent.GetInvocationList()) { //Console.WriteLine("DebugEvent begin..."); de.BeginInvoke(this, e, new AsyncCallback(DebugCallBack), de); } } }
private void DrawText(Vector3 position, DebugEvent debugEvent) { if (!EnableGizmoDebuggin()) { return; } string text = string.Join("\n", new string[] { GameEvent.name, debugEvent.FunctionName }); Handles.Label(position, text, Styles.TextStyle); }
public void Recieve(Stream str) { BinaryReader br = new BinaryReader(str); this.devent = (DebugEvent)br.ReadByte(); this.field0 = br.ReadUInt32(); this.field1 = br.ReadUInt32(); this.field2 = br.ReadUInt32(); this.dataSize = br.ReadUInt32(); this.data = br.ReadBytes((int)this.dataSize); }
/// <summary> /// /// </summary> private void OnException(DebugEvent e) { TraceManager.AddAsync(e.GetMessageStr(), (int)TraceType.Error); UpdateUI(DebuggerState.ExceptionHalt); DialogResult result = MessageBox.Show(e.GetMessageStr(), "Exception", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Exclamation); if (result == DialogResult.Ignore) { debugger.Continue(m_CurrentVM); } }
public override void Handle() { // dump debugstats to file // clear event queue sim.eventQueue.Clear(); if (sim.simulationParameters.debugType != DebugType.Never) { DebugEvent.DebugNow(sim, true, this); } return; }
public void AllInfrastructureEventsAreReceived() { using (var scope = BeginScope()) { var @event = new DebugEvent() { Message = "Test" }; scope.PublishEvent(@event); var handler = scope.Resolve<InfrastructureEventHandler>(); Assert.Equal(@event, handler.LastEvent); } }
private static DbgContinueStatus GetDbgContinueStatus(DebugEvent continue_event) { switch (continue_event.State) { case DbgState.BreakpointStateChange: case DbgState.ExceptionStateChange: case DbgState.SingleStepStateChange: return(DbgContinueStatus.DBG_EXCEPTION_NOT_HANDLED); default: return(DbgContinueStatus.DBG_CONTINUE); } }
public void AllInfrastructureEventsAreReceived() { using (var scope = BeginScope()) { var @event = new DebugEvent() { Message = "Test" }; scope.PublishEvent(@event); var handler = scope.Resolve <InfrastructureEventHandler>(); Assert.Equal(@event, handler.LastEvent); } }
public IDebugHookReference Register(DebugEvent eventType, int address, int size, IDebugHookCallback cb) { var r = new Reference(); r.cb = cb; r.eventType = eventType; r.address = address; r.size = size; for (int i = 0; i < size; i++) { uint a = (uint)(address + i); database[eventType][a].Add(r); } return r; }
bool IsBreakpointBoundEvent(IDebugPendingBreakpoint2 expected, DebugEvent actual) { var be = actual as BreakpointBoundEvent; if (be == null) { return(false); } IDebugPendingBreakpoint2 pendingBreakpoint; be.GetPendingBreakpoint(out pendingBreakpoint); return(pendingBreakpoint == expected); }
private DebugEvent GetDebugEventFromRecord(NpgsqlDataReader reader) { var debugEvent = new DebugEvent { Command = (CommandType)reader.GetValue(8), StockSymbol = (reader.IsDBNull(9)) ? null : reader.GetString(9), Funds = (reader.IsDBNull(10)) ? null : (decimal?)reader.GetDecimal(10), FileName = (reader.IsDBNull(11)) ? null : reader.GetString(11), DebugMessage = (reader.IsDBNull(12)) ? null : reader.GetString(12) }; FillBaseEventPropertiesFromRecord(debugEvent, reader); return(debugEvent); }
public IDebugHookReference Register(DebugEvent eventType, int address, int size, IDebugHookCallback cb) { var r = new Reference(); r.cb = cb; r.eventType = eventType; r.address = address; r.size = size; for (int i = 0; i < size; i++) { uint a = (uint)(address + i); database[eventType][a].Add(r); } return(r); }
/// <summary> /// /// </summary> /// override public void AddPendingEvent(DebugEvent e) { if ((PluginBase.MainForm as Form).InvokeRequired) { DebugEvent clone = e.Clone(); (PluginBase.MainForm as Form).BeginInvoke((MethodInvoker) delegate() { AddPendingEvent(clone); }); return; } ProcessEvent(e); }
/// <summary> /// /// </summary> private void OnMessage(DebugEvent e) { MessageType type = e.GetMessageType(); int state = (int)TraceType.Info; if (type == MessageType.MessageType_Warning) { state = (int)TraceType.Warning; } else if (type == MessageType.MessageType_Error) { state = (int)TraceType.Error; } TraceManager.AddAsync(e.GetMessageStr(), state); }
/// <summary> /// Adds a Debug Event /// </summary> /// <param name="methodName">Name of the method where this event is being added</param> /// <param name="eventOrderingNumber">If the event is to be placed at a specific ordering number, it can be specified</param> /// <param name="eventTime">A different time for the event can be specifiied (different than the time when the event is logged)</param> /// <param name="message">A message to describe the event</param> private static DebugEvent AddEventToDebugTools(string methodName, string message, decimal eventOrderingNumber, DateTime?eventTime = null) { if (Active) { var x = new DebugEvent() { EventOrderingNumber = eventOrderingNumber, MethodName = methodName, EventTime = eventTime ?? DateTime.Now, Message = message }; Events.Add(x); return(x); } return(null); }
public void AddSubContext(string context, string subContext, DebugEvent debugEvent) { DebugTree.AddSubContext(context, subContext, debugEvent); }