Debugger: Split into core library and application.
- Add subfolder src/kits/debugger which contains the debugger's core functionality and lower layers. Correspondingly add headers/private/debugger for shared headers to be used by clients such as the Debugger application and eventual remote_debug_server. Adjust various files to account for differences as a result of the split and moves. - Add libdebugger.so to minimal Jamfile.
This commit is contained in:
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
* Copyright 2016, Rene Gollent, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef TARGET_HOST_INTERFACE_H
|
||||
#define TARGET_HOST_INTERFACE_H
|
||||
|
||||
#include <OS.h>
|
||||
#include <Looper.h>
|
||||
|
||||
#include <ObjectList.h>
|
||||
|
||||
#include <util/DoublyLinkedList.h>
|
||||
|
||||
#include "controllers/TeamDebugger.h"
|
||||
|
||||
|
||||
class DebuggerInterface;
|
||||
class Settings;
|
||||
class SettingsManager;
|
||||
class TargetHost;
|
||||
struct TeamDebuggerOptions;
|
||||
class UserInterface;
|
||||
|
||||
|
||||
class TargetHostInterface : public BLooper, private TeamDebugger::Listener {
|
||||
public:
|
||||
class Listener;
|
||||
TargetHostInterface();
|
||||
virtual ~TargetHostInterface();
|
||||
|
||||
status_t StartTeamDebugger(const TeamDebuggerOptions& options);
|
||||
|
||||
int32 CountTeamDebuggers() const;
|
||||
TeamDebugger* TeamDebuggerAt(int32 index) const;
|
||||
TeamDebugger* FindTeamDebugger(team_id team) const;
|
||||
status_t AddTeamDebugger(TeamDebugger* debugger);
|
||||
void RemoveTeamDebugger(TeamDebugger* debugger);
|
||||
|
||||
virtual status_t Init(Settings* settings) = 0;
|
||||
virtual void Close() = 0;
|
||||
|
||||
virtual bool IsLocal() const = 0;
|
||||
virtual bool Connected() const = 0;
|
||||
|
||||
virtual TargetHost* GetTargetHost() = 0;
|
||||
|
||||
virtual status_t Attach(team_id id, thread_id threadID,
|
||||
DebuggerInterface*& _interface) const = 0;
|
||||
virtual status_t CreateTeam(int commandLineArgc,
|
||||
const char* const* arguments,
|
||||
team_id& _teamID) const = 0;
|
||||
virtual status_t LoadCore(const char* coreFilePath,
|
||||
DebuggerInterface*& _interface,
|
||||
thread_id& _thread) const = 0;
|
||||
|
||||
virtual status_t FindTeamByThread(thread_id thread,
|
||||
team_id& _teamID) const = 0;
|
||||
|
||||
|
||||
void AddListener(Listener* listener);
|
||||
void RemoveListener(Listener* listener);
|
||||
|
||||
// BLooper
|
||||
virtual void Quit();
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
|
||||
private:
|
||||
// TeamDebugger::Listener
|
||||
virtual void TeamDebuggerStarted(TeamDebugger* debugger);
|
||||
virtual void TeamDebuggerRestartRequested(
|
||||
TeamDebugger* debugger);
|
||||
virtual void TeamDebuggerQuit(TeamDebugger* debugger);
|
||||
|
||||
private:
|
||||
status_t _StartTeamDebugger(team_id teamID,
|
||||
const TeamDebuggerOptions& options,
|
||||
bool stopInMain);
|
||||
|
||||
void _NotifyTeamDebuggerStarted(
|
||||
TeamDebugger* debugger);
|
||||
void _NotifyTeamDebuggerQuit(
|
||||
TeamDebugger* debugger);
|
||||
|
||||
static int _CompareDebuggers(const TeamDebugger* a,
|
||||
const TeamDebugger* b);
|
||||
private:
|
||||
typedef DoublyLinkedList<Listener> ListenerList;
|
||||
typedef BObjectList<TeamDebugger> TeamDebuggerList;
|
||||
|
||||
private:
|
||||
ListenerList fListeners;
|
||||
TeamDebuggerList fTeamDebuggers;
|
||||
};
|
||||
|
||||
|
||||
class TargetHostInterface::Listener
|
||||
: public DoublyLinkedListLinkImpl<Listener> {
|
||||
public:
|
||||
virtual ~Listener();
|
||||
virtual void TeamDebuggerStarted(TeamDebugger* debugger);
|
||||
virtual void TeamDebuggerQuit(TeamDebugger* debugger);
|
||||
virtual void TargetHostInterfaceQuit(
|
||||
TargetHostInterface* interface);
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
TEAM_DEBUGGER_REQUEST_UNKNOWN = 0,
|
||||
TEAM_DEBUGGER_REQUEST_CREATE,
|
||||
TEAM_DEBUGGER_REQUEST_ATTACH,
|
||||
TEAM_DEBUGGER_REQUEST_LOAD_CORE
|
||||
};
|
||||
|
||||
|
||||
struct TeamDebuggerOptions {
|
||||
TeamDebuggerOptions();
|
||||
int requestType;
|
||||
int commandLineArgc;
|
||||
const char* const* commandLineArgv;
|
||||
team_id team;
|
||||
thread_id thread;
|
||||
SettingsManager* settingsManager;
|
||||
UserInterface* userInterface;
|
||||
const char* coreFilePath;
|
||||
};
|
||||
|
||||
|
||||
#endif // TARGET_HOST_INTERFACE_H
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2016, Rene Gollent, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef TARGET_HOST_INTERFACE_INFO_H
|
||||
#define TARGET_HOST_INTERFACE_INFO_H
|
||||
|
||||
#include <String.h>
|
||||
|
||||
#include <Referenceable.h>
|
||||
#include <util/DoublyLinkedList.h>
|
||||
|
||||
|
||||
class Settings;
|
||||
class SettingsDescription;
|
||||
class TargetHostInterface;
|
||||
|
||||
|
||||
class TargetHostInterfaceInfo : public BReferenceable {
|
||||
public:
|
||||
TargetHostInterfaceInfo(const BString& name);
|
||||
virtual ~TargetHostInterfaceInfo();
|
||||
|
||||
const BString& Name() const { return fName; }
|
||||
|
||||
virtual status_t Init() = 0;
|
||||
|
||||
virtual bool IsLocal() const = 0;
|
||||
virtual bool IsConfigured(Settings* settings) const = 0;
|
||||
virtual SettingsDescription* GetSettingsDescription() const = 0;
|
||||
|
||||
virtual status_t CreateInterface(Settings* settings,
|
||||
TargetHostInterface*& _interface) const
|
||||
= 0;
|
||||
|
||||
private:
|
||||
BString fName;
|
||||
};
|
||||
|
||||
#endif // TARGET_HOST_INTERFACE_INFO_H
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright 2016, Rene Gollent, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef TARGET_HOST_INTERFACE_ROSTER_H
|
||||
#define TARGET_HOST_INTERFACE_ROSTER_H
|
||||
|
||||
#include <OS.h>
|
||||
|
||||
#include <Locker.h>
|
||||
#include <ObjectList.h>
|
||||
|
||||
#include "TargetHostInterface.h"
|
||||
|
||||
|
||||
class Settings;
|
||||
class TargetHostInterfaceInfo;
|
||||
|
||||
|
||||
class TargetHostInterfaceRoster : private TargetHostInterface::Listener {
|
||||
public:
|
||||
class Listener;
|
||||
TargetHostInterfaceRoster();
|
||||
virtual ~TargetHostInterfaceRoster();
|
||||
|
||||
static TargetHostInterfaceRoster* Default();
|
||||
static status_t CreateDefault(Listener* listener);
|
||||
static void DeleteDefault();
|
||||
|
||||
bool Lock() { return fLock.Lock(); }
|
||||
void Unlock() { fLock.Unlock(); }
|
||||
|
||||
status_t Init(Listener* listener);
|
||||
status_t RegisterInterfaceInfos();
|
||||
|
||||
int32 CountInterfaceInfos() const;
|
||||
TargetHostInterfaceInfo*
|
||||
InterfaceInfoAt(int32 index) const;
|
||||
|
||||
status_t CreateInterface(TargetHostInterfaceInfo* info,
|
||||
Settings* settings,
|
||||
TargetHostInterface*& _interface);
|
||||
|
||||
int32 CountActiveInterfaces() const;
|
||||
TargetHostInterface* ActiveInterfaceAt(int32 index) const;
|
||||
|
||||
int32 CountRunningTeamDebuggers() const
|
||||
{ return fRunningTeamDebuggers; }
|
||||
|
||||
// TargetHostInterface::Listener
|
||||
virtual void TeamDebuggerStarted(TeamDebugger* debugger);
|
||||
virtual void TeamDebuggerQuit(TeamDebugger* debugger);
|
||||
virtual void TargetHostInterfaceQuit(
|
||||
TargetHostInterface* interface);
|
||||
|
||||
private:
|
||||
typedef BObjectList<TargetHostInterfaceInfo> InfoList;
|
||||
typedef BObjectList<TargetHostInterface> InterfaceList;
|
||||
|
||||
private:
|
||||
BLocker fLock;
|
||||
static TargetHostInterfaceRoster* sDefaultInstance;
|
||||
|
||||
int32 fRunningTeamDebuggers;
|
||||
InfoList fInterfaceInfos;
|
||||
InterfaceList fActiveInterfaces;
|
||||
Listener* fListener;
|
||||
};
|
||||
|
||||
|
||||
class TargetHostInterfaceRoster::Listener {
|
||||
public:
|
||||
virtual ~Listener();
|
||||
|
||||
virtual void TeamDebuggerCountChanged(int32 newCount);
|
||||
};
|
||||
|
||||
|
||||
#endif // TARGET_HOST_INTERFACE_ROSTER_H
|
||||
Reference in New Issue
Block a user