vfs: check userland buffers before reading them.
[haiku.git] / headers / private / debugger / model / Breakpoint.h
blob2e80bff30ad6bf9e02341d4aad4c323bd28d07f7
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
8 #include "UserBreakpoint.h"
11 class Image;
14 class BreakpointClient {
15 public:
16 virtual ~BreakpointClient();
20 class Breakpoint : public BReferenceable {
21 public:
22 Breakpoint(Image* image, target_addr_t address);
23 ~Breakpoint();
25 Image* GetImage() const { return fImage; }
26 target_addr_t Address() const { return fAddress; }
28 bool IsInstalled() const { return fInstalled; }
29 void SetInstalled(bool installed);
31 bool ShouldBeInstalled() const;
32 bool IsUnused() const;
33 bool HasEnabledUserBreakpoint() const;
35 UserBreakpointInstance* FirstUserBreakpoint() const
36 { return fUserBreakpoints.Head(); }
37 UserBreakpointInstance* LastUserBreakpoint() const
38 { return fUserBreakpoints.Tail(); }
39 const UserBreakpointInstanceList& UserBreakpoints() const
40 { return fUserBreakpoints; }
42 void AddUserBreakpoint(
43 UserBreakpointInstance* instance);
44 void RemoveUserBreakpoint(
45 UserBreakpointInstance* instance);
47 bool AddClient(BreakpointClient* client);
48 void RemoveClient(BreakpointClient* client);
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);
56 private:
57 typedef BObjectList<BreakpointClient> ClientList;
59 private:
60 target_addr_t fAddress;
61 Image* fImage;
62 UserBreakpointInstanceList fUserBreakpoints;
63 ClientList fClients;
64 bool fInstalled;
68 #endif // BREAKPOINT_H