Coverage Report

Created: 2022-01-22 13:19

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/include/lldb/Breakpoint/Breakpoint.h
Line
Count
Source (jump to first uncovered line)
1
//===-- Breakpoint.h --------------------------------------------*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#ifndef LLDB_BREAKPOINT_BREAKPOINT_H
10
#define LLDB_BREAKPOINT_BREAKPOINT_H
11
12
#include <memory>
13
#include <string>
14
#include <unordered_set>
15
#include <vector>
16
17
#include "lldb/Breakpoint/BreakpointID.h"
18
#include "lldb/Breakpoint/BreakpointLocationCollection.h"
19
#include "lldb/Breakpoint/BreakpointLocationList.h"
20
#include "lldb/Breakpoint/BreakpointName.h"
21
#include "lldb/Breakpoint/BreakpointOptions.h"
22
#include "lldb/Breakpoint/Stoppoint.h"
23
#include "lldb/Breakpoint/StoppointHitCounter.h"
24
#include "lldb/Core/SearchFilter.h"
25
#include "lldb/Target/Statistics.h"
26
#include "lldb/Utility/Event.h"
27
#include "lldb/Utility/StringList.h"
28
#include "lldb/Utility/StructuredData.h"
29
30
namespace lldb_private {
31
32
/// \class Breakpoint Breakpoint.h "lldb/Breakpoint/Breakpoint.h" Class that
33
/// manages logical breakpoint setting.
34
35
/// General Outline:
36
/// A breakpoint has four main parts, a filter, a resolver, the list of
37
/// breakpoint
38
/// locations that have been determined for the filter/resolver pair, and
39
/// finally a set of options for the breakpoint.
40
///
41
/// \b Filter:
42
/// This is an object derived from SearchFilter.  It manages the search for
43
/// breakpoint location matches through the symbols in the module list of the
44
/// target that owns it.  It also filters out locations based on whatever
45
/// logic it wants.
46
///
47
/// \b Resolver:
48
/// This is an object derived from BreakpointResolver.  It provides a callback
49
/// to the filter that will find breakpoint locations.  How it does this is
50
/// determined by what kind of resolver it is.
51
///
52
/// The Breakpoint class also provides constructors for the common breakpoint
53
/// cases which make the appropriate filter and resolver for you.
54
///
55
/// \b Location List:
56
/// This stores the breakpoint locations that have been determined to date.
57
/// For a given breakpoint, there will be only one location with a given
58
/// address.  Adding a location at an already taken address will just return
59
/// the location already at that address.  Locations can be looked up by ID,
60
/// or by address.
61
///
62
/// \b Options:
63
/// This includes:
64
///    \b Enabled/Disabled
65
///    \b Ignore Count
66
///    \b Callback
67
///    \b Condition
68
/// Note, these options can be set on the breakpoint, and they can also be set
69
/// on the individual locations.  The options set on the breakpoint take
70
/// precedence over the options set on the individual location. So for
71
/// instance disabling the breakpoint will cause NONE of the locations to get
72
/// hit. But if the breakpoint is enabled, then the location's enabled state
73
/// will be checked to determine whether to insert that breakpoint location.
74
/// Similarly, if the breakpoint condition says "stop", we won't check the
75
/// location's condition. But if the breakpoint condition says "continue",
76
/// then we will check the location for whether to actually stop or not. One
77
/// subtle point worth observing here is that you don't actually stop at a
78
/// Breakpoint, you always stop at one of its locations.  So the "should stop"
79
/// tests are done by the location, not by the breakpoint.
80
class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
81
                   public Stoppoint {
82
public:
83
  static ConstString GetEventIdentifier();
84
85
  /// An enum specifying the match style for breakpoint settings.  At present
86
  /// only used for function name style breakpoints.
87
  enum MatchType { Exact, Regexp, Glob };
88
89
private:
90
  enum class OptionNames : uint32_t { Names = 0, Hardware, LastOptionName };
91
92
  static const char
93
      *g_option_names[static_cast<uint32_t>(OptionNames::LastOptionName)];
94
95
93
  static const char *GetKey(OptionNames enum_value) {
96
93
    return g_option_names[static_cast<uint32_t>(enum_value)];
97
93
  }
98
99
public:
100
  class BreakpointEventData : public EventData {
101
  public:
102
    BreakpointEventData(lldb::BreakpointEventType sub_type,
103
                        const lldb::BreakpointSP &new_breakpoint_sp);
104
105
    ~BreakpointEventData() override;
106
107
    static ConstString GetFlavorString();
108
109
    ConstString GetFlavor() const override;
110
111
    lldb::BreakpointEventType GetBreakpointEventType() const;
112
113
    lldb::BreakpointSP &GetBreakpoint();
114
115
25.8k
    BreakpointLocationCollection &GetBreakpointLocationCollection() {
116
25.8k
      return m_locations;
117
25.8k
    }
118
119
    void Dump(Stream *s) const override;
120
121
    static lldb::BreakpointEventType
122
    GetBreakpointEventTypeFromEvent(const lldb::EventSP &event_sp);
123
124
    static lldb::BreakpointSP
125
    GetBreakpointFromEvent(const lldb::EventSP &event_sp);
126
127
    static lldb::BreakpointLocationSP
128
    GetBreakpointLocationAtIndexFromEvent(const lldb::EventSP &event_sp,
129
                                          uint32_t loc_idx);
130
131
    static size_t
132
    GetNumBreakpointLocationsFromEvent(const lldb::EventSP &event_sp);
133
134
    static const BreakpointEventData *
135
    GetEventDataFromEvent(const Event *event_sp);
136
137
  private:
138
    lldb::BreakpointEventType m_breakpoint_event;
139
    lldb::BreakpointSP m_new_breakpoint_sp;
140
    BreakpointLocationCollection m_locations;
141
142
    BreakpointEventData(const BreakpointEventData &) = delete;
143
    const BreakpointEventData &operator=(const BreakpointEventData &) = delete;
144
  };
145
146
  // Saving & restoring breakpoints:
147
  static lldb::BreakpointSP CreateFromStructuredData(
148
      lldb::TargetSP target_sp, StructuredData::ObjectSP &data_object_sp,
149
      Status &error);
150
151
  static bool
152
  SerializedBreakpointMatchesNames(StructuredData::ObjectSP &bkpt_object_sp,
153
                                   std::vector<std::string> &names);
154
155
  virtual StructuredData::ObjectSP SerializeToStructuredData();
156
157
69
  static const char *GetSerializationKey() { return "Breakpoint"; }
158
  /// Destructor.
159
  ///
160
  /// The destructor is not virtual since there should be no reason to
161
  /// subclass breakpoints.  The varieties of breakpoints are specified
162
  /// instead by providing different resolvers & filters.
163
  ~Breakpoint() override;
164
165
  // Methods
166
167
  /// Tell whether this breakpoint is an "internal" breakpoint. \return
168
  ///     Returns \b true if this is an internal breakpoint, \b false otherwise.
169
  bool IsInternal() const;
170
171
  /// Standard "Dump" method.  At present it does nothing.
172
  void Dump(Stream *s) override;
173
174
  // The next set of methods provide ways to tell the breakpoint to update it's
175
  // location list - usually done when modules appear or disappear.
176
177
  /// Tell this breakpoint to clear all its breakpoint sites.  Done when the
178
  /// process holding the breakpoint sites is destroyed.
179
  void ClearAllBreakpointSites();
180
181
  /// Tell this breakpoint to scan it's target's module list and resolve any
182
  /// new locations that match the breakpoint's specifications.
183
  void ResolveBreakpoint();
184
185
  /// Tell this breakpoint to scan a given module list and resolve any new
186
  /// locations that match the breakpoint's specifications.
187
  ///
188
  /// \param[in] module_list
189
  ///    The list of modules to look in for new locations.
190
  ///
191
  /// \param[in]  send_event
192
  ///     If \b true, send a breakpoint location added event for non-internal
193
  ///     breakpoints.
194
  void ResolveBreakpointInModules(ModuleList &module_list,
195
                                  bool send_event = true);
196
197
  /// Tell this breakpoint to scan a given module list and resolve any new
198
  /// locations that match the breakpoint's specifications.
199
  ///
200
  /// \param[in] module_list
201
  ///    The list of modules to look in for new locations.
202
  ///
203
  /// \param[in]  new_locations
204
  ///     Fills new_locations with the new locations that were made.
205
  void ResolveBreakpointInModules(ModuleList &module_list,
206
                                  BreakpointLocationCollection &new_locations);
207
208
  /// Like ResolveBreakpointInModules, but allows for "unload" events, in
209
  /// which case we will remove any locations that are in modules that got
210
  /// unloaded.
211
  ///
212
  /// \param[in] changed_modules
213
  ///    The list of modules to look in for new locations.
214
  /// \param[in] load_event
215
  ///    If \b true then the modules were loaded, if \b false, unloaded.
216
  /// \param[in] delete_locations
217
  ///    If \b true then the modules were unloaded delete any locations in the
218
  ///    changed modules.
219
  void ModulesChanged(ModuleList &changed_modules, bool load_event,
220
                      bool delete_locations = false);
221
222
  /// Tells the breakpoint the old module \a old_module_sp has been replaced
223
  /// by new_module_sp (usually because the underlying file has been rebuilt,
224
  /// and the old version is gone.)
225
  ///
226
  /// \param[in] old_module_sp
227
  ///    The old module that is going away.
228
  /// \param[in] new_module_sp
229
  ///    The new module that is replacing it.
230
  void ModuleReplaced(lldb::ModuleSP old_module_sp,
231
                      lldb::ModuleSP new_module_sp);
232
233
  // The next set of methods provide access to the breakpoint locations for
234
  // this breakpoint.
235
236
  /// Add a location to the breakpoint's location list.  This is only meant to
237
  /// be called by the breakpoint's resolver.  FIXME: how do I ensure that?
238
  ///
239
  /// \param[in] addr
240
  ///    The Address specifying the new location.
241
  /// \param[out] new_location
242
  ///    Set to \b true if a new location was created, to \b false if there
243
  ///    already was a location at this Address.
244
  /// \return
245
  ///    Returns a pointer to the new location.
246
  lldb::BreakpointLocationSP AddLocation(const Address &addr,
247
                                         bool *new_location = nullptr);
248
249
  /// Find a breakpoint location by Address.
250
  ///
251
  /// \param[in] addr
252
  ///    The Address specifying the location.
253
  /// \return
254
  ///    Returns a shared pointer to the location at \a addr.  The pointer
255
  ///    in the shared pointer will be nullptr if there is no location at that
256
  ///    address.
257
  lldb::BreakpointLocationSP FindLocationByAddress(const Address &addr);
258
259
  /// Find a breakpoint location ID by Address.
260
  ///
261
  /// \param[in] addr
262
  ///    The Address specifying the location.
263
  /// \return
264
  ///    Returns the UID of the location at \a addr, or \b LLDB_INVALID_ID if
265
  ///    there is no breakpoint location at that address.
266
  lldb::break_id_t FindLocationIDByAddress(const Address &addr);
267
268
  /// Find a breakpoint location for a given breakpoint location ID.
269
  ///
270
  /// \param[in] bp_loc_id
271
  ///    The ID specifying the location.
272
  /// \return
273
  ///    Returns a shared pointer to the location with ID \a bp_loc_id.  The
274
  ///    pointer
275
  ///    in the shared pointer will be nullptr if there is no location with that
276
  ///    ID.
277
  lldb::BreakpointLocationSP FindLocationByID(lldb::break_id_t bp_loc_id);
278
279
  /// Get breakpoint locations by index.
280
  ///
281
  /// \param[in] index
282
  ///    The location index.
283
  ///
284
  /// \return
285
  ///     Returns a shared pointer to the location with index \a
286
  ///     index. The shared pointer might contain nullptr if \a index is
287
  ///     greater than then number of actual locations.
288
  lldb::BreakpointLocationSP GetLocationAtIndex(size_t index);
289
290
  /// Removes all invalid breakpoint locations.
291
  ///
292
  /// Removes all breakpoint locations with architectures that aren't
293
  /// compatible with \a arch. Also remove any breakpoint locations with whose
294
  /// locations have address where the section has been deleted (module and
295
  /// object files no longer exist).
296
  ///
297
  /// This is typically used after the process calls exec, or anytime the
298
  /// architecture of the target changes.
299
  ///
300
  /// \param[in] arch
301
  ///     If valid, check the module in each breakpoint to make sure
302
  ///     they are compatible, otherwise, ignore architecture.
303
  void RemoveInvalidLocations(const ArchSpec &arch);
304
305
  // The next section deals with various breakpoint options.
306
307
  /// If \a enable is \b true, enable the breakpoint, if \b false disable it.
308
  void SetEnabled(bool enable) override;
309
310
  /// Check the Enable/Disable state.
311
  /// \return
312
  ///     \b true if the breakpoint is enabled, \b false if disabled.
313
  bool IsEnabled() override;
314
315
  /// Set the breakpoint to ignore the next \a count breakpoint hits.
316
  /// \param[in] count
317
  ///    The number of breakpoint hits to ignore.
318
  void SetIgnoreCount(uint32_t count);
319
320
  /// Return the current ignore count/
321
  /// \return
322
  ///     The number of breakpoint hits to be ignored.
323
  uint32_t GetIgnoreCount() const;
324
325
  /// Return the current hit count for all locations. \return
326
  ///     The current hit count for all locations.
327
  uint32_t GetHitCount() const;
328
329
  /// If \a one_shot is \b true, breakpoint will be deleted on first hit.
330
  void SetOneShot(bool one_shot);
331
332
  /// Check the OneShot state.
333
  /// \return
334
  ///     \b true if the breakpoint is one shot, \b false otherwise.
335
  bool IsOneShot() const;
336
337
  /// If \a auto_continue is \b true, breakpoint will auto-continue when on
338
  /// hit.
339
  void SetAutoContinue(bool auto_continue);
340
341
  /// Check the AutoContinue state.
342
  /// \return
343
  ///     \b true if the breakpoint is set to auto-continue, \b false otherwise.
344
  bool IsAutoContinue() const;
345
346
  /// Set the valid thread to be checked when the breakpoint is hit.
347
  /// \param[in] thread_id
348
  ///    If this thread hits the breakpoint, we stop, otherwise not.
349
  void SetThreadID(lldb::tid_t thread_id);
350
351
  /// Return the current stop thread value.
352
  /// \return
353
  ///     The thread id for which the breakpoint hit will stop,
354
  ///     LLDB_INVALID_THREAD_ID for all threads.
355
  lldb::tid_t GetThreadID() const;
356
357
  void SetThreadIndex(uint32_t index);
358
359
  uint32_t GetThreadIndex() const;
360
361
  void SetThreadName(const char *thread_name);
362
363
  const char *GetThreadName() const;
364
365
  void SetQueueName(const char *queue_name);
366
367
  const char *GetQueueName() const;
368
369
  /// Set the callback action invoked when the breakpoint is hit.
370
  ///
371
  /// \param[in] callback
372
  ///    The method that will get called when the breakpoint is hit.
373
  /// \param[in] baton
374
  ///    A void * pointer that will get passed back to the callback function.
375
  /// \param[in] is_synchronous
376
  ///    If \b true the callback will be run on the private event thread
377
  ///    before the stop event gets reported.  If false, the callback will get
378
  ///    handled on the public event thread after the stop has been posted.
379
  void SetCallback(BreakpointHitCallback callback, void *baton,
380
                   bool is_synchronous = false);
381
382
  void SetCallback(BreakpointHitCallback callback,
383
                   const lldb::BatonSP &callback_baton_sp,
384
                   bool is_synchronous = false);
385
386
  void ClearCallback();
387
388
  /// Set the breakpoint's condition.
389
  ///
390
  /// \param[in] condition
391
  ///    The condition expression to evaluate when the breakpoint is hit.
392
  ///    Pass in nullptr to clear the condition.
393
  void SetCondition(const char *condition);
394
395
  /// Return a pointer to the text of the condition expression.
396
  ///
397
  /// \return
398
  ///    A pointer to the condition expression text, or nullptr if no
399
  //     condition has been set.
400
  const char *GetConditionText() const;
401
402
  // The next section are various utility functions.
403
404
  /// Return the number of breakpoint locations that have resolved to actual
405
  /// breakpoint sites.
406
  ///
407
  /// \return
408
  ///     The number locations resolved breakpoint sites.
409
  size_t GetNumResolvedLocations() const;
410
411
  /// Return whether this breakpoint has any resolved locations.
412
  ///
413
  /// \return
414
  ///     True if GetNumResolvedLocations > 0
415
  bool HasResolvedLocations() const;
416
417
  /// Return the number of breakpoint locations.
418
  ///
419
  /// \return
420
  ///     The number breakpoint locations.
421
  size_t GetNumLocations() const;
422
423
  /// Put a description of this breakpoint into the stream \a s.
424
  ///
425
  /// \param[in] s
426
  ///     Stream into which to dump the description.
427
  ///
428
  /// \param[in] level
429
  ///     The description level that indicates the detail level to
430
  ///     provide.
431
  ///
432
  /// \see lldb::DescriptionLevel
433
  void GetDescription(Stream *s, lldb::DescriptionLevel level,
434
                      bool show_locations = false);
435
436
  /// Set the "kind" description for a breakpoint.  If the breakpoint is hit
437
  /// the stop info will show this "kind" description instead of the
438
  /// breakpoint number.  Mostly useful for internal breakpoints, where the
439
  /// breakpoint number doesn't have meaning to the user.
440
  ///
441
  /// \param[in] kind
442
  ///     New "kind" description.
443
13.2k
  void SetBreakpointKind(const char *kind) { m_kind_description.assign(kind); }
444
445
  /// Return the "kind" description for a breakpoint.
446
  ///
447
  /// \return
448
  ///     The breakpoint kind, or nullptr if none is set.
449
6
  const char *GetBreakpointKind() const { return m_kind_description.c_str(); }
450
451
  /// Accessor for the breakpoint Target.
452
  /// \return
453
  ///     This breakpoint's Target.
454
97.3k
  Target &GetTarget() { return m_target; }
455
456
0
  const Target &GetTarget() const { return m_target; }
457
458
  const lldb::TargetSP GetTargetSP();
459
460
  void GetResolverDescription(Stream *s);
461
462
  /// Find breakpoint locations which match the (filename, line_number)
463
  /// description. The breakpoint location collection is to be filled with the
464
  /// matching locations. It should be initialized with 0 size by the API
465
  /// client.
466
  ///
467
  /// \return
468
  ///     True if there is a match
469
  ///
470
  ///     The locations which match the filename and line_number in loc_coll.
471
  ///     If its
472
  ///     size is 0 and true is returned, it means the breakpoint fully matches
473
  ///     the
474
  ///     description.
475
  bool GetMatchingFileLine(ConstString filename, uint32_t line_number,
476
                           BreakpointLocationCollection &loc_coll);
477
478
  void GetFilterDescription(Stream *s);
479
480
  /// Returns the BreakpointOptions structure set at the breakpoint level.
481
  ///
482
  /// Meant to be used by the BreakpointLocation class.
483
  ///
484
  /// \return
485
  ///     A reference to this breakpoint's BreakpointOptions.
486
  BreakpointOptions &GetOptions();
487
488
  /// Returns the BreakpointOptions structure set at the breakpoint level.
489
  ///
490
  /// Meant to be used by the BreakpointLocation class.
491
  ///
492
  /// \return
493
  ///     A reference to this breakpoint's BreakpointOptions.
494
  const BreakpointOptions &GetOptions() const;
495
496
  /// Invoke the callback action when the breakpoint is hit.
497
  ///
498
  /// Meant to be used by the BreakpointLocation class.
499
  ///
500
  /// \param[in] context
501
  ///     Described the breakpoint event.
502
  ///
503
  /// \param[in] bp_loc_id
504
  ///     Which breakpoint location hit this breakpoint.
505
  ///
506
  /// \return
507
  ///     \b true if the target should stop at this breakpoint and \b false not.
508
  bool InvokeCallback(StoppointCallbackContext *context,
509
                      lldb::break_id_t bp_loc_id);
510
511
54.4k
  bool IsHardware() const { return m_hardware; }
512
513
13
  lldb::BreakpointResolverSP GetResolver() { return m_resolver_sp; }
514
515
13
  lldb::SearchFilterSP GetSearchFilter() { return m_filter_sp; }
516
517
private: // The target needs to manage adding & removing names.  It will do the
518
         // checking for name validity as well.
519
  bool AddName(llvm::StringRef new_name);
520
521
2
  void RemoveName(const char *name_to_remove) {
522
2
    if (name_to_remove)
523
2
      m_name_list.erase(name_to_remove);
524
2
  }
525
526
public:
527
21
  bool MatchesName(const char *name) {
528
21
    return m_name_list.find(name) != m_name_list.end();
529
21
  }
530
531
1
  void GetNames(std::vector<std::string> &names) {
532
1
    names.clear();
533
1
    for (auto name : m_name_list) {
534
1
      names.push_back(name);
535
1
    }
536
1
  }
537
538
  /// Set a pre-condition filter that overrides all user provided
539
  /// filters/callbacks etc.
540
  ///
541
  /// Used to define fancy breakpoints that can do dynamic hit detection
542
  /// without taking up the condition slot - which really belongs to the user
543
  /// anyway...
544
  ///
545
  /// The Precondition should not continue the target, it should return true
546
  /// if the condition says to stop and false otherwise.
547
  ///
548
1.23k
  void SetPrecondition(lldb::BreakpointPreconditionSP precondition_sp) {
549
1.23k
    m_precondition_sp = std::move(precondition_sp);
550
1.23k
  }
551
552
  bool EvaluatePrecondition(StoppointCallbackContext &context);
553
554
0
  lldb::BreakpointPreconditionSP GetPrecondition() { return m_precondition_sp; }
555
556
  // Produces the OR'ed values for all the names assigned to this breakpoint.
557
280
  const BreakpointName::Permissions &GetPermissions() const {
558
280
      return m_permissions;
559
280
  }
560
561
21
  BreakpointName::Permissions &GetPermissions() {
562
21
      return m_permissions;
563
21
  }
564
565
223
  bool AllowList() const {
566
223
    return GetPermissions().GetAllowList();
567
223
  }
568
11
  bool AllowDisable() const {
569
11
    return GetPermissions().GetAllowDisable();
570
11
  }
571
46
  bool AllowDelete() const {
572
46
    return GetPermissions().GetAllowDelete();
573
46
  }
574
575
  // This one should only be used by Target to copy breakpoints from target to
576
  // target - primarily from the dummy target to prime new targets.
577
  static lldb::BreakpointSP CopyFromBreakpoint(lldb::TargetSP new_target,
578
      const Breakpoint &bp_to_copy_from);
579
580
  /// Get statistics associated with this breakpoint in JSON format.
581
  llvm::json::Value GetStatistics();
582
583
  /// Get the time it took to resolve all locations in this breakpoint.
584
25
  StatsDuration::Duration GetResolveTime() const { return m_resolve_time; }
585
586
protected:
587
  friend class Target;
588
  // Protected Methods
589
590
  /// Constructors and Destructors
591
  /// Only the Target can make a breakpoint, and it owns the breakpoint
592
  /// lifespans. The constructor takes a filter and a resolver.  Up in Target
593
  /// there are convenience variants that make breakpoints for some common
594
  /// cases.
595
  ///
596
  /// \param[in] target
597
  ///    The target in which the breakpoint will be set.
598
  ///
599
  /// \param[in] filter_sp
600
  ///    Shared pointer to the search filter that restricts the search domain of
601
  ///    the breakpoint.
602
  ///
603
  /// \param[in] resolver_sp
604
  ///    Shared pointer to the resolver object that will determine breakpoint
605
  ///    matches.
606
  ///
607
  /// \param hardware
608
  ///    If true, request a hardware breakpoint to be used to implement the
609
  ///    breakpoint locations.
610
  ///
611
  /// \param resolve_indirect_symbols
612
  ///    If true, and the address of a given breakpoint location in this
613
  ///    breakpoint is set on an
614
  ///    indirect symbol (i.e. Symbol::IsIndirect returns true) then the actual
615
  ///    breakpoint site will
616
  ///    be set on the target of the indirect symbol.
617
  // This is the generic constructor
618
  Breakpoint(Target &target, lldb::SearchFilterSP &filter_sp,
619
             lldb::BreakpointResolverSP &resolver_sp, bool hardware,
620
             bool resolve_indirect_symbols = true);
621
622
  friend class BreakpointLocation; // To call the following two when determining
623
                                   // whether to stop.
624
625
  void DecrementIgnoreCount();
626
627
private:
628
  // To call from CopyFromBreakpoint.
629
  Breakpoint(Target &new_target, const Breakpoint &bp_to_copy_from);
630
631
  // For Breakpoint only
632
  bool m_being_created;
633
  bool
634
      m_hardware; // If this breakpoint is required to use a hardware breakpoint
635
  Target &m_target; // The target that holds this breakpoint.
636
  std::unordered_set<std::string> m_name_list; // If not empty, this is the name
637
                                               // of this breakpoint (many
638
                                               // breakpoints can share the same
639
                                               // name.)
640
  lldb::SearchFilterSP
641
      m_filter_sp; // The filter that constrains the breakpoint's domain.
642
  lldb::BreakpointResolverSP
643
      m_resolver_sp; // The resolver that defines this breakpoint.
644
  lldb::BreakpointPreconditionSP m_precondition_sp; // The precondition is a
645
                                                    // breakpoint-level hit
646
                                                    // filter that can be used
647
  // to skip certain breakpoint hits.  For instance, exception breakpoints use
648
  // this to limit the stop to certain exception classes, while leaving the
649
  // condition & callback free for user specification.
650
  BreakpointOptions m_options; // Settable breakpoint options
651
  BreakpointLocationList
652
      m_locations; // The list of locations currently found for this breakpoint.
653
  std::string m_kind_description;
654
  bool m_resolve_indirect_symbols;
655
656
  /// Number of times this breakpoint has been hit. This is kept separately
657
  /// from the locations hit counts, since locations can go away when their
658
  /// backing library gets unloaded, and we would lose hit counts.
659
  StoppointHitCounter m_hit_counter;
660
661
  BreakpointName::Permissions m_permissions;
662
663
  StatsDuration m_resolve_time;
664
665
  void SendBreakpointChangedEvent(lldb::BreakpointEventType eventKind);
666
667
  void SendBreakpointChangedEvent(BreakpointEventData *data);
668
669
  Breakpoint(const Breakpoint &) = delete;
670
  const Breakpoint &operator=(const Breakpoint &) = delete;
671
};
672
673
} // namespace lldb_private
674
675
#endif // LLDB_BREAKPOINT_BREAKPOINT_H