Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:43

0001 //===-- Breakpoint.h --------------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLDB_BREAKPOINT_BREAKPOINT_H
0010 #define LLDB_BREAKPOINT_BREAKPOINT_H
0011 
0012 #include <memory>
0013 #include <string>
0014 #include <unordered_set>
0015 #include <vector>
0016 
0017 #include "lldb/Breakpoint/BreakpointID.h"
0018 #include "lldb/Breakpoint/BreakpointLocationCollection.h"
0019 #include "lldb/Breakpoint/BreakpointLocationList.h"
0020 #include "lldb/Breakpoint/BreakpointName.h"
0021 #include "lldb/Breakpoint/BreakpointOptions.h"
0022 #include "lldb/Breakpoint/Stoppoint.h"
0023 #include "lldb/Breakpoint/StoppointHitCounter.h"
0024 #include "lldb/Core/SearchFilter.h"
0025 #include "lldb/Target/Statistics.h"
0026 #include "lldb/Utility/Event.h"
0027 #include "lldb/Utility/StringList.h"
0028 #include "lldb/Utility/StructuredData.h"
0029 
0030 namespace lldb_private {
0031 
0032 /// \class Breakpoint Breakpoint.h "lldb/Breakpoint/Breakpoint.h" Class that
0033 /// manages logical breakpoint setting.
0034 
0035 /// General Outline:
0036 /// A breakpoint has four main parts, a filter, a resolver, the list of
0037 /// breakpoint
0038 /// locations that have been determined for the filter/resolver pair, and
0039 /// finally a set of options for the breakpoint.
0040 ///
0041 /// \b Filter:
0042 /// This is an object derived from SearchFilter.  It manages the search for
0043 /// breakpoint location matches through the symbols in the module list of the
0044 /// target that owns it.  It also filters out locations based on whatever
0045 /// logic it wants.
0046 ///
0047 /// \b Resolver:
0048 /// This is an object derived from BreakpointResolver.  It provides a callback
0049 /// to the filter that will find breakpoint locations.  How it does this is
0050 /// determined by what kind of resolver it is.
0051 ///
0052 /// The Breakpoint class also provides constructors for the common breakpoint
0053 /// cases which make the appropriate filter and resolver for you.
0054 ///
0055 /// \b Location List:
0056 /// This stores the breakpoint locations that have been determined to date.
0057 /// For a given breakpoint, there will be only one location with a given
0058 /// address.  Adding a location at an already taken address will just return
0059 /// the location already at that address.  Locations can be looked up by ID,
0060 /// or by address.
0061 ///
0062 /// \b Options:
0063 /// This includes:
0064 ///    \b Enabled/Disabled
0065 ///    \b Ignore Count
0066 ///    \b Callback
0067 ///    \b Condition
0068 /// Note, these options can be set on the breakpoint, and they can also be set
0069 /// on the individual locations.  The options set on the breakpoint take
0070 /// precedence over the options set on the individual location. So for
0071 /// instance disabling the breakpoint will cause NONE of the locations to get
0072 /// hit. But if the breakpoint is enabled, then the location's enabled state
0073 /// will be checked to determine whether to insert that breakpoint location.
0074 /// Similarly, if the breakpoint condition says "stop", we won't check the
0075 /// location's condition. But if the breakpoint condition says "continue",
0076 /// then we will check the location for whether to actually stop or not. One
0077 /// subtle point worth observing here is that you don't actually stop at a
0078 /// Breakpoint, you always stop at one of its locations.  So the "should stop"
0079 /// tests are done by the location, not by the breakpoint.
0080 class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
0081                    public Stoppoint {
0082 public:
0083   static const char *
0084       BreakpointEventTypeAsCString(lldb::BreakpointEventType type);
0085 
0086   /// An enum specifying the match style for breakpoint settings.  At present
0087   /// only used for function name style breakpoints.
0088   enum MatchType { Exact, Regexp, Glob };
0089 
0090 private:
0091   enum class OptionNames : uint32_t { Names = 0, Hardware, LastOptionName };
0092 
0093   static const char
0094       *g_option_names[static_cast<uint32_t>(OptionNames::LastOptionName)];
0095 
0096   static const char *GetKey(OptionNames enum_value) {
0097     return g_option_names[static_cast<uint32_t>(enum_value)];
0098   }
0099 
0100 public:
0101   class BreakpointEventData : public EventData {
0102   public:
0103     BreakpointEventData(lldb::BreakpointEventType sub_type,
0104                         const lldb::BreakpointSP &new_breakpoint_sp);
0105 
0106     ~BreakpointEventData() override;
0107 
0108     static llvm::StringRef GetFlavorString();
0109 
0110     Log *GetLogChannel() override;
0111 
0112     llvm::StringRef GetFlavor() const override;
0113 
0114     lldb::BreakpointEventType GetBreakpointEventType() const;
0115 
0116     lldb::BreakpointSP GetBreakpoint() const;
0117 
0118     BreakpointLocationCollection &GetBreakpointLocationCollection() {
0119       return m_locations;
0120     }
0121 
0122     void Dump(Stream *s) const override;
0123 
0124     static lldb::BreakpointEventType
0125     GetBreakpointEventTypeFromEvent(const lldb::EventSP &event_sp);
0126 
0127     static lldb::BreakpointSP
0128     GetBreakpointFromEvent(const lldb::EventSP &event_sp);
0129 
0130     static lldb::BreakpointLocationSP
0131     GetBreakpointLocationAtIndexFromEvent(const lldb::EventSP &event_sp,
0132                                           uint32_t loc_idx);
0133 
0134     static size_t
0135     GetNumBreakpointLocationsFromEvent(const lldb::EventSP &event_sp);
0136 
0137     static const BreakpointEventData *
0138     GetEventDataFromEvent(const Event *event_sp);
0139 
0140   private:
0141     lldb::BreakpointEventType m_breakpoint_event;
0142     lldb::BreakpointSP m_new_breakpoint_sp;
0143     BreakpointLocationCollection m_locations;
0144 
0145     BreakpointEventData(const BreakpointEventData &) = delete;
0146     const BreakpointEventData &operator=(const BreakpointEventData &) = delete;
0147   };
0148 
0149   // Saving & restoring breakpoints:
0150   static lldb::BreakpointSP CreateFromStructuredData(
0151       lldb::TargetSP target_sp, StructuredData::ObjectSP &data_object_sp,
0152       Status &error);
0153 
0154   static bool
0155   SerializedBreakpointMatchesNames(StructuredData::ObjectSP &bkpt_object_sp,
0156                                    std::vector<std::string> &names);
0157 
0158   virtual StructuredData::ObjectSP SerializeToStructuredData();
0159 
0160   static const char *GetSerializationKey() { return "Breakpoint"; }
0161   /// Destructor.
0162   ///
0163   /// The destructor is not virtual since there should be no reason to
0164   /// subclass breakpoints.  The varieties of breakpoints are specified
0165   /// instead by providing different resolvers & filters.
0166   ~Breakpoint() override;
0167 
0168   // Methods
0169 
0170   /// Tell whether this breakpoint is an "internal" breakpoint. \return
0171   ///     Returns \b true if this is an internal breakpoint, \b false otherwise.
0172   bool IsInternal() const;
0173 
0174   /// Standard "Dump" method.  At present it does nothing.
0175   void Dump(Stream *s) override;
0176 
0177   // The next set of methods provide ways to tell the breakpoint to update it's
0178   // location list - usually done when modules appear or disappear.
0179 
0180   /// Tell this breakpoint to clear all its breakpoint sites.  Done when the
0181   /// process holding the breakpoint sites is destroyed.
0182   void ClearAllBreakpointSites();
0183 
0184   /// Tell this breakpoint to scan it's target's module list and resolve any
0185   /// new locations that match the breakpoint's specifications.
0186   void ResolveBreakpoint();
0187 
0188   /// Tell this breakpoint to scan a given module list and resolve any new
0189   /// locations that match the breakpoint's specifications.
0190   ///
0191   /// \param[in] module_list
0192   ///    The list of modules to look in for new locations.
0193   ///
0194   /// \param[in]  send_event
0195   ///     If \b true, send a breakpoint location added event for non-internal
0196   ///     breakpoints.
0197   void ResolveBreakpointInModules(ModuleList &module_list,
0198                                   bool send_event = true);
0199 
0200   /// Tell this breakpoint to scan a given module list and resolve any new
0201   /// locations that match the breakpoint's specifications.
0202   ///
0203   /// \param[in] module_list
0204   ///    The list of modules to look in for new locations.
0205   ///
0206   /// \param[in]  new_locations
0207   ///     Fills new_locations with the new locations that were made.
0208   void ResolveBreakpointInModules(ModuleList &module_list,
0209                                   BreakpointLocationCollection &new_locations);
0210 
0211   /// Like ResolveBreakpointInModules, but allows for "unload" events, in
0212   /// which case we will remove any locations that are in modules that got
0213   /// unloaded.
0214   ///
0215   /// \param[in] changed_modules
0216   ///    The list of modules to look in for new locations.
0217   /// \param[in] load_event
0218   ///    If \b true then the modules were loaded, if \b false, unloaded.
0219   /// \param[in] delete_locations
0220   ///    If \b true then the modules were unloaded delete any locations in the
0221   ///    changed modules.
0222   void ModulesChanged(ModuleList &changed_modules, bool load_event,
0223                       bool delete_locations = false);
0224 
0225   /// Tells the breakpoint the old module \a old_module_sp has been replaced
0226   /// by new_module_sp (usually because the underlying file has been rebuilt,
0227   /// and the old version is gone.)
0228   ///
0229   /// \param[in] old_module_sp
0230   ///    The old module that is going away.
0231   /// \param[in] new_module_sp
0232   ///    The new module that is replacing it.
0233   void ModuleReplaced(lldb::ModuleSP old_module_sp,
0234                       lldb::ModuleSP new_module_sp);
0235 
0236   // The next set of methods provide access to the breakpoint locations for
0237   // this breakpoint.
0238 
0239   /// Add a location to the breakpoint's location list.  This is only meant to
0240   /// be called by the breakpoint's resolver.  FIXME: how do I ensure that?
0241   ///
0242   /// \param[in] addr
0243   ///    The Address specifying the new location.
0244   /// \param[out] new_location
0245   ///    Set to \b true if a new location was created, to \b false if there
0246   ///    already was a location at this Address.
0247   /// \return
0248   ///    Returns a pointer to the new location.
0249   lldb::BreakpointLocationSP AddLocation(const Address &addr,
0250                                          bool *new_location = nullptr);
0251 
0252   /// Find a breakpoint location by Address.
0253   ///
0254   /// \param[in] addr
0255   ///    The Address specifying the location.
0256   /// \return
0257   ///    Returns a shared pointer to the location at \a addr.  The pointer
0258   ///    in the shared pointer will be nullptr if there is no location at that
0259   ///    address.
0260   lldb::BreakpointLocationSP FindLocationByAddress(const Address &addr);
0261 
0262   /// Find a breakpoint location ID by Address.
0263   ///
0264   /// \param[in] addr
0265   ///    The Address specifying the location.
0266   /// \return
0267   ///    Returns the UID of the location at \a addr, or \b LLDB_INVALID_ID if
0268   ///    there is no breakpoint location at that address.
0269   lldb::break_id_t FindLocationIDByAddress(const Address &addr);
0270 
0271   /// Find a breakpoint location for a given breakpoint location ID.
0272   ///
0273   /// \param[in] bp_loc_id
0274   ///    The ID specifying the location.
0275   /// \return
0276   ///    Returns a shared pointer to the location with ID \a bp_loc_id.  The
0277   ///    pointer
0278   ///    in the shared pointer will be nullptr if there is no location with that
0279   ///    ID.
0280   lldb::BreakpointLocationSP FindLocationByID(lldb::break_id_t bp_loc_id);
0281 
0282   /// Get breakpoint locations by index.
0283   ///
0284   /// \param[in] index
0285   ///    The location index.
0286   ///
0287   /// \return
0288   ///     Returns a shared pointer to the location with index \a
0289   ///     index. The shared pointer might contain nullptr if \a index is
0290   ///     greater than then number of actual locations.
0291   lldb::BreakpointLocationSP GetLocationAtIndex(size_t index);
0292 
0293   /// Removes all invalid breakpoint locations.
0294   ///
0295   /// Removes all breakpoint locations with architectures that aren't
0296   /// compatible with \a arch. Also remove any breakpoint locations with whose
0297   /// locations have address where the section has been deleted (module and
0298   /// object files no longer exist).
0299   ///
0300   /// This is typically used after the process calls exec, or anytime the
0301   /// architecture of the target changes.
0302   ///
0303   /// \param[in] arch
0304   ///     If valid, check the module in each breakpoint to make sure
0305   ///     they are compatible, otherwise, ignore architecture.
0306   void RemoveInvalidLocations(const ArchSpec &arch);
0307 
0308   // The next section deals with various breakpoint options.
0309 
0310   /// If \a enable is \b true, enable the breakpoint, if \b false disable it.
0311   void SetEnabled(bool enable) override;
0312 
0313   /// Check the Enable/Disable state.
0314   /// \return
0315   ///     \b true if the breakpoint is enabled, \b false if disabled.
0316   bool IsEnabled() override;
0317 
0318   /// Set the breakpoint to ignore the next \a count breakpoint hits.
0319   /// \param[in] count
0320   ///    The number of breakpoint hits to ignore.
0321   void SetIgnoreCount(uint32_t count);
0322 
0323   /// Return the current ignore count/
0324   /// \return
0325   ///     The number of breakpoint hits to be ignored.
0326   uint32_t GetIgnoreCount() const;
0327 
0328   /// Return the current hit count for all locations. \return
0329   ///     The current hit count for all locations.
0330   uint32_t GetHitCount() const;
0331 
0332   /// Resets the current hit count for all locations.
0333   void ResetHitCount();
0334 
0335   /// If \a one_shot is \b true, breakpoint will be deleted on first hit.
0336   void SetOneShot(bool one_shot);
0337 
0338   /// Check the OneShot state.
0339   /// \return
0340   ///     \b true if the breakpoint is one shot, \b false otherwise.
0341   bool IsOneShot() const;
0342 
0343   /// If \a auto_continue is \b true, breakpoint will auto-continue when on
0344   /// hit.
0345   void SetAutoContinue(bool auto_continue);
0346 
0347   /// Check the AutoContinue state.
0348   /// \return
0349   ///     \b true if the breakpoint is set to auto-continue, \b false otherwise.
0350   bool IsAutoContinue() const;
0351 
0352   /// Set the valid thread to be checked when the breakpoint is hit.
0353   /// \param[in] thread_id
0354   ///    If this thread hits the breakpoint, we stop, otherwise not.
0355   void SetThreadID(lldb::tid_t thread_id);
0356 
0357   /// Return the current stop thread value.
0358   /// \return
0359   ///     The thread id for which the breakpoint hit will stop,
0360   ///     LLDB_INVALID_THREAD_ID for all threads.
0361   lldb::tid_t GetThreadID() const;
0362 
0363   void SetThreadIndex(uint32_t index);
0364 
0365   uint32_t GetThreadIndex() const;
0366 
0367   void SetThreadName(const char *thread_name);
0368 
0369   const char *GetThreadName() const;
0370 
0371   void SetQueueName(const char *queue_name);
0372 
0373   const char *GetQueueName() const;
0374 
0375   /// Set the callback action invoked when the breakpoint is hit.
0376   ///
0377   /// \param[in] callback
0378   ///    The method that will get called when the breakpoint is hit.
0379   /// \param[in] baton
0380   ///    A void * pointer that will get passed back to the callback function.
0381   /// \param[in] is_synchronous
0382   ///    If \b true the callback will be run on the private event thread
0383   ///    before the stop event gets reported.  If false, the callback will get
0384   ///    handled on the public event thread while the stop event is being
0385   ///    pulled off the event queue.
0386   ///    Note: synchronous callbacks cannot cause the target to run, in
0387   ///    particular, they should not try to run the expression evaluator.
0388   void SetCallback(BreakpointHitCallback callback, void *baton,
0389                    bool is_synchronous = false);
0390 
0391   void SetCallback(BreakpointHitCallback callback,
0392                    const lldb::BatonSP &callback_baton_sp,
0393                    bool is_synchronous = false);
0394 
0395   void ClearCallback();
0396 
0397   /// Set the breakpoint's condition.
0398   ///
0399   /// \param[in] condition
0400   ///    The condition expression to evaluate when the breakpoint is hit.
0401   ///    Pass in nullptr to clear the condition.
0402   void SetCondition(const char *condition);
0403 
0404   /// Return a pointer to the text of the condition expression.
0405   ///
0406   /// \return
0407   ///    A pointer to the condition expression text, or nullptr if no
0408   //     condition has been set.
0409   const char *GetConditionText() const;
0410 
0411   // The next section are various utility functions.
0412 
0413   /// Return the number of breakpoint locations that have resolved to actual
0414   /// breakpoint sites.
0415   ///
0416   /// \return
0417   ///     The number locations resolved breakpoint sites.
0418   size_t GetNumResolvedLocations() const;
0419 
0420   /// Return whether this breakpoint has any resolved locations.
0421   ///
0422   /// \return
0423   ///     True if GetNumResolvedLocations > 0
0424   bool HasResolvedLocations() const;
0425 
0426   /// Return the number of breakpoint locations.
0427   ///
0428   /// \return
0429   ///     The number breakpoint locations.
0430   size_t GetNumLocations() const;
0431 
0432   /// Put a description of this breakpoint into the stream \a s.
0433   ///
0434   /// \param[in] s
0435   ///     Stream into which to dump the description.
0436   ///
0437   /// \param[in] level
0438   ///     The description level that indicates the detail level to
0439   ///     provide.
0440   ///
0441   /// \see lldb::DescriptionLevel
0442   void GetDescription(Stream *s, lldb::DescriptionLevel level,
0443                       bool show_locations = false);
0444 
0445   /// Set the "kind" description for a breakpoint.  If the breakpoint is hit
0446   /// the stop info will show this "kind" description instead of the
0447   /// breakpoint number.  Mostly useful for internal breakpoints, where the
0448   /// breakpoint number doesn't have meaning to the user.
0449   ///
0450   /// \param[in] kind
0451   ///     New "kind" description.
0452   void SetBreakpointKind(const char *kind) { m_kind_description.assign(kind); }
0453 
0454   /// Return the "kind" description for a breakpoint.
0455   ///
0456   /// \return
0457   ///     The breakpoint kind, or nullptr if none is set.
0458   const char *GetBreakpointKind() const { return m_kind_description.c_str(); }
0459 
0460   /// Accessor for the breakpoint Target.
0461   /// \return
0462   ///     This breakpoint's Target.
0463   Target &GetTarget() { return m_target; }
0464 
0465   const Target &GetTarget() const { return m_target; }
0466 
0467   const lldb::TargetSP GetTargetSP();
0468 
0469   void GetResolverDescription(Stream *s);
0470 
0471   /// Find breakpoint locations which match the (filename, line_number)
0472   /// description. The breakpoint location collection is to be filled with the
0473   /// matching locations. It should be initialized with 0 size by the API
0474   /// client.
0475   ///
0476   /// \return
0477   ///     True if there is a match
0478   ///
0479   ///     The locations which match the filename and line_number in loc_coll.
0480   ///     If its
0481   ///     size is 0 and true is returned, it means the breakpoint fully matches
0482   ///     the
0483   ///     description.
0484   bool GetMatchingFileLine(ConstString filename, uint32_t line_number,
0485                            BreakpointLocationCollection &loc_coll);
0486 
0487   void GetFilterDescription(Stream *s);
0488 
0489   /// Returns the BreakpointOptions structure set at the breakpoint level.
0490   ///
0491   /// Meant to be used by the BreakpointLocation class.
0492   ///
0493   /// \return
0494   ///     A reference to this breakpoint's BreakpointOptions.
0495   BreakpointOptions &GetOptions();
0496 
0497   /// Returns the BreakpointOptions structure set at the breakpoint level.
0498   ///
0499   /// Meant to be used by the BreakpointLocation class.
0500   ///
0501   /// \return
0502   ///     A reference to this breakpoint's BreakpointOptions.
0503   const BreakpointOptions &GetOptions() const;
0504 
0505   /// Invoke the callback action when the breakpoint is hit.
0506   ///
0507   /// Meant to be used by the BreakpointLocation class.
0508   ///
0509   /// \param[in] context
0510   ///     Described the breakpoint event.
0511   ///
0512   /// \param[in] bp_loc_id
0513   ///     Which breakpoint location hit this breakpoint.
0514   ///
0515   /// \return
0516   ///     \b true if the target should stop at this breakpoint and \b false not.
0517   bool InvokeCallback(StoppointCallbackContext *context,
0518                       lldb::break_id_t bp_loc_id);
0519 
0520   bool IsHardware() const { return m_hardware; }
0521 
0522   lldb::BreakpointResolverSP GetResolver() { return m_resolver_sp; }
0523 
0524   lldb::SearchFilterSP GetSearchFilter() { return m_filter_sp; }
0525 
0526 private:
0527   void AddName(llvm::StringRef new_name);
0528 
0529   void RemoveName(const char *name_to_remove) {
0530     if (name_to_remove)
0531       m_name_list.erase(name_to_remove);
0532   }
0533 
0534 public:
0535   bool MatchesName(const char *name) {
0536     return m_name_list.find(name) != m_name_list.end();
0537   }
0538 
0539   void GetNames(std::vector<std::string> &names) {
0540     names.clear();
0541     for (auto name : m_name_list) {
0542       names.push_back(name);
0543     }
0544   }
0545 
0546   /// Set a pre-condition filter that overrides all user provided
0547   /// filters/callbacks etc.
0548   ///
0549   /// Used to define fancy breakpoints that can do dynamic hit detection
0550   /// without taking up the condition slot - which really belongs to the user
0551   /// anyway...
0552   ///
0553   /// The Precondition should not continue the target, it should return true
0554   /// if the condition says to stop and false otherwise.
0555   ///
0556   void SetPrecondition(lldb::BreakpointPreconditionSP precondition_sp) {
0557     m_precondition_sp = std::move(precondition_sp);
0558   }
0559 
0560   bool EvaluatePrecondition(StoppointCallbackContext &context);
0561 
0562   lldb::BreakpointPreconditionSP GetPrecondition() { return m_precondition_sp; }
0563 
0564   // Produces the OR'ed values for all the names assigned to this breakpoint.
0565   const BreakpointName::Permissions &GetPermissions() const {
0566       return m_permissions;
0567   }
0568 
0569   BreakpointName::Permissions &GetPermissions() {
0570       return m_permissions;
0571   }
0572 
0573   bool AllowList() const {
0574     return GetPermissions().GetAllowList();
0575   }
0576   bool AllowDisable() const {
0577     return GetPermissions().GetAllowDisable();
0578   }
0579   bool AllowDelete() const {
0580     return GetPermissions().GetAllowDelete();
0581   }
0582 
0583   // This one should only be used by Target to copy breakpoints from target to
0584   // target - primarily from the dummy target to prime new targets.
0585   static lldb::BreakpointSP CopyFromBreakpoint(lldb::TargetSP new_target,
0586       const Breakpoint &bp_to_copy_from);
0587 
0588   /// Get statistics associated with this breakpoint in JSON format.
0589   llvm::json::Value GetStatistics();
0590 
0591   void ResetStatistics();
0592 
0593   /// Get the time it took to resolve all locations in this breakpoint.
0594   StatsDuration::Duration GetResolveTime() const { return m_resolve_time; }
0595 
0596 protected:
0597   friend class Target;
0598   // Protected Methods
0599 
0600   /// Constructors and Destructors
0601   /// Only the Target can make a breakpoint, and it owns the breakpoint
0602   /// lifespans. The constructor takes a filter and a resolver.  Up in Target
0603   /// there are convenience variants that make breakpoints for some common
0604   /// cases.
0605   ///
0606   /// \param[in] target
0607   ///    The target in which the breakpoint will be set.
0608   ///
0609   /// \param[in] filter_sp
0610   ///    Shared pointer to the search filter that restricts the search domain of
0611   ///    the breakpoint.
0612   ///
0613   /// \param[in] resolver_sp
0614   ///    Shared pointer to the resolver object that will determine breakpoint
0615   ///    matches.
0616   ///
0617   /// \param hardware
0618   ///    If true, request a hardware breakpoint to be used to implement the
0619   ///    breakpoint locations.
0620   ///
0621   /// \param resolve_indirect_symbols
0622   ///    If true, and the address of a given breakpoint location in this
0623   ///    breakpoint is set on an
0624   ///    indirect symbol (i.e. Symbol::IsIndirect returns true) then the actual
0625   ///    breakpoint site will
0626   ///    be set on the target of the indirect symbol.
0627   // This is the generic constructor
0628   Breakpoint(Target &target, lldb::SearchFilterSP &filter_sp,
0629              lldb::BreakpointResolverSP &resolver_sp, bool hardware,
0630              bool resolve_indirect_symbols = true);
0631 
0632   friend class BreakpointLocation; // To call the following two when determining
0633                                    // whether to stop.
0634 
0635   void DecrementIgnoreCount();
0636 
0637 private:
0638   // To call from CopyFromBreakpoint.
0639   Breakpoint(Target &new_target, const Breakpoint &bp_to_copy_from);
0640 
0641   // For Breakpoint only
0642   bool
0643       m_hardware; // If this breakpoint is required to use a hardware breakpoint
0644   Target &m_target; // The target that holds this breakpoint.
0645   std::unordered_set<std::string> m_name_list; // If not empty, this is the name
0646                                                // of this breakpoint (many
0647                                                // breakpoints can share the same
0648                                                // name.)
0649   lldb::SearchFilterSP
0650       m_filter_sp; // The filter that constrains the breakpoint's domain.
0651   lldb::BreakpointResolverSP
0652       m_resolver_sp; // The resolver that defines this breakpoint.
0653   lldb::BreakpointPreconditionSP m_precondition_sp; // The precondition is a
0654                                                     // breakpoint-level hit
0655                                                     // filter that can be used
0656   // to skip certain breakpoint hits.  For instance, exception breakpoints use
0657   // this to limit the stop to certain exception classes, while leaving the
0658   // condition & callback free for user specification.
0659   BreakpointOptions m_options; // Settable breakpoint options
0660   BreakpointLocationList
0661       m_locations; // The list of locations currently found for this breakpoint.
0662   std::string m_kind_description;
0663   bool m_resolve_indirect_symbols;
0664 
0665   /// Number of times this breakpoint has been hit. This is kept separately
0666   /// from the locations hit counts, since locations can go away when their
0667   /// backing library gets unloaded, and we would lose hit counts.
0668   StoppointHitCounter m_hit_counter;
0669 
0670   BreakpointName::Permissions m_permissions;
0671 
0672   StatsDuration m_resolve_time;
0673 
0674   void SendBreakpointChangedEvent(lldb::BreakpointEventType eventKind);
0675 
0676   void SendBreakpointChangedEvent(const lldb::EventDataSP &breakpoint_data_sp);
0677 
0678   Breakpoint(const Breakpoint &) = delete;
0679   const Breakpoint &operator=(const Breakpoint &) = delete;
0680 };
0681 
0682 } // namespace lldb_private
0683 
0684 #endif // LLDB_BREAKPOINT_BREAKPOINT_H