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