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.
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"
26 class UserBreakpointLocation
{
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
);
47 FunctionID
* fFunctionID
;
48 LocatableFile
* fSourceFile
;
49 SourceLocation fSourceLocation
;
50 target_addr_t fRelativeAddress
;
54 class UserBreakpointInstance
55 : public DoublyLinkedListLinkImpl
<UserBreakpointInstance
> {
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
);
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
> {
82 const UserBreakpointLocation
& location
);
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
);
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
; }
113 const BString
& conditionExpression
);
116 typedef BObjectList
<UserBreakpointInstance
> InstanceList
;
119 UserBreakpointLocation fLocation
;
120 InstanceList fInstances
;
124 BString fConditionExpression
;
128 typedef DoublyLinkedList
<UserBreakpoint
> UserBreakpointList
;
131 #endif // USER_BREAKPOINT_H