aboutsummaryrefslogtreecommitdiff
path: root/lldb/include/lldb/API/SBBreakpoint.h
blob: e13dbc5c35168a020de19d8cf777a63b7d35838d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
//===-- SBBreakpoint.h ------------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLDB_API_SBBREAKPOINT_H
#define LLDB_API_SBBREAKPOINT_H

#include "lldb/API/SBDefines.h"

class SBBreakpointListImpl;

namespace lldb {

class LLDB_API SBBreakpoint {
public:

  SBBreakpoint();

  SBBreakpoint(const lldb::SBBreakpoint &rhs);

  SBBreakpoint(const lldb::BreakpointSP &bp_sp);

  ~SBBreakpoint();

  const lldb::SBBreakpoint &operator=(const lldb::SBBreakpoint &rhs);

  // Tests to see if the opaque breakpoint object in this object matches the
  // opaque breakpoint object in "rhs".
  bool operator==(const lldb::SBBreakpoint &rhs);

  bool operator!=(const lldb::SBBreakpoint &rhs);

  break_id_t GetID() const;

  explicit operator bool() const;

  bool IsValid() const;

  void ClearAllBreakpointSites();

  lldb::SBTarget GetTarget() const;

  lldb::SBBreakpointLocation FindLocationByAddress(lldb::addr_t vm_addr);

  lldb::break_id_t FindLocationIDByAddress(lldb::addr_t vm_addr);

  lldb::SBBreakpointLocation FindLocationByID(lldb::break_id_t bp_loc_id);

  lldb::SBBreakpointLocation GetLocationAtIndex(uint32_t index);

  void SetEnabled(bool enable);

  bool IsEnabled();

  void SetOneShot(bool one_shot);

  bool IsOneShot() const;

  bool IsInternal();

  uint32_t GetHitCount() const;

  void SetIgnoreCount(uint32_t count);

  uint32_t GetIgnoreCount() const;

  void SetCondition(const char *condition);

  const char *GetCondition();

  void SetAutoContinue(bool auto_continue);

  bool GetAutoContinue();

  void SetThreadID(lldb::tid_t sb_thread_id);

  lldb::tid_t GetThreadID();

  void SetThreadIndex(uint32_t index);

  uint32_t GetThreadIndex() const;

  void SetThreadName(const char *thread_name);

  const char *GetThreadName() const;

  void SetQueueName(const char *queue_name);

  const char *GetQueueName() const;

  void SetCallback(SBBreakpointHitCallback callback, void *baton);

  void SetScriptCallbackFunction(const char *callback_function_name);

  SBError SetScriptCallbackFunction(const char *callback_function_name,
                                 SBStructuredData &extra_args);

  void SetCommandLineCommands(SBStringList &commands);

  bool GetCommandLineCommands(SBStringList &commands);

  SBError SetScriptCallbackBody(const char *script_body_text);

  bool AddName(const char *new_name);

  SBError AddNameWithErrorHandling(const char *new_name);

  void RemoveName(const char *name_to_remove);

  bool MatchesName(const char *name);

  void GetNames(SBStringList &names);

  size_t GetNumResolvedLocations() const;

  size_t GetNumLocations() const;

  bool GetDescription(lldb::SBStream &description);

  bool GetDescription(lldb::SBStream &description, bool include_locations);

  static bool EventIsBreakpointEvent(const lldb::SBEvent &event);

  static lldb::BreakpointEventType
  GetBreakpointEventTypeFromEvent(const lldb::SBEvent &event);

  static lldb::SBBreakpoint GetBreakpointFromEvent(const lldb::SBEvent &event);

  static lldb::SBBreakpointLocation
  GetBreakpointLocationAtIndexFromEvent(const lldb::SBEvent &event,
                                        uint32_t loc_idx);

  static uint32_t
  GetNumBreakpointLocationsFromEvent(const lldb::SBEvent &event_sp);

  bool IsHardware() const;

  // Can only be called from a ScriptedBreakpointResolver...
  SBError
  AddLocation(SBAddress &address);

  SBStructuredData SerializeToStructuredData();

private:
  friend class SBBreakpointList;
  friend class SBBreakpointLocation;
  friend class SBBreakpointName;
  friend class SBTarget;

  lldb::BreakpointSP GetSP() const;

  lldb::BreakpointWP m_opaque_wp;
};

class LLDB_API SBBreakpointList {
public:
  SBBreakpointList(SBTarget &target);

  ~SBBreakpointList();

  size_t GetSize() const;

  SBBreakpoint GetBreakpointAtIndex(size_t idx);

  SBBreakpoint FindBreakpointByID(lldb::break_id_t);

  void Append(const SBBreakpoint &sb_bkpt);

  bool AppendIfUnique(const SBBreakpoint &sb_bkpt);

  void AppendByID(lldb::break_id_t id);

  void Clear();

protected:
  friend class SBTarget;

  void CopyToBreakpointIDList(lldb_private::BreakpointIDList &bp_id_list);

private:
  std::shared_ptr<SBBreakpointListImpl> m_opaque_sp;
};

} // namespace lldb

#endif // LLDB_API_SBBREAKPOINT_H