Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

Handle debugger stop event with SoftDebuggerSession.TargetEvent #60

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 8 additions & 20 deletions src/Debugger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,14 @@ static void EnsureCreated()
_session.TargetEvent += (sender, e) =>
{
Log.Debug("Event: '{0}'", e.Type);

if (e.IsStopEvent)
{
if (ActiveFrame != null)
Log.Emphasis(Utilities.StringizeFrame(ActiveFrame, true));

CommandLine.ResumeEvent.Set();
}
};

_session.TargetStarted += (sender, e) =>
Expand Down Expand Up @@ -293,18 +301,12 @@ static void EnsureCreated()
{
Log.Notice("Inferior process '{0}' ('{1}') suspended",
ActiveProcess.Id, StringizeTarget());
Log.Emphasis(Utilities.StringizeFrame(ActiveFrame, true));

CommandLine.ResumeEvent.Set();
};

_session.TargetInterrupted += (sender, e) =>
{
Log.Notice("Inferior process '{0}' ('{1}') interrupted",
ActiveProcess.Id, StringizeTarget());
Log.Emphasis(Utilities.StringizeFrame(ActiveFrame, true));

CommandLine.ResumeEvent.Set();
};

_session.TargetHitBreakpoint += (sender, e) =>
Expand All @@ -322,10 +324,6 @@ static void EnsureCreated()

Log.Notice("Hit breakpoint at '{0}:{1}'{2}", bp.FileName, bp.Line, cond);
}

Log.Emphasis(Utilities.StringizeFrame(ActiveFrame, true));

CommandLine.ResumeEvent.Set();
};

_session.TargetExited += (sender, e) =>
Expand Down Expand Up @@ -354,32 +352,22 @@ static void EnsureCreated()

_debuggeeKilled = true;
_kind = SessionKind.Disconnected;

CommandLine.ResumeEvent.Set();
};

_session.TargetExceptionThrown += (sender, e) =>
{
var ex = ActiveException;

Log.Notice("Trapped first-chance exception of type '{0}'", ex.Type);
Log.Emphasis(Utilities.StringizeFrame(ActiveFrame, true));

PrintException(ex);

CommandLine.ResumeEvent.Set();
};

_session.TargetUnhandledException += (sender, e) =>
{
var ex = ActiveException;

Log.Notice("Trapped unhandled exception of type '{0}'", ex.Type);
Log.Emphasis(Utilities.StringizeFrame(ActiveFrame, true));

PrintException(ex);

CommandLine.ResumeEvent.Set();
};

_session.TargetThreadStarted += (sender, e) =>
Expand Down