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 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.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -23,6 +23,7 @@
|
|||||||
#include "debug_utils.h"
|
#include "debug_utils.h"
|
||||||
|
|
||||||
#include "CommandLineUserInterface.h"
|
#include "CommandLineUserInterface.h"
|
||||||
|
#include "DebuggerInterface.h"
|
||||||
#include "GraphicalUserInterface.h"
|
#include "GraphicalUserInterface.h"
|
||||||
#include "ImageDebugLoadingStateHandlerRoster.h"
|
#include "ImageDebugLoadingStateHandlerRoster.h"
|
||||||
#include "MessageCodes.h"
|
#include "MessageCodes.h"
|
||||||
@ -310,12 +311,22 @@ start_team_debugger(team_id teamID, SettingsManager* settingsManager,
|
|||||||
userInterfaceReference.SetTo(userInterface, true);
|
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;
|
status_t error = B_NO_MEMORY;
|
||||||
|
|
||||||
TeamDebugger* debugger = new(std::nothrow) TeamDebugger(listener,
|
TeamDebugger* debugger = new(std::nothrow) TeamDebugger(listener,
|
||||||
userInterface, settingsManager);
|
userInterface, settingsManager);
|
||||||
if (debugger) {
|
if (debugger != NULL) {
|
||||||
error = debugger->Init(teamID, threadID, commandLineArgc,
|
error = debugger->Init(debuggerInterface, threadID, commandLineArgc,
|
||||||
commandLineArgv, stopInMain);
|
commandLineArgv, stopInMain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
|
* 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.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -321,7 +321,7 @@ TeamDebugger::~TeamDebugger()
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
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)
|
const char* const* argv, bool stopInMain)
|
||||||
{
|
{
|
||||||
bool targetIsLocal = true;
|
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
|
// the first thing we want to do when running
|
||||||
PostMessage(MSG_LOAD_SETTINGS);
|
PostMessage(MSG_LOAD_SETTINGS);
|
||||||
|
|
||||||
fTeamID = teamID;
|
|
||||||
|
|
||||||
status_t error = _HandleSetArguments(argc, argv);
|
status_t error = _HandleSetArguments(argc, argv);
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
// create debugger interface
|
fDebuggerInterface = interface;
|
||||||
fDebuggerInterface = new(std::nothrow) DebuggerInterface(fTeamID);
|
fDebuggerInterface->AcquireReference();
|
||||||
if (fDebuggerInterface == NULL)
|
fTeamID = interface->TeamID();
|
||||||
return B_NO_MEMORY;
|
|
||||||
|
|
||||||
error = fDebuggerInterface->Init();
|
|
||||||
if (error != B_OK)
|
|
||||||
return error;
|
|
||||||
|
|
||||||
// create file manager
|
// create file manager
|
||||||
fFileManager = new(std::nothrow) FileManager;
|
fFileManager = new(std::nothrow) FileManager;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
* 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.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef TEAM_DEBUGGER_H
|
#ifndef TEAM_DEBUGGER_H
|
||||||
@ -42,8 +42,8 @@ public:
|
|||||||
SettingsManager* settingsManager);
|
SettingsManager* settingsManager);
|
||||||
~TeamDebugger();
|
~TeamDebugger();
|
||||||
|
|
||||||
status_t Init(team_id teamID, thread_id threadID,
|
status_t Init(DebuggerInterface* interface,
|
||||||
int argc,
|
thread_id threadID, int argc,
|
||||||
const char* const* argv,
|
const char* const* argv,
|
||||||
bool stopInMain);
|
bool stopInMain);
|
||||||
|
|
||||||
|
@ -41,6 +41,9 @@ public:
|
|||||||
bool Connected() const
|
bool Connected() const
|
||||||
{ return fNubPort >= 0; }
|
{ return fNubPort >= 0; }
|
||||||
|
|
||||||
|
team_id TeamID() const
|
||||||
|
{ return fTeamID; }
|
||||||
|
|
||||||
Architecture* GetArchitecture() const
|
Architecture* GetArchitecture() const
|
||||||
{ return fArchitecture; }
|
{ return fArchitecture; }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user