From dd817ff93cd2a76942d942b826ea9ecae8c79d0d Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Tue, 23 Apr 2013 23:05:36 -0400 Subject: [PATCH] Handle team deletion debug event. When the target team exits, notify the user and shut down the debugger. --- .../debugger/controllers/TeamDebugger.cpp | 20 ++++++++++++++++++- src/apps/debugger/controllers/TeamDebugger.h | 2 ++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/apps/debugger/controllers/TeamDebugger.cpp b/src/apps/debugger/controllers/TeamDebugger.cpp index 433e8ef61c..25d66d5eb6 100644 --- a/src/apps/debugger/controllers/TeamDebugger.cpp +++ b/src/apps/debugger/controllers/TeamDebugger.cpp @@ -1145,10 +1145,14 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event) //printf("B_DEBUGGER_MESSAGE_TEAM_CREATED: team: %ld\n", message.team_created.new_team); // break; case B_DEBUGGER_MESSAGE_TEAM_DELETED: - // TODO: Handle! + { TRACE_EVENTS("B_DEBUGGER_MESSAGE_TEAM_DELETED: team: %" B_PRId32 "\n", event->Team()); + TeamDeletedEvent* teamEvent + = dynamic_cast(event); + handled = _HandleTeamDeleted(teamEvent); break; + } case B_DEBUGGER_MESSAGE_TEAM_EXEC: TRACE_EVENTS("B_DEBUGGER_MESSAGE_TEAM_EXEC: team: %" B_PRId32 "\n", event->Team()); @@ -1226,6 +1230,20 @@ TeamDebugger::_HandleDebuggerMessage(DebugEvent* event) } +bool +TeamDebugger::_HandleTeamDeleted(TeamDeletedEvent* event) +{ + char message[64]; + snprintf(message, sizeof(message), "Team %" B_PRId32 " has terminated.", + event->Team()); + fUserInterface->SynchronouslyAskUser("Quit Debugger", message, "Quit", + NULL, NULL); + PostMessage(B_QUIT_REQUESTED); + + return true; +} + + bool TeamDebugger::_HandleThreadCreated(ThreadCreatedEvent* event) { diff --git a/src/apps/debugger/controllers/TeamDebugger.h b/src/apps/debugger/controllers/TeamDebugger.h index b8b43478af..700c01a430 100644 --- a/src/apps/debugger/controllers/TeamDebugger.h +++ b/src/apps/debugger/controllers/TeamDebugger.h @@ -116,6 +116,8 @@ private: void _HandleDebuggerMessage(DebugEvent* event); + bool _HandleTeamDeleted( + TeamDeletedEvent* event); bool _HandleThreadCreated( ThreadCreatedEvent* event); bool _HandleThreadRenamed(