Skip to content

Commit

Permalink
Debugger: Implement part of #12729.
Browse files Browse the repository at this point in the history
TeamsWindow:
- Add a button allowing one to specify loading a core file in addition
  to attaching to/creating teams.
- Slight layout tweak.
  • Loading branch information
anevilyak committed Apr 26, 2016
1 parent 6d5951d commit 63a0065
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 2 deletions.
21 changes: 21 additions & 0 deletions src/apps/debugger/Debugger.cpp
Expand Up @@ -444,6 +444,27 @@ Debugger::MessageReceived(BMessage* message)
message->SendReply(&reply);
break;
}
case MSG_LOAD_CORE_TEAM:
{
TargetHostInterface* interface;
if (message->FindPointer("interface", reinterpret_cast<void**>(
&interface)) != B_OK) {
break;
}

entry_ref ref;
if (message->FindRef("core", &ref) != B_OK)
break;

BPath path(&ref);
if (path.InitCheck() != B_OK)
break;

Options options;
options.coreFilePath = path.Path();
_HandleOptions(options);
break;
}
default:
BApplication::MessageReceived(message);
break;
Expand Down
1 change: 1 addition & 0 deletions src/apps/debugger/MessageCodes.h
Expand Up @@ -76,6 +76,7 @@ enum {
MSG_START_TEAM_WINDOW_CLOSED = 'stwc',
MSG_START_NEW_TEAM = 'sttt',
MSG_DEBUG_THIS_TEAM = 'dbtt',
MSG_LOAD_CORE_TEAM = 'lcte',
MSG_SHOW_INSPECTOR_WINDOW = 'sirw',
MSG_INSPECTOR_WINDOW_CLOSED = 'irwc',
MSG_SHOW_EXPRESSION_WINDOW = 'seww',
Expand Down
45 changes: 43 additions & 2 deletions src/apps/debugger/user_interface/gui/teams_window/TeamsWindow.cpp
Expand Up @@ -15,6 +15,7 @@
#include <Application.h>
#include <Button.h>
#include <File.h>
#include <FilePanel.h>
#include <FindDirectory.h>
#include <LayoutBuilder.h>
#include <ListView.h>
Expand All @@ -30,7 +31,8 @@


enum {
MSG_TEAM_SELECTION_CHANGED = 'tesc'
MSG_TEAM_SELECTION_CHANGED = 'tesc',
MSG_CHOSE_CORE_FILE = 'chcf'
};


Expand All @@ -42,6 +44,8 @@ TeamsWindow::TeamsWindow(SettingsManager* settingsManager)
fTeamsListView(NULL),
fAttachTeamButton(NULL),
fCreateTeamButton(NULL),
fLoadCoreButton(NULL),
fCoreSelectionPanel(NULL),
fSettingsManager(settingsManager)
{
team_info info;
Expand Down Expand Up @@ -128,6 +132,39 @@ TeamsWindow::MessageReceived(BMessage* message)
break;
}

case MSG_CHOSE_CORE_FILE:
case B_CANCEL:
{
delete fCoreSelectionPanel;
fCoreSelectionPanel = NULL;
if (message->what == B_CANCEL)
break;

entry_ref ref;
if (message->FindRef("refs", &ref) != B_OK)
break;

BMessage coreMessage(MSG_LOAD_CORE_TEAM);
coreMessage.AddPointer("interface", fTargetHostInterface);
coreMessage.AddRef("core", &ref);
be_app_messenger.SendMessage(&coreMessage);
break;
}

case MSG_LOAD_CORE_TEAM:
{
try {
BMessenger messenger(this);
fCoreSelectionPanel = new BFilePanel(B_OPEN_PANEL, &messenger,
NULL, 0, false, new BMessage(MSG_CHOSE_CORE_FILE));
fCoreSelectionPanel->Show();
} catch (...) {
delete fCoreSelectionPanel;
fCoreSelectionPanel = NULL;
}
break;
}

default:
BWindow::MessageReceived(message);
break;
Expand Down Expand Up @@ -166,13 +203,16 @@ TeamsWindow::_Init()
BLayoutBuilder::Group<>(this, B_VERTICAL)
.Add(fTeamsListView = new TeamsListView("TeamsList", fCurrentTeam,
fTargetHostInterface))
.SetInsets(1.0f, 1.0f, 1.0f, 1.0f)
.SetInsets(1.0f, 1.0f, 1.0f, 5.0f)
.AddGroup(B_HORIZONTAL)
.SetInsets(B_USE_DEFAULT_SPACING)
.Add(fAttachTeamButton = new BButton("Attach", new BMessage(
MSG_DEBUG_THIS_TEAM)))
.AddGlue()
.Add(fCreateTeamButton = new BButton("Start new team"
B_UTF8_ELLIPSIS, new BMessage(MSG_SHOW_START_TEAM_WINDOW)))
.Add(fLoadCoreButton = new BButton("Load core" B_UTF8_ELLIPSIS,
new BMessage(MSG_LOAD_CORE_TEAM)))
.End()
.End();

Expand All @@ -182,6 +222,7 @@ TeamsWindow::_Init()

fAttachTeamButton->SetEnabled(false);
fCreateTeamButton->SetTarget(this);
fLoadCoreButton->SetTarget(this);
}


Expand Down
Expand Up @@ -12,6 +12,7 @@
class BButton;
class BListView;
class BFile;
class BFilePanel;
class BMessage;
class SettingsManager;
class TargetHostInterface;
Expand Down Expand Up @@ -41,6 +42,8 @@ class TeamsWindow : public BWindow {
TeamsListView* fTeamsListView;
BButton* fAttachTeamButton;
BButton* fCreateTeamButton;
BButton* fLoadCoreButton;
BFilePanel* fCoreSelectionPanel;
SettingsManager* fSettingsManager;

};
Expand Down

0 comments on commit 63a0065

Please sign in to comment.