btrfs: [] on the end of a struct field is a variable length array.
[haiku.git] / headers / private / debugger / model / UserBreakpoint.h
blob84969b6f8b751c9e3c66b9d211e4f74bbd86ae78
1 /*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Copyright 2013-2014, Rene Gollent, rene@gollent.com.
4 * Distributed under the terms of the MIT License.
5 */
6 #ifndef USER_BREAKPOINT_H
7 #define USER_BREAKPOINT_H
10 #include <ObjectList.h>
11 #include <Referenceable.h>
12 #include <util/DoublyLinkedList.h>
14 #include "SourceLocation.h"
15 #include "String.h"
16 #include "Types.h"
19 class Breakpoint;
20 class Function;
21 class FunctionID;
22 class LocatableFile;
23 class UserBreakpoint;
26 class UserBreakpointLocation {
27 public:
28 UserBreakpointLocation(FunctionID* functionID,
29 LocatableFile* sourceFile,
30 const SourceLocation& sourceLocation,
31 target_addr_t relativeAddress);
32 UserBreakpointLocation(
33 const UserBreakpointLocation& other);
34 virtual ~UserBreakpointLocation();
36 FunctionID* GetFunctionID() const { return fFunctionID; }
37 LocatableFile* SourceFile() const { return fSourceFile; }
38 SourceLocation GetSourceLocation() const
39 { return fSourceLocation; }
40 target_addr_t RelativeAddress() const
41 { return fRelativeAddress; }
43 UserBreakpointLocation& operator=(
44 const UserBreakpointLocation& other);
46 private:
47 FunctionID* fFunctionID;
48 LocatableFile* fSourceFile;
49 SourceLocation fSourceLocation;
50 target_addr_t fRelativeAddress;
54 class UserBreakpointInstance
55 : public DoublyLinkedListLinkImpl<UserBreakpointInstance> {
56 public:
57 UserBreakpointInstance(
58 UserBreakpoint* userBreakpoint,
59 target_addr_t address);
61 UserBreakpoint* GetUserBreakpoint() const
62 { return fUserBreakpoint; }
63 target_addr_t Address() const { return fAddress; }
65 Breakpoint* GetBreakpoint() const { return fBreakpoint; }
66 void SetBreakpoint(Breakpoint* breakpoint);
68 private:
69 target_addr_t fAddress;
70 UserBreakpoint* fUserBreakpoint;
71 Breakpoint* fBreakpoint;
75 typedef DoublyLinkedList<UserBreakpointInstance> UserBreakpointInstanceList;
78 class UserBreakpoint : public BReferenceable,
79 public DoublyLinkedListLinkImpl<UserBreakpoint> {
80 public:
81 UserBreakpoint(
82 const UserBreakpointLocation& location);
83 ~UserBreakpoint();
85 const UserBreakpointLocation& Location() const { return fLocation; }
87 int32 CountInstances() const;
88 UserBreakpointInstance* InstanceAt(int32 index) const;
90 // Note: After known to the BreakpointManager, those can only be
91 // invoked with the breakpoint manager lock held.
92 bool AddInstance(UserBreakpointInstance* instance);
93 void RemoveInstance(
94 UserBreakpointInstance* instance);
95 UserBreakpointInstance* RemoveInstanceAt(int32 index);
97 bool IsValid() const { return fValid; }
98 void SetValid(bool valid);
99 // BreakpointManager only
101 bool IsEnabled() const { return fEnabled; }
102 void SetEnabled(bool enabled);
103 // BreakpointManager only
105 bool IsHidden() const { return fHidden; }
106 void SetHidden(bool hidden);
108 bool HasCondition() const
109 { return !fConditionExpression.IsEmpty(); }
110 const BString& Condition() const
111 { return fConditionExpression; }
112 void SetCondition(
113 const BString& conditionExpression);
115 private:
116 typedef BObjectList<UserBreakpointInstance> InstanceList;
118 private:
119 UserBreakpointLocation fLocation;
120 InstanceList fInstances;
121 bool fValid;
122 bool fEnabled;
123 bool fHidden;
124 BString fConditionExpression;
128 typedef DoublyLinkedList<UserBreakpoint> UserBreakpointList;
131 #endif // USER_BREAKPOINT_H