Debugger: add support for executable file refs
Adds support for handling executable files in the Debugger::RefsReceived function. This change * makes Deskbar menu->Recent Applications->Debugger->A recently opened executable open the executable instead of simply opening the Teams window, and * allows dragging and dropping an executable onto the application's icon. Change-Id: I8e70e7929188301ce976f1f14e885236d3cb2b0a Reviewed-on: https://review.haiku-os.org/c/haiku/+/6299 Reviewed-by: Rene Gollent <[email protected]> Tested-by: Automation <[email protected]>
This commit is contained in:
@@ -254,6 +254,7 @@ private:
|
||||
virtual void TeamDebuggerCountChanged(int32 count);
|
||||
|
||||
private:
|
||||
status_t _ShowStartTeamWindow(TargetHostInterface* interface);
|
||||
status_t _StartNewTeam(TargetHostInterface* interface,
|
||||
const char* teamPath, const char* args);
|
||||
status_t _HandleOptions(const Options& options);
|
||||
@@ -371,19 +372,13 @@ Debugger::MessageReceived(BMessage* message)
|
||||
->ActiveInterfaceAt(0);
|
||||
}
|
||||
|
||||
BMessenger messenger(fStartTeamWindow);
|
||||
if (!messenger.IsValid()) {
|
||||
fStartTeamWindow = StartTeamWindow::Create(hostInterface);
|
||||
if (fStartTeamWindow == NULL)
|
||||
break;
|
||||
fStartTeamWindow->Show();
|
||||
} else
|
||||
fStartTeamWindow->Activate();
|
||||
_ShowStartTeamWindow(hostInterface);
|
||||
break;
|
||||
}
|
||||
case MSG_START_TEAM_WINDOW_CLOSED:
|
||||
{
|
||||
fStartTeamWindow = NULL;
|
||||
Quit();
|
||||
break;
|
||||
}
|
||||
case MSG_SHOW_CONNECTION_CONFIG_WINDOW:
|
||||
@@ -489,7 +484,7 @@ Debugger::ReadyToRun()
|
||||
{
|
||||
TargetHostInterfaceRoster* roster = TargetHostInterfaceRoster::Default();
|
||||
AutoLocker<TargetHostInterfaceRoster> lock(roster);
|
||||
if (roster->CountRunningTeamDebuggers() == 0)
|
||||
if (roster->CountRunningTeamDebuggers() == 0 && fStartTeamWindow == NULL)
|
||||
PostMessage(MSG_SHOW_TEAMS_WINDOW);
|
||||
}
|
||||
|
||||
@@ -517,17 +512,35 @@ Debugger::RefsReceived(BMessage* message)
|
||||
if (path.SetTo(&ref) != B_OK)
|
||||
continue;
|
||||
|
||||
// check, whether this is a core file
|
||||
{
|
||||
ElfFile elfFile;
|
||||
if (elfFile.Init(path.Path()) != B_OK || elfFile.Type() != ET_CORE)
|
||||
continue;
|
||||
}
|
||||
ElfFile elfFile;
|
||||
if (elfFile.Init(path.Path()) != B_OK)
|
||||
continue;
|
||||
|
||||
// handle the core file
|
||||
Options options;
|
||||
options.coreFilePath = path.Path();
|
||||
_HandleOptions(options);
|
||||
switch (elfFile.Type()) {
|
||||
case ET_CORE:
|
||||
{
|
||||
// open the core file
|
||||
Options options;
|
||||
options.coreFilePath = path.Path();
|
||||
_HandleOptions(options);
|
||||
break;
|
||||
}
|
||||
case ET_EXEC:
|
||||
case ET_DYN:
|
||||
{
|
||||
// ask the user for arguments to pass to the executable
|
||||
TargetHostInterface* hostInterface = TargetHostInterfaceRoster::Default()
|
||||
->ActiveInterfaceAt(0);
|
||||
status_t error = _ShowStartTeamWindow(hostInterface);
|
||||
if (error != B_OK)
|
||||
continue;
|
||||
|
||||
BMessage message(MSG_SET_TEAM_PATH);
|
||||
message.AddRef("refs", &ref);
|
||||
fStartTeamWindow->PostMessage(&message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -570,6 +583,23 @@ Debugger::TeamDebuggerCountChanged(int32 count)
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
Debugger::_ShowStartTeamWindow(TargetHostInterface* interface)
|
||||
{
|
||||
if (fStartTeamWindow == NULL) {
|
||||
TargetHostInterface* hostInterface = TargetHostInterfaceRoster::Default()
|
||||
->ActiveInterfaceAt(0);
|
||||
fStartTeamWindow = StartTeamWindow::Create(hostInterface);
|
||||
if (fStartTeamWindow == NULL)
|
||||
return B_NO_MEMORY;
|
||||
fStartTeamWindow->Show();
|
||||
} else
|
||||
fStartTeamWindow->Activate();
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
Debugger::_StartNewTeam(TargetHostInterface* interface, const char* path,
|
||||
const char* args)
|
||||
|
||||
@@ -4,6 +4,7 @@ resource(1, "BEOS:APP_SIG") #'MIMS' "application/x-vnd.Haiku-Debugger";
|
||||
resource app_name_catalog_entry "x-vnd.Haiku-Debugger:System name:Debugger";
|
||||
|
||||
resource file_types message {
|
||||
"types" = "application/x-vnd.Be-elfexecutable",
|
||||
"types" = "application/x-vnd.haiku-core-file"
|
||||
};
|
||||
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
|
||||
|
||||
enum {
|
||||
MSG_BROWSE_TEAM = 'brte',
|
||||
MSG_SET_TEAM_PATH = 'setp'
|
||||
MSG_BROWSE_TEAM = 'brte'
|
||||
};
|
||||
|
||||
|
||||
@@ -161,7 +160,6 @@ StartTeamWindow::MessageReceived(BMessage* message)
|
||||
if (alert != NULL)
|
||||
alert->Go();
|
||||
} else {
|
||||
be_app->PostMessage(MSG_START_TEAM_WINDOW_CLOSED);
|
||||
PostMessage(B_QUIT_REQUESTED);
|
||||
}
|
||||
break;
|
||||
@@ -172,3 +170,11 @@ StartTeamWindow::MessageReceived(BMessage* message)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
StartTeamWindow::QuitRequested()
|
||||
{
|
||||
be_app->PostMessage(MSG_START_TEAM_WINDOW_CLOSED);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,11 @@ class BTextControl;
|
||||
class TargetHostInterface;
|
||||
|
||||
|
||||
enum {
|
||||
MSG_SET_TEAM_PATH = 'setp'
|
||||
};
|
||||
|
||||
|
||||
class StartTeamWindow : public BWindow
|
||||
{
|
||||
public:
|
||||
@@ -29,6 +34,7 @@ public:
|
||||
|
||||
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual bool QuitRequested();
|
||||
|
||||
virtual void Show();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user