Debugger: Minor refactor.
TeamDebugger: - Rather than instantiating the DebuggerInterface directly, we now expect it to be given to us externally. This allows TeamDebugger to be agnostic of where the team actually resides. Debugger: - Create and initialize DebuggerInterface before passing it on to TeamDebugger. No functional change.
This commit is contained in:
parent
5632edebb4
commit
6bef41c6a9
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Copyright 2011-2015, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2011-2016, Rene Gollent, rene@gollent.com.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
#include "debug_utils.h"
|
||||
|
||||
#include "CommandLineUserInterface.h"
|
||||
#include "DebuggerInterface.h"
|
||||
#include "GraphicalUserInterface.h"
|
||||
#include "ImageDebugLoadingStateHandlerRoster.h"
|
||||
#include "MessageCodes.h"
|
||||
@ -310,12 +311,22 @@ start_team_debugger(team_id teamID, SettingsManager* settingsManager,
|
||||
userInterfaceReference.SetTo(userInterface, true);
|
||||
}
|
||||
|
||||
BReference<DebuggerInterface> interfaceReference;
|
||||
DebuggerInterface* debuggerInterface
|
||||
= new(std::nothrow) DebuggerInterface(teamID);
|
||||
if (debuggerInterface == NULL)
|
||||
return NULL;
|
||||
interfaceReference.SetTo(debuggerInterface, true);
|
||||
|
||||
if (debuggerInterface->Init() != B_OK)
|
||||
return NULL;
|
||||
|
||||
status_t error = B_NO_MEMORY;
|
||||
|
||||
TeamDebugger* debugger = new(std::nothrow) TeamDebugger(listener,
|
||||
userInterface, settingsManager);
|
||||
if (debugger) {
|
||||
error = debugger->Init(teamID, threadID, commandLineArgc,
|
||||
if (debugger != NULL) {
|
||||
error = debugger->Init(debuggerInterface, threadID, commandLineArgc,
|
||||
commandLineArgv, stopInMain);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Copyright 2010-2015, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2010-2016, Rene Gollent, rene@gollent.com.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
@ -321,7 +321,7 @@ TeamDebugger::~TeamDebugger()
|
||||
|
||||
|
||||
status_t
|
||||
TeamDebugger::Init(team_id teamID, thread_id threadID, int argc,
|
||||
TeamDebugger::Init(DebuggerInterface* interface, thread_id threadID, int argc,
|
||||
const char* const* argv, bool stopInMain)
|
||||
{
|
||||
bool targetIsLocal = true;
|
||||
@ -330,20 +330,14 @@ TeamDebugger::Init(team_id teamID, thread_id threadID, int argc,
|
||||
// the first thing we want to do when running
|
||||
PostMessage(MSG_LOAD_SETTINGS);
|
||||
|
||||
fTeamID = teamID;
|
||||
|
||||
status_t error = _HandleSetArguments(argc, argv);
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
// create debugger interface
|
||||
fDebuggerInterface = new(std::nothrow) DebuggerInterface(fTeamID);
|
||||
if (fDebuggerInterface == NULL)
|
||||
return B_NO_MEMORY;
|
||||
fDebuggerInterface = interface;
|
||||
fDebuggerInterface->AcquireReference();
|
||||
fTeamID = interface->TeamID();
|
||||
|
||||
error = fDebuggerInterface->Init();
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
// create file manager
|
||||
fFileManager = new(std::nothrow) FileManager;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Copyright 2013-2015, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2013-2016, Rene Gollent, rene@gollent.com.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef TEAM_DEBUGGER_H
|
||||
@ -42,8 +42,8 @@ public:
|
||||
SettingsManager* settingsManager);
|
||||
~TeamDebugger();
|
||||
|
||||
status_t Init(team_id teamID, thread_id threadID,
|
||||
int argc,
|
||||
status_t Init(DebuggerInterface* interface,
|
||||
thread_id threadID, int argc,
|
||||
const char* const* argv,
|
||||
bool stopInMain);
|
||||
|
||||
|
@ -41,6 +41,9 @@ public:
|
||||
bool Connected() const
|
||||
{ return fNubPort >= 0; }
|
||||
|
||||
team_id TeamID() const
|
||||
{ return fTeamID; }
|
||||
|
||||
Architecture* GetArchitecture() const
|
||||
{ return fArchitecture; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user