1/*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef BREAKPOINT_MANAGER_H
6#define BREAKPOINT_MANAGER_H
7
8#include <Locker.h>
9
10#include "Breakpoint.h"
11
12
13class DebuggerInterface;
14class Team;
15
16
17class BreakpointManager {
18public:
19								BreakpointManager(Team* team,
20									DebuggerInterface* debuggerInterface);
21								~BreakpointManager();
22
23			status_t			Init();
24
25			status_t			InstallUserBreakpoint(
26									UserBreakpoint* userBreakpoint,
27									bool enabled);
28			void				UninstallUserBreakpoint(
29									UserBreakpoint* userBreakpoint);
30
31			status_t			InstallTemporaryBreakpoint(
32									target_addr_t address,
33									BreakpointClient* client);
34			void				UninstallTemporaryBreakpoint(
35									target_addr_t address,
36									BreakpointClient* client);
37
38			void				UpdateImageBreakpoints(Image* image);
39			void				RemoveImageBreakpoints(Image* image);
40
41private:
42			void				_UpdateImageBreakpoints(Image* image,
43									bool removeOnly);
44			status_t			_UpdateBreakpointInstallation(
45									Breakpoint* breakpoint);
46										// fLock must be held
47
48private:
49			BLocker				fLock;	// used to synchronize un-/installing
50			Team*				fTeam;
51			DebuggerInterface*	fDebuggerInterface;
52};
53
54
55#endif	// BREAKPOINT_MANAGER_H
56