xref: /haiku/headers/private/debugger/model/Watchpoint.h (revision 385ee03ba83b7a40d315e17b03031b3ca37820c0)
1 /*
2  * Copyright 2012, Rene Gollent, rene@gollent.com.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef WATCHPOINT_H
6 #define WATCHPOINT_H
7 
8 
9 #include <ObjectList.h>
10 #include <Referenceable.h>
11 
12 #include "types/Types.h"
13 
14 
15 class Watchpoint : public BReferenceable {
16 public:
17 								Watchpoint(target_addr_t address, uint32 type,
18 									int32 length);
19 								~Watchpoint();
20 
21 			target_addr_t		Address() const		{ return fAddress; }
22 			uint32				Type() const		{ return fType; }
23 			int32				Length() const	{ return fLength; }
24 
25 			bool				IsInstalled() const	{ return fInstalled; }
26 			void				SetInstalled(bool installed);
27 
28 			bool				IsEnabled() const	{ return fEnabled; }
29 			void				SetEnabled(bool enabled);
30 									// WatchpointManager only
31 
32 			bool				ShouldBeInstalled() const
33 									{ return fEnabled && !fInstalled; }
34 
35 			bool				Contains(target_addr_t address) const;
36 
37 	static	int					CompareWatchpoints(const Watchpoint* a,
38 									const Watchpoint* b);
39 	static	int					CompareAddressWatchpoint(
40 									const target_addr_t* address,
41 									const Watchpoint* watchpoint);
42 
43 private:
44 			target_addr_t		fAddress;
45 			uint32				fType;
46 			int32				fLength;
47 
48 			bool				fInstalled;
49 			bool				fEnabled;
50 };
51 
52 
53 typedef BObjectList<Watchpoint> WatchpointList;
54 
55 
56 #endif	// WATCHPOINT_H
57