Debugger: Finish handling of missing debug information.
Add a listener interface for LoadImageDebugInfoJob that allows it to request user assistance based on its current state. Adjust callers to pass in said listener accordingly. Implement the aforementioned listener interface in TeamDebugger, and use the loading state handler roster to find the appropriate handler / handle the request. This implements most of what's needed for #10138, the main piece still missing is for the dwarf handler to detect whether the image in question comes from a package, and if so, to offer to install the corresponding debug information package rather than locating the file manually, assuming such a package exists.
This commit is contained in:
@@ -32,12 +32,16 @@
|
||||
#include "Function.h"
|
||||
#include "FunctionID.h"
|
||||
#include "ImageDebugInfo.h"
|
||||
#include "ImageDebugInfoLoadingState.h"
|
||||
#include "ImageDebugLoadingStateHandler.h"
|
||||
#include "ImageDebugLoadingStateHandlerRoster.h"
|
||||
#include "Jobs.h"
|
||||
#include "LocatableFile.h"
|
||||
#include "MessageCodes.h"
|
||||
#include "SettingsManager.h"
|
||||
#include "SourceCode.h"
|
||||
#include "SpecificImageDebugInfo.h"
|
||||
#include "SpecificImageDebugInfoLoadingState.h"
|
||||
#include "StackFrame.h"
|
||||
#include "StackFrameValues.h"
|
||||
#include "Statement.h"
|
||||
@@ -463,8 +467,7 @@ TeamDebugger::Init(team_id teamID, thread_id threadID, int argc,
|
||||
return error;
|
||||
|
||||
ThreadHandler* handler = new(std::nothrow) ThreadHandler(thread,
|
||||
fWorker, fDebuggerInterface,
|
||||
fBreakpointManager);
|
||||
fWorker, fDebuggerInterface, this, fBreakpointManager);
|
||||
if (handler == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
@@ -787,6 +790,20 @@ TeamDebugger::MessageReceived(BMessage* message)
|
||||
break;
|
||||
}
|
||||
|
||||
case MSG_DEBUG_INFO_NEEDS_USER_INPUT:
|
||||
{
|
||||
Job* job;
|
||||
ImageDebugInfoLoadingState* state;
|
||||
if (message->FindPointer("job", (void**)&job) != B_OK)
|
||||
break;
|
||||
if (message->FindPointer("state", (void**)&state) != B_OK)
|
||||
break;
|
||||
|
||||
_HandleDebugInfoJobUserInput(state);
|
||||
fWorker->ResumeJob(job);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
BLooper::MessageReceived(message);
|
||||
break;
|
||||
@@ -848,7 +865,7 @@ TeamDebugger::FunctionSourceCodeRequested(FunctionInstance* functionInstance,
|
||||
void
|
||||
TeamDebugger::ImageDebugInfoRequested(Image* image)
|
||||
{
|
||||
LoadImageDebugInfoJob::ScheduleIfNecessary(fWorker, image);
|
||||
LoadImageDebugInfoJob::ScheduleIfNecessary(fWorker, image, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -1121,6 +1138,20 @@ TeamDebugger::JobAborted(Job* job)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TeamDebugger::ImageDebugInfoJobNeedsUserInput(Job* job,
|
||||
ImageDebugInfoLoadingState* state)
|
||||
{
|
||||
TRACE_JOBS("TeamDebugger::DebugInfoJobNeedsUserInput(%p, %p)\n",
|
||||
job, state);
|
||||
|
||||
BMessage message(MSG_DEBUG_INFO_NEEDS_USER_INPUT);
|
||||
message.AddPointer("job", job);
|
||||
message.AddPointer("state", state);
|
||||
PostMessage(&message);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TeamDebugger::ThreadStateChanged(const ::Team::ThreadEvent& event)
|
||||
{
|
||||
@@ -1405,8 +1436,7 @@ TeamDebugger::_HandleThreadCreated(ThreadCreatedEvent* event)
|
||||
fTeam->AddThread(info, &thread);
|
||||
|
||||
ThreadHandler* handler = new(std::nothrow) ThreadHandler(thread,
|
||||
fWorker, fDebuggerInterface,
|
||||
fBreakpointManager);
|
||||
fWorker, fDebuggerInterface, this, fBreakpointManager);
|
||||
if (handler != NULL) {
|
||||
fThreadHandlers.Insert(handler);
|
||||
handler->Init();
|
||||
@@ -1909,6 +1939,24 @@ TeamDebugger::_HandleSetArguments(int argc, const char* const* argv)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TeamDebugger::_HandleDebugInfoJobUserInput(ImageDebugInfoLoadingState* state)
|
||||
{
|
||||
SpecificImageDebugInfoLoadingState* specificState
|
||||
= state->GetSpecificDebugInfoLoadingState();
|
||||
|
||||
ImageDebugLoadingStateHandler* handler;
|
||||
if (ImageDebugLoadingStateHandlerRoster::Default()
|
||||
->FindStateHandler(specificState, handler) != B_OK) {
|
||||
TRACE_JOBS("TeamDebugger::_HandleDebugInfoJobUserInput(): "
|
||||
"Failed to find appropriate information handler, aborting.");
|
||||
return;
|
||||
}
|
||||
|
||||
handler->HandleState(specificState, fUserInterface);
|
||||
}
|
||||
|
||||
|
||||
ThreadHandler*
|
||||
TeamDebugger::_GetThreadHandler(thread_id threadID)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user