From 726d557c9e2cedcf3145146e3e054c4931c5cb1e Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sun, 29 Jul 2012 00:18:12 +0200 Subject: [PATCH] Debugger CLI: Wait for TeamDebugger thread to die before exit() --- src/apps/debugger/Debugger.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/apps/debugger/Debugger.cpp b/src/apps/debugger/Debugger.cpp index 888db4acf5..645151d84e 100644 --- a/src/apps/debugger/Debugger.cpp +++ b/src/apps/debugger/Debugger.cpp @@ -594,14 +594,20 @@ CliDebugger::Run(const Options& options) if (!get_debugged_program(options, programInfo)) return false; - if (start_team_debugger(programInfo.team, &settingsManager, this, - programInfo.thread, programInfo.stopInMain, userInterface) - == NULL) { + TeamDebugger* teamDebugger = start_team_debugger(programInfo.team, + &settingsManager, this, programInfo.thread, programInfo.stopInMain, + userInterface); + if (teamDebugger == NULL) return false; - } + thread_id teamDebuggerThread = teamDebugger->Thread(); + + // run the input loop userInterface->Run(); + // wait for the team debugger thread to terminate + wait_for_thread(teamDebuggerThread, NULL); + return true; }