1 /* 2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef BREAKPOINT_H 6 #define BREAKPOINT_H 7 8 #include "UserBreakpoint.h" 9 10 11 class Image; 12 13 14 class BreakpointClient { 15 public: 16 virtual ~BreakpointClient(); 17 }; 18 19 20 class Breakpoint : public BReferenceable { 21 public: 22 Breakpoint(Image* image, target_addr_t address); 23 ~Breakpoint(); 24 25 Image* GetImage() const { return fImage; } 26 target_addr_t Address() const { return fAddress; } 27 28 bool IsInstalled() const { return fInstalled; } 29 void SetInstalled(bool installed); 30 31 bool ShouldBeInstalled() const; 32 bool IsUnused() const; 33 bool HasEnabledUserBreakpoint() const; 34 35 UserBreakpointInstance* FirstUserBreakpoint() const 36 { return fUserBreakpoints.Head(); } 37 UserBreakpointInstance* LastUserBreakpoint() const 38 { return fUserBreakpoints.Tail(); } 39 const UserBreakpointInstanceList& UserBreakpoints() const 40 { return fUserBreakpoints; } 41 42 void AddUserBreakpoint( 43 UserBreakpointInstance* instance); 44 void RemoveUserBreakpoint( 45 UserBreakpointInstance* instance); 46 47 bool AddClient(BreakpointClient* client); 48 void RemoveClient(BreakpointClient* client); 49 50 static int CompareBreakpoints(const Breakpoint* a, 51 const Breakpoint* b); 52 static int CompareAddressBreakpoint( 53 const target_addr_t* address, 54 const Breakpoint* breakpoint); 55 56 private: 57 typedef BObjectList<BreakpointClient> ClientList; 58 59 private: 60 target_addr_t fAddress; 61 Image* fImage; 62 UserBreakpointInstanceList fUserBreakpoints; 63 ClientList fClients; 64 bool fInstalled; 65 }; 66 67 68 #endif // BREAKPOINT_H 69