From 36a43c9d5168ea26fe3c2c1f8f7ed8d52a2be34c Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Fri, 14 Aug 2015 20:46:37 -0400 Subject: [PATCH] Debugger: Implement notifications for debug info loading. TeamDebugger: - When notified that an image debug info job has started loading, notify the user interface accordingly. Also reset status to a ready state whenever all in-flight jobs are complete. This allows the user to know when then debug subsystem is still in the process of parsing debug information, as this can be time consuming for larger programs/libraries. --- .../debugger/controllers/TeamDebugger.cpp | 23 ++++++++++++++++++- src/apps/debugger/controllers/TeamDebugger.h | 6 +++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/apps/debugger/controllers/TeamDebugger.cpp b/src/apps/debugger/controllers/TeamDebugger.cpp index 352b7d11f0..72abdef437 100644 --- a/src/apps/debugger/controllers/TeamDebugger.cpp +++ b/src/apps/debugger/controllers/TeamDebugger.cpp @@ -1373,6 +1373,7 @@ void TeamDebugger::JobDone(Job* job) { TRACE_JOBS("TeamDebugger::JobDone(%p)\n", job); + _ResetUserBackgroundStatusIfNeeded(); } @@ -1381,6 +1382,7 @@ TeamDebugger::JobFailed(Job* job) { TRACE_JOBS("TeamDebugger::JobFailed(%p)\n", job); // TODO: notify user + _ResetUserBackgroundStatusIfNeeded(); } @@ -1390,6 +1392,7 @@ TeamDebugger::JobAborted(Job* job) TRACE_JOBS("TeamDebugger::JobAborted(%p)\n", job); // TODO: For a stack frame source loader thread we should reset the // loading state! Asynchronously due to locking order. + _ResetUserBackgroundStatusIfNeeded(); } @@ -1407,6 +1410,16 @@ TeamDebugger::ImageDebugInfoJobNeedsUserInput(Job* job, } +void +TeamDebugger::ImageDebugInfoJobInProgress(Image* image) +{ + BString message; + message.SetToFormat("Loading debug information for %s...", + image->Name().String()); + fUserInterface->NotifyBackgroundWorkStatus(message.String()); +} + + void TeamDebugger::ThreadStateChanged(const ::Team::ThreadEvent& event) { @@ -1908,7 +1921,6 @@ TeamDebugger::_HandleImageDebugInfoChanged(image_id imageID) bool handlePostExecSetup = fExecPending && image->Type() == B_APP_IMAGE && state != IMAGE_DEBUG_INFO_LOADING; - // this needs to be done first so that breakpoints are loaded. // otherwise, UpdateImageBreakpoints() won't find the appropriate // UserBreakpoints to create/install instances for. @@ -1922,6 +1934,7 @@ TeamDebugger::_HandleImageDebugInfoChanged(image_id imageID) if (state == IMAGE_DEBUG_INFO_LOADED || state == IMAGE_DEBUG_INFO_UNAVAILABLE) { + // update breakpoints in the image fBreakpointManager->UpdateImageBreakpoints(image); @@ -2486,6 +2499,14 @@ TeamDebugger::_NotifyUser(const char* title, const char* text,...) } +void +TeamDebugger::_ResetUserBackgroundStatusIfNeeded() +{ + if (!fWorker->HasPendingJobs()) + fUserInterface->NotifyBackgroundWorkStatus("Ready."); +} + + // #pragma mark - Listener diff --git a/src/apps/debugger/controllers/TeamDebugger.h b/src/apps/debugger/controllers/TeamDebugger.h index d69e0f53f0..d588cf368d 100644 --- a/src/apps/debugger/controllers/TeamDebugger.h +++ b/src/apps/debugger/controllers/TeamDebugger.h @@ -140,6 +140,7 @@ private: virtual void ImageDebugInfoJobNeedsUserInput(Job* job, ImageDebugInfoLoadingState* state); + virtual void ImageDebugInfoJobInProgress(Image* image); // Team::Listener virtual void ThreadStateChanged( @@ -235,6 +236,11 @@ private: void _NotifyUser(const char* title, const char* text,...); + void _ResetUserBackgroundStatusIfNeeded(); + // updates user interface to + // ready/completed message + // for background work status + private: Listener* fListener; SettingsManager* fSettingsManager;