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