|
|
|||
File indexing completed on 2026-05-10 08:42:43
0001 //===-- BreakpointList.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_BREAKPOINTLIST_H 0010 #define LLDB_BREAKPOINT_BREAKPOINTLIST_H 0011 0012 #include <list> 0013 #include <mutex> 0014 0015 #include "lldb/Breakpoint/Breakpoint.h" 0016 0017 namespace lldb_private { 0018 0019 /// \class BreakpointList BreakpointList.h "lldb/Breakpoint/BreakpointList.h" 0020 /// This class manages a list of breakpoints. 0021 0022 /// General Outline: 0023 /// Allows adding and removing breakpoints and find by ID and index. 0024 0025 class BreakpointList { 0026 public: 0027 BreakpointList(bool is_internal); 0028 0029 ~BreakpointList(); 0030 0031 /// Add the breakpoint \a bp_sp to the list. 0032 /// 0033 /// \param[in] bp_sp 0034 /// Shared pointer to the breakpoint that will get added to the list. 0035 /// 0036 /// \result 0037 /// Returns breakpoint id. 0038 lldb::break_id_t Add(lldb::BreakpointSP &bp_sp, bool notify); 0039 0040 /// Standard "Dump" method. At present it does nothing. 0041 void Dump(Stream *s) const; 0042 0043 /// Returns a shared pointer to the breakpoint with id \a breakID. Const 0044 /// version. 0045 /// 0046 /// \param[in] breakID 0047 /// The breakpoint ID to seek for. 0048 /// 0049 /// \result 0050 /// A shared pointer to the breakpoint. May contain a NULL pointer if the 0051 /// breakpoint doesn't exist. 0052 lldb::BreakpointSP FindBreakpointByID(lldb::break_id_t breakID) const; 0053 0054 /// Returns a shared pointer to the breakpoint with index \a i. 0055 /// 0056 /// \param[in] i 0057 /// The breakpoint index to seek for. 0058 /// 0059 /// \result 0060 /// A shared pointer to the breakpoint. May contain a NULL pointer if the 0061 /// breakpoint doesn't exist. 0062 lldb::BreakpointSP GetBreakpointAtIndex(size_t i) const; 0063 0064 /// Find all the breakpoints with a given name 0065 /// 0066 /// \param[in] name 0067 /// The breakpoint name for which to search. 0068 /// 0069 /// \result 0070 /// error if the input name was not a legal breakpoint name, vector 0071 /// of breakpoints otherwise. 0072 llvm::Expected<std::vector<lldb::BreakpointSP>> 0073 FindBreakpointsByName(const char *name); 0074 0075 /// Returns the number of elements in this breakpoint list. 0076 /// 0077 /// \result 0078 /// The number of elements. 0079 size_t GetSize() const { 0080 std::lock_guard<std::recursive_mutex> guard(m_mutex); 0081 return m_breakpoints.size(); 0082 } 0083 0084 /// Removes the breakpoint given by \b breakID from this list. 0085 /// 0086 /// \param[in] breakID 0087 /// The breakpoint index to remove. 0088 /// 0089 /// \result 0090 /// \b true if the breakpoint \a breakID was in the list. 0091 bool Remove(lldb::break_id_t breakID, bool notify); 0092 0093 /// Removes all invalid breakpoint locations. 0094 /// 0095 /// Removes all breakpoint locations in the list with architectures that 0096 /// aren't compatible with \a arch. Also remove any breakpoint locations 0097 /// with whose locations have address where the section has been deleted 0098 /// (module and object files no longer exist). 0099 /// 0100 /// This is typically used after the process calls exec, or anytime the 0101 /// architecture of the target changes. 0102 /// 0103 /// \param[in] arch 0104 /// If valid, check the module in each breakpoint to make sure 0105 /// they are compatible, otherwise, ignore architecture. 0106 void RemoveInvalidLocations(const ArchSpec &arch); 0107 0108 void SetEnabledAll(bool enabled); 0109 0110 void SetEnabledAllowed(bool enabled); 0111 0112 /// Removes all the breakpoints from this list. 0113 void RemoveAll(bool notify); 0114 0115 /// Removes all the breakpoints from this list - first checking the 0116 /// ePermDelete on the breakpoints. This call should be used unless you are 0117 /// shutting down and need to actually clear them all. 0118 void RemoveAllowed(bool notify); 0119 0120 /// Tell all the breakpoints to update themselves due to a change in the 0121 /// modules in \a module_list. \a added says whether the module was loaded 0122 /// or unloaded. 0123 /// 0124 /// \param[in] module_list 0125 /// The module list that has changed. 0126 /// 0127 /// \param[in] load 0128 /// \b true if the modules are loaded, \b false if unloaded. 0129 /// 0130 /// \param[in] delete_locations 0131 /// If \a load is \b false, then delete breakpoint locations when 0132 /// when updating breakpoints. 0133 void UpdateBreakpoints(ModuleList &module_list, bool load, 0134 bool delete_locations); 0135 0136 void UpdateBreakpointsWhenModuleIsReplaced(lldb::ModuleSP old_module_sp, 0137 lldb::ModuleSP new_module_sp); 0138 0139 void ClearAllBreakpointSites(); 0140 0141 /// Resets the hit count of all breakpoints. 0142 void ResetHitCounts(); 0143 0144 /// Sets the passed in Locker to hold the Breakpoint List mutex. 0145 /// 0146 /// \param[in] lock 0147 /// The locker object that is set. 0148 void GetListMutex(std::unique_lock<std::recursive_mutex> &lock); 0149 0150 protected: 0151 typedef std::vector<lldb::BreakpointSP> bp_collection; 0152 0153 bp_collection::iterator GetBreakpointIDIterator(lldb::break_id_t breakID); 0154 0155 bp_collection::const_iterator 0156 GetBreakpointIDConstIterator(lldb::break_id_t breakID) const; 0157 0158 std::recursive_mutex &GetMutex() const { return m_mutex; } 0159 0160 mutable std::recursive_mutex m_mutex; 0161 bp_collection m_breakpoints; 0162 lldb::break_id_t m_next_break_id; 0163 bool m_is_internal; 0164 0165 public: 0166 typedef LockingAdaptedIterable<bp_collection, lldb::BreakpointSP, 0167 list_adapter, std::recursive_mutex> 0168 BreakpointIterable; 0169 BreakpointIterable Breakpoints() { 0170 return BreakpointIterable(m_breakpoints, GetMutex()); 0171 } 0172 0173 private: 0174 BreakpointList(const BreakpointList &) = delete; 0175 const BreakpointList &operator=(const BreakpointList &) = delete; 0176 }; 0177 0178 } // namespace lldb_private 0179 0180 #endif // LLDB_BREAKPOINT_BREAKPOINTLIST_H
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|