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