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:
Rene Gollent
2016-04-02 15:05:19 -04:00
parent 5632edebb4
commit 6bef41c6a9
4 changed files with 25 additions and 17 deletions
+5 -11
View File
@@ -1,6 +1,6 @@
/*
* Copyright 2009-2012, Ingo Weinhold, [email protected].
* Copyright 2010-2015, Rene Gollent, [email protected].
* Copyright 2010-2016, Rene Gollent, [email protected].
* 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;