Implement #9855.
The Team menu now has a menu item allowing one to tell the debugger to stop whenever a new executable image is loaded by the debugged team. This setting is not currently persisted, though that can be changed if desired.
This commit is contained in:
@@ -22,6 +22,7 @@ enum {
|
|||||||
MSG_CLEAR_WATCHPOINT = 'cwpt',
|
MSG_CLEAR_WATCHPOINT = 'cwpt',
|
||||||
MSG_ENABLE_WATCHPOINT = 'ewpt',
|
MSG_ENABLE_WATCHPOINT = 'ewpt',
|
||||||
MSG_DISABLE_WATCHPOINT = 'dwpt',
|
MSG_DISABLE_WATCHPOINT = 'dwpt',
|
||||||
|
MSG_STOP_ON_IMAGE_LOAD = 'tsil',
|
||||||
|
|
||||||
MSG_THREAD_STATE_CHANGED = 'tsch',
|
MSG_THREAD_STATE_CHANGED = 'tsch',
|
||||||
MSG_THREAD_CPU_STATE_CHANGED = 'tcsc',
|
MSG_THREAD_CPU_STATE_CHANGED = 'tcsc',
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include <Entry.h>
|
#include <Entry.h>
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
|
|
||||||
|
#include <AutoDeleter.h>
|
||||||
#include <AutoLocker.h>
|
#include <AutoLocker.h>
|
||||||
|
|
||||||
#include "debug_utils.h"
|
#include "debug_utils.h"
|
||||||
@@ -222,7 +223,8 @@ TeamDebugger::TeamDebugger(Listener* listener, UserInterface* userInterface,
|
|||||||
fTerminating(false),
|
fTerminating(false),
|
||||||
fKillTeamOnQuit(false),
|
fKillTeamOnQuit(false),
|
||||||
fCommandLineArgc(0),
|
fCommandLineArgc(0),
|
||||||
fCommandLineArgv(NULL)
|
fCommandLineArgv(NULL),
|
||||||
|
fStopOnImageLoad(false)
|
||||||
{
|
{
|
||||||
fUserInterface->AcquireReference();
|
fUserInterface->AcquireReference();
|
||||||
}
|
}
|
||||||
@@ -603,6 +605,16 @@ TeamDebugger::MessageReceived(BMessage* message)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case MSG_STOP_ON_IMAGE_LOAD:
|
||||||
|
{
|
||||||
|
bool enabled;
|
||||||
|
if (message->FindBool("enabled", &enabled) != B_OK)
|
||||||
|
break;
|
||||||
|
|
||||||
|
fStopOnImageLoad = enabled;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case MSG_SET_WATCHPOINT:
|
case MSG_SET_WATCHPOINT:
|
||||||
case MSG_CLEAR_WATCHPOINT:
|
case MSG_CLEAR_WATCHPOINT:
|
||||||
{
|
{
|
||||||
@@ -886,6 +898,15 @@ TeamDebugger::ClearBreakpointRequested(target_addr_t address)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TeamDebugger::SetStopOnImageLoadRequested(bool enabled)
|
||||||
|
{
|
||||||
|
BMessage message(MSG_STOP_ON_IMAGE_LOAD);
|
||||||
|
message.AddBool("enabled", enabled);
|
||||||
|
PostMessage(&message);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TeamDebugger::ClearBreakpointRequested(UserBreakpoint* breakpoint)
|
TeamDebugger::ClearBreakpointRequested(UserBreakpoint* breakpoint)
|
||||||
{
|
{
|
||||||
@@ -1502,9 +1523,16 @@ TeamDebugger::_HandleImageDebugInfoChanged(image_id imageID)
|
|||||||
ImageInfoPendingThread* thread = fImageInfoPendingThreads
|
ImageInfoPendingThread* thread = fImageInfoPendingThreads
|
||||||
->Lookup(imageID);
|
->Lookup(imageID);
|
||||||
if (thread != NULL) {
|
if (thread != NULL) {
|
||||||
fDebuggerInterface->ContinueThread(thread->ThreadID());
|
|
||||||
fImageInfoPendingThreads->Remove(thread);
|
fImageInfoPendingThreads->Remove(thread);
|
||||||
delete thread;
|
ObjectDeleter<ImageInfoPendingThread> threadDeleter(thread);
|
||||||
|
if (fStopOnImageLoad) {
|
||||||
|
ThreadHandler* handler = _GetThreadHandler(thread->ThreadID());
|
||||||
|
BReference<ThreadHandler> handlerReference(handler);
|
||||||
|
|
||||||
|
if (handler != NULL && handler->HandleThreadDebugged(NULL))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fDebuggerInterface->ContinueThread(thread->ThreadID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ private:
|
|||||||
virtual void ClearBreakpointRequested(target_addr_t address);
|
virtual void ClearBreakpointRequested(target_addr_t address);
|
||||||
virtual void ClearBreakpointRequested(
|
virtual void ClearBreakpointRequested(
|
||||||
UserBreakpoint* breakpoint);
|
UserBreakpoint* breakpoint);
|
||||||
|
virtual void SetStopOnImageLoadRequested(bool enabled);
|
||||||
virtual void SetWatchpointRequested(target_addr_t address,
|
virtual void SetWatchpointRequested(target_addr_t address,
|
||||||
uint32 type, int32 length, bool enabled);
|
uint32 type, int32 length, bool enabled);
|
||||||
virtual void SetWatchpointEnabledRequested(
|
virtual void SetWatchpointEnabledRequested(
|
||||||
@@ -206,6 +207,7 @@ private:
|
|||||||
TeamSettings fTeamSettings;
|
TeamSettings fTeamSettings;
|
||||||
int fCommandLineArgc;
|
int fCommandLineArgc;
|
||||||
const char** fCommandLineArgv;
|
const char** fCommandLineArgv;
|
||||||
|
bool fStopOnImageLoad;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -106,6 +106,8 @@ public:
|
|||||||
UserBreakpoint* breakpoint) = 0;
|
UserBreakpoint* breakpoint) = 0;
|
||||||
// TODO: Consolidate those!
|
// TODO: Consolidate those!
|
||||||
|
|
||||||
|
virtual void SetStopOnImageLoadRequested(bool enabled) = 0;
|
||||||
|
|
||||||
virtual void SetWatchpointRequested(target_addr_t address,
|
virtual void SetWatchpointRequested(target_addr_t address,
|
||||||
uint32 type, int32 length,
|
uint32 type, int32 length,
|
||||||
bool enabled) = 0;
|
bool enabled) = 0;
|
||||||
|
|||||||
@@ -60,10 +60,10 @@ enum {
|
|||||||
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MSG_CHOOSE_DEBUG_REPORT_LOCATION = 'ccrl',
|
MSG_CHOOSE_DEBUG_REPORT_LOCATION = 'ccrl',
|
||||||
MSG_DEBUG_REPORT_SAVED = 'drsa',
|
MSG_DEBUG_REPORT_SAVED = 'drsa',
|
||||||
MSG_LOCATE_SOURCE_IF_NEEDED = 'lsin',
|
MSG_LOCATE_SOURCE_IF_NEEDED = 'lsin',
|
||||||
MSG_CLEAR_STACK_TRACE = 'clst'
|
MSG_CLEAR_STACK_TRACE = 'clst'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -234,6 +234,16 @@ void
|
|||||||
TeamWindow::MessageReceived(BMessage* message)
|
TeamWindow::MessageReceived(BMessage* message)
|
||||||
{
|
{
|
||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
|
case MSG_STOP_ON_IMAGE_LOAD:
|
||||||
|
{
|
||||||
|
BMenuItem* item;
|
||||||
|
if (message->FindPointer("source", (void **)&item) != B_OK)
|
||||||
|
break;
|
||||||
|
bool enable = !item->IsMarked();
|
||||||
|
fListener->SetStopOnImageLoadRequested(enable);
|
||||||
|
item->SetMarked(enable);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case MSG_TEAM_RESTART_REQUESTED:
|
case MSG_TEAM_RESTART_REQUESTED:
|
||||||
{
|
{
|
||||||
fListener->TeamRestartRequested();
|
fListener->TeamRestartRequested();
|
||||||
@@ -965,6 +975,10 @@ TeamWindow::_Init()
|
|||||||
MSG_TEAM_RESTART_REQUESTED), 'R', B_SHIFT_KEY);
|
MSG_TEAM_RESTART_REQUESTED), 'R', B_SHIFT_KEY);
|
||||||
menu->AddItem(item);
|
menu->AddItem(item);
|
||||||
item->SetTarget(this);
|
item->SetTarget(this);
|
||||||
|
item = new BMenuItem("Stop on image load", new BMessage(
|
||||||
|
MSG_STOP_ON_IMAGE_LOAD));
|
||||||
|
item->SetTarget(this);
|
||||||
|
menu->AddItem(item);
|
||||||
item = new BMenuItem("Close", new BMessage(B_QUIT_REQUESTED),
|
item = new BMenuItem("Close", new BMessage(B_QUIT_REQUESTED),
|
||||||
'W');
|
'W');
|
||||||
menu->AddItem(item);
|
menu->AddItem(item);
|
||||||
|
|||||||
Reference in New Issue
Block a user