本文整理汇总了C#中Mono.Debugging.Client.TargetEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# TargetEventArgs类的具体用法?C# TargetEventArgs怎么用?C# TargetEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TargetEventArgs类属于Mono.Debugging.Client命名空间,在下文中一共展示了TargetEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BreakpointHit
void BreakpointHit(string path, int line)
{
foreach (var bp in Breakpoints.GetBreakpoints())
{
if(bp.FileName == path && bp.Line == line)
{
var args = new TargetEventArgs (TargetEventType.TargetHitBreakpoint);
args.BreakEvent = bp;
OnTargetEvent (args);
break;
}
}
}
示例2: OnProcessExit
void OnProcessExit (object sender, CorProcessEventArgs e)
{
TargetEventArgs args = new TargetEventArgs (TargetEventType.TargetExited);
// If the main thread stopped, terminate the debugger session
if (e.Process.Id == process.Id) {
lock (terminateLock) {
process = null;
ThreadPool.QueueUserWorkItem (delegate
{
// The Terminate call will fail if called in the event handler
dbg.Terminate ();
dbg = null;
GC.Collect ();
});
}
}
OnTargetEvent (args);
}
示例3: OnTargetEvent
static void OnTargetEvent (object sender, TargetEventArgs args)
{
try {
switch (args.Type) {
case TargetEventType.TargetExited:
Cleanup ();
break;
case TargetEventType.TargetSignaled:
case TargetEventType.TargetStopped:
case TargetEventType.TargetHitBreakpoint:
case TargetEventType.TargetInterrupted:
case TargetEventType.UnhandledException:
case TargetEventType.ExceptionThrown:
SetCurrentBacktrace (args.Backtrace);
NotifyPaused ();
NotifyException (args);
break;
default:
break;
}
} catch (Exception ex) {
LoggingService.LogError ("Error handling debugger target event", ex);
}
}
示例4: HandleBreakEventSet
void HandleBreakEventSet (Event[] es, bool dequeuing)
{
if (dequeuing && exited)
return;
OnHandleBreakEventSet (es);
bool resume = true;
ObjectMirror exception = null;
TargetEventType etype = TargetEventType.TargetStopped;
BreakEvent breakEvent = null;
if (es[0] is ExceptionEvent) {
var bad = es.FirstOrDefault (ee => !(ee is ExceptionEvent));
if (bad != null)
throw new Exception ("Catchpoint eventset had unexpected event type " + bad.GetType ());
var ev = (ExceptionEvent)es[0];
if (ev.Request == unhandledExceptionRequest)
etype = TargetEventType.UnhandledException;
else
etype = TargetEventType.ExceptionThrown;
exception = ev.Exception;
if (ev.Request != unhandledExceptionRequest || exception.Type.FullName != "System.Threading.ThreadAbortException")
resume = false;
}
else {
//always need to evaluate all breakpoints, some might be tracepoints or conditional bps with counters
foreach (Event e in es) {
BreakpointEvent be = e as BreakpointEvent;
if (be != null) {
if (!HandleBreakpoint (e.Thread, be.Request)) {
etype = TargetEventType.TargetHitBreakpoint;
BreakInfo binfo;
if (breakpoints.TryGetValue (be.Request, out binfo))
breakEvent = binfo.BreakEvent;
resume = false;
}
} else if (e is StepEvent) {
etype = TargetEventType.TargetStopped;
resume = false;
} else {
throw new Exception ("Break eventset had unexpected event type " + e.GetType ());
}
}
}
if (resume) {
//all breakpoints were conditional and evaluated as false
vm.Resume ();
DequeueEventsForFirstThread ();
} else {
if (currentStepRequest != null) {
currentStepRequest.Enabled = false;
currentStepRequest = null;
}
current_thread = recent_thread = es[0].Thread;
TargetEventArgs args = new TargetEventArgs (etype);
args.Process = OnGetProcesses () [0];
args.Thread = GetThread (args.Process, current_thread);
args.Backtrace = GetThreadBacktrace (current_thread);
args.BreakEvent = breakEvent;
if (exception != null)
activeExceptionsByThread [current_thread.ThreadId] = exception;
OnTargetEvent (args);
}
}
示例5: OnStepComplete
void OnStepComplete (object sender, CorStepCompleteEventArgs e)
{
lock (debugLock) {
if (evaluating) {
e.Continue = true;
return;
}
}
OnStopped ();
e.Continue = false;
SetActiveThread (e.Thread);
TargetEventArgs args = new TargetEventArgs (TargetEventType.TargetStopped);
args.Process = GetProcess (process);
args.Thread = GetThread (e.Thread);
args.Backtrace = new Backtrace (new CorBacktrace (e.Thread, this));
OnTargetEvent (args);
}
示例6: ForceExit
void ForceExit ()
{
TargetEventArgs args = new TargetEventArgs (TargetEventType.TargetExited);
OnTargetEvent (args);
}
示例7: HandleBreakEventSet
//.........这里部分代码省略.........
throw new Exception ("Catchpoint eventset had unexpected event type " + bad.GetType ());
var ev = (ExceptionEvent)es[0];
if (ev.Request == unhandledExceptionRequest)
etype = TargetEventType.UnhandledException;
else
etype = TargetEventType.ExceptionThrown;
exception = ev.Exception;
if (ev.Request != unhandledExceptionRequest || exception.Type.FullName != "System.Threading.ThreadAbortException")
resume = false;
}
else {
//always need to evaluate all breakpoints, some might be tracepoints or conditional bps with counters
foreach (Event e in es) {
if (e.EventType == EventType.Breakpoint) {
var be = e as BreakpointEvent;
BreakInfo binfo;
if (!HandleBreakpoint (e.Thread, be.Request)) {
etype = TargetEventType.TargetHitBreakpoint;
autoStepInto = false;
resume = false;
}
if (breakpoints.TryGetValue (be.Request, out binfo)) {
if (currentStepRequest != null &&
binfo.Location.ILOffset == currentAddress &&
e.Thread.Id == currentStepRequest.Thread.Id)
redoCurrentStep = true;
breakEvent = binfo.BreakEvent;
}
} else if (e.EventType == EventType.Step) {
var stepRequest = e.Request as StepEventRequest;
steppedInto = IsStepIntoRequest (stepRequest);
steppedOut = IsStepOutRequest (stepRequest);
etype = TargetEventType.TargetStopped;
resume = false;
} else if (e.EventType == EventType.UserBreak) {
etype = TargetEventType.TargetStopped;
autoStepInto = false;
resume = false;
} else {
throw new Exception ("Break eventset had unexpected event type " + e.GetType ());
}
}
}
if (redoCurrentStep) {
StepDepth depth = currentStepRequest.Depth;
StepSize size = currentStepRequest.Size;
current_thread = recent_thread = es[0].Thread;
currentStepRequest.Enabled = false;
currentStepRequest = null;
Step (depth, size);
} else if (resume) {
//all breakpoints were conditional and evaluated as false
vm.Resume ();
DequeueEventsForFirstThread ();
} else {
if (currentStepRequest != null) {
currentStepRequest.Enabled = false;
currentStepRequest = null;
}
current_thread = recent_thread = es[0].Thread;
if (exception != null)
activeExceptionsByThread [current_thread.ThreadId] = exception;
var backtrace = GetThreadBacktrace (current_thread);
bool stepOut = false;
if (backtrace.FrameCount > 0) {
var frame = backtrace.GetFrame (0) as SoftDebuggerStackFrame;
currentAddress = frame != null ? frame.Address : -1;
if (steppedInto && Options.StepOverPropertiesAndOperators)
stepOut = frame != null && IsPropertyOrOperatorMethod (frame.StackFrame.Method);
}
if (stepOut) {
// We will want to call StepInto once StepOut returns...
autoStepInto = true;
Step (StepDepth.Out, StepSize.Min);
} else if (steppedOut && autoStepInto) {
autoStepInto = false;
Step (StepDepth.Into, StepSize.Min);
} else {
var args = new TargetEventArgs (etype);
args.Process = OnGetProcesses () [0];
args.Thread = GetThread (args.Process, current_thread);
args.Backtrace = backtrace;
args.BreakEvent = breakEvent;
OnTargetEvent (args);
}
}
}
示例8: FireTargetEvent
void FireTargetEvent (TargetEventType type, ResultData curFrame)
{
UpdateHitCountData ();
TargetEventArgs args = new TargetEventArgs (type);
if (type != TargetEventType.TargetExited) {
GdbCommandResult res = RunCommand ("-stack-info-depth");
int fcount = int.Parse (res.GetValue ("depth"));
GdbBacktrace bt = new GdbBacktrace (this, activeThread, fcount, curFrame);
args.Backtrace = new Backtrace (bt);
args.Thread = GetThread (activeThread);
}
OnTargetEvent (args);
}
示例9: ExceptionHandler
private static void ExceptionHandler(object sender, TargetEventArgs e, bool firstChance)
{
SetBacktrace(e.Backtrace);
_isPaused = true;
_isExcepted = !firstChance;
ExceptionPrinter.Print(Backtrace.CurrentStackFrame.GetException());
if (CommandLine.Suspended)
CommandLine.ResumeEvent.Set();
}
示例10: FireBreakPoint
void FireBreakPoint(ulong offset)
{
TargetEventArgs args = new TargetEventArgs(TargetEventType.TargetHitBreakpoint);
ulong tempoff = (ulong)offset;
if (breakpoints.ContainsKey(tempoff))
{
breakpoints[(ulong)tempoff].EventInfo.UpdateHitCount((int)breakpoints[(ulong)tempoff].Breakpoint.HitCount);
args.BreakEvent = breakpoints[(ulong)tempoff].EventInfo.BreakEvent;
}
else
{
args = new TargetEventArgs(TargetEventType.TargetStopped);
BreakEventInfo breakInfo = new BreakEventInfo();
breakInfo.Handle = tempoff;
breakInfo.SetStatus (BreakEventStatus.Bound, null);
string fn;
uint ln;
if (Engine.Symbols.GetLineByOffset(offset, out fn, out ln))
{
//breakInfo.BreakEvent = new Breakpoint(fn, (int)ln);
args.BreakEvent = breakInfo.BreakEvent;
}
}
ProcessInfo process = OnGetProcesses()[0];
args.Process = new ProcessInfo(process.Id, process.Name);
args.Backtrace = new Backtrace(new DDebugBacktrace(this, activeThread, Engine));
ThreadPool.QueueUserWorkItem(delegate(object data)
{
try
{
OnTargetEvent((TargetEventArgs)data);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}, args);
}
示例11: OnExit
protected override void OnExit ()
{
lock (gdbLock) {
InternalStop ();
RunCommand ("kill");
TargetEventArgs args = new TargetEventArgs (TargetEventType.TargetExited);
OnTargetEvent (args);
/* proc.Kill ();
TargetEventArgs args = new TargetEventArgs (TargetEventType.TargetExited);
OnTargetEvent (args);
*/ }
}
示例12: OnExit
protected override void OnExit()
{
OnStop();
TargetEventArgs args = new TargetEventArgs(TargetEventType.TargetExited);
OnTargetEvent(args);
}
示例13: OnDetach
protected override void OnDetach()
{
TargetEventArgs args = new TargetEventArgs(TargetEventType.TargetExited);
OnTargetEvent(args);
}
示例14: OnTargetEvent
public void OnTargetEvent (TargetEventArgs args)
{
frontend.NotifyTargetEvent (args);
if (args.Type == TargetEventType.TargetExited)
StopDebugger ();
}
示例15: NotifyTargetEvent
public void NotifyTargetEvent (TargetEventArgs args)
{
session.OnTargetEvent (args);
}