53446ebf80
* BDebugMessageHandler: Interface with hooks for handling of debug messages. * BDebugContext: Essentially a C++ wrapper for struct debug_context, with handy methods for controlling a debugged team. * BTeamDebugger: Proxy for a debugged team. Derived from BDebugContext. * BDebugLooper: Wraps a main debug message loop. Any number of BTeamDebuggers can be added and associated with BDebugMessageHandlers. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35953 a95241bf-73f2-0310-859d-f6bbb57e9c96
66 lines
1.2 KiB
C++
66 lines
1.2 KiB
C++
/*
|
|
* Copyright 2010, Ingo Weinhold, ingo_weinhold@gmx.de.
|
|
* Distributed under the terms of the MIT License.
|
|
*/
|
|
#ifndef _DEBUG_LOOPER_H
|
|
#define _DEBUG_LOOPER_H
|
|
|
|
|
|
#include <Locker.h>
|
|
|
|
#include <ObjectList.h>
|
|
|
|
|
|
class BDebugMessageHandler;
|
|
class BTeamDebugger;
|
|
|
|
|
|
class BDebugLooper {
|
|
public:
|
|
BDebugLooper();
|
|
virtual ~BDebugLooper();
|
|
|
|
status_t Init();
|
|
|
|
thread_id Run(bool spawnThread);
|
|
void Quit();
|
|
|
|
status_t AddTeamDebugger(BTeamDebugger* debugger,
|
|
BDebugMessageHandler* handler);
|
|
bool RemoveTeamDebugger(BTeamDebugger* debugger);
|
|
bool RemoveTeamDebugger(team_id team);
|
|
|
|
private:
|
|
struct Debugger;
|
|
|
|
struct Job;
|
|
struct JobList;
|
|
struct AddDebuggerJob;
|
|
struct RemoveDebuggerJob;
|
|
|
|
friend struct AddDebuggerJob;
|
|
friend struct RemoveDebuggerJob;
|
|
|
|
typedef BObjectList<Debugger> DebuggerList;
|
|
|
|
private:
|
|
static status_t _MessageLoopEntry(void* data);
|
|
status_t _MessageLoop();
|
|
|
|
status_t _DoJob(Job* job);
|
|
void _Notify();
|
|
|
|
private:
|
|
BLocker fLock;
|
|
thread_id fThread;
|
|
bool fOwnsThread;
|
|
bool fTerminating;
|
|
bool fNotified;
|
|
JobList* fJobs;
|
|
sem_id fEventSemaphore;
|
|
DebuggerList fDebuggers;
|
|
};
|
|
|
|
|
|
#endif // _DEBUG_LOOPER_H
|