diff options
Diffstat (limited to 'include/lldb/Breakpoint')
-rw-r--r-- | include/lldb/Breakpoint/BreakpointList.h | 16 | ||||
-rw-r--r-- | include/lldb/Breakpoint/BreakpointLocation.h | 5 | ||||
-rw-r--r-- | include/lldb/Breakpoint/BreakpointLocationCollection.h | 5 | ||||
-rw-r--r-- | include/lldb/Breakpoint/BreakpointLocationList.h | 4 | ||||
-rw-r--r-- | include/lldb/Breakpoint/BreakpointResolver.h | 29 | ||||
-rw-r--r-- | include/lldb/Breakpoint/BreakpointResolverFileLine.h | 1 | ||||
-rw-r--r-- | include/lldb/Breakpoint/BreakpointResolverFileRegex.h | 9 | ||||
-rw-r--r-- | include/lldb/Breakpoint/BreakpointResolverName.h | 27 | ||||
-rw-r--r-- | include/lldb/Breakpoint/BreakpointSite.h | 4 | ||||
-rw-r--r-- | include/lldb/Breakpoint/BreakpointSiteList.h | 12 | ||||
-rw-r--r-- | include/lldb/Breakpoint/WatchpointList.h | 9 |
11 files changed, 76 insertions, 45 deletions
diff --git a/include/lldb/Breakpoint/BreakpointList.h b/include/lldb/Breakpoint/BreakpointList.h index f4837e1ce9565..5ddde7d837c49 100644 --- a/include/lldb/Breakpoint/BreakpointList.h +++ b/include/lldb/Breakpoint/BreakpointList.h @@ -13,10 +13,11 @@ // C Includes // C++ Includes #include <list> +#include <mutex> + // Other libraries and framework includes // Project includes #include "lldb/Breakpoint/Breakpoint.h" -#include "lldb/Host/Mutex.h" namespace lldb_private { @@ -116,7 +117,7 @@ public: size_t GetSize() const { - Mutex::Locker locker(m_mutex); + std::lock_guard<std::recursive_mutex> guard(m_mutex); return m_breakpoints.size(); } @@ -193,7 +194,7 @@ public: /// The locker object that is set. //------------------------------------------------------------------ void - GetListMutex (lldb_private::Mutex::Locker &locker); + GetListMutex(std::unique_lock<std::recursive_mutex> &lock); protected: typedef std::list<lldb::BreakpointSP> bp_collection; @@ -204,19 +205,20 @@ protected: bp_collection::const_iterator GetBreakpointIDConstIterator(lldb::break_id_t breakID) const; - Mutex & - GetMutex () const + std::recursive_mutex & + GetMutex() const { return m_mutex; } - mutable Mutex m_mutex; + mutable std::recursive_mutex m_mutex; bp_collection m_breakpoints; // The breakpoint list, currently a list. lldb::break_id_t m_next_break_id; bool m_is_internal; public: - typedef LockingAdaptedIterable<bp_collection, lldb::BreakpointSP, list_adapter> BreakpointIterable; + typedef LockingAdaptedIterable<bp_collection, lldb::BreakpointSP, list_adapter, std::recursive_mutex> + BreakpointIterable; BreakpointIterable Breakpoints() { diff --git a/include/lldb/Breakpoint/BreakpointLocation.h b/include/lldb/Breakpoint/BreakpointLocation.h index 58d144cfb6680..42eca73dbb22d 100644 --- a/include/lldb/Breakpoint/BreakpointLocation.h +++ b/include/lldb/Breakpoint/BreakpointLocation.h @@ -13,6 +13,7 @@ // C Includes // C++ Includes #include <memory> +#include <mutex> // Other libraries and framework includes // Project includes @@ -20,7 +21,6 @@ #include "lldb/Breakpoint/StoppointLocation.h" #include "lldb/Core/Address.h" #include "lldb/Core/UserID.h" -#include "lldb/Host/Mutex.h" namespace lldb_private { @@ -460,7 +460,8 @@ private: std::unique_ptr<BreakpointOptions> m_options_ap; ///< Breakpoint options pointer, nullptr if we're using our breakpoint's options. lldb::BreakpointSiteSP m_bp_site_sp; ///< Our breakpoint site (it may be shared by more than one location.) lldb::UserExpressionSP m_user_expression_sp; ///< The compiled expression to use in testing our condition. - Mutex m_condition_mutex; ///< Guards parsing and evaluation of the condition, which could be evaluated by multiple processes. + std::mutex m_condition_mutex; ///< Guards parsing and evaluation of the condition, which could be evaluated by + /// multiple processes. size_t m_condition_hash; ///< For testing whether the condition source code changed. void diff --git a/include/lldb/Breakpoint/BreakpointLocationCollection.h b/include/lldb/Breakpoint/BreakpointLocationCollection.h index 004f8395122b1..1a016544fa4ca 100644 --- a/include/lldb/Breakpoint/BreakpointLocationCollection.h +++ b/include/lldb/Breakpoint/BreakpointLocationCollection.h @@ -13,6 +13,8 @@ // C Includes // C++ Includes #include <vector> +#include <mutex> + // Other libraries and framework includes // Project includes #include "lldb/lldb-private.h" @@ -201,7 +203,8 @@ private: collection::const_iterator GetIDPairConstIterator(lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const; - collection m_break_loc_collection; + collection m_break_loc_collection; + mutable std::mutex m_collection_mutex; public: typedef AdaptedIterable<collection, lldb::BreakpointLocationSP, vector_adapter> BreakpointLocationCollectionIterable; diff --git a/include/lldb/Breakpoint/BreakpointLocationList.h b/include/lldb/Breakpoint/BreakpointLocationList.h index 81526089b427a..1fbfa43a40f49 100644 --- a/include/lldb/Breakpoint/BreakpointLocationList.h +++ b/include/lldb/Breakpoint/BreakpointLocationList.h @@ -13,13 +13,13 @@ // C Includes // C++ Includes #include <map> +#include <mutex> #include <vector> // Other libraries and framework includes // Project includes #include "lldb/lldb-private.h" #include "lldb/Core/Address.h" -#include "lldb/Host/Mutex.h" #include "lldb/Utility/Iterable.h" namespace lldb_private { @@ -270,7 +270,7 @@ protected: Breakpoint &m_owner; collection m_locations; // Vector of locations, sorted by ID addr_map m_address_to_location; - mutable Mutex m_mutex; + mutable std::recursive_mutex m_mutex; lldb::break_id_t m_next_id; BreakpointLocationCollection *m_new_location_recorder; diff --git a/include/lldb/Breakpoint/BreakpointResolver.h b/include/lldb/Breakpoint/BreakpointResolver.h index 198abed841b22..b117e668a1bdc 100644 --- a/include/lldb/Breakpoint/BreakpointResolver.h +++ b/include/lldb/Breakpoint/BreakpointResolver.h @@ -60,7 +60,7 @@ public: /// @result /// Returns breakpoint location id. //------------------------------------------------------------------ - BreakpointResolver (Breakpoint *bkpt, unsigned char resolverType); + BreakpointResolver (Breakpoint *bkpt, unsigned char resolverType, lldb::addr_t offset = 0); //------------------------------------------------------------------ /// The Destructor is virtual, all significant breakpoint resolvers derive @@ -78,6 +78,29 @@ public: SetBreakpoint (Breakpoint *bkpt); //------------------------------------------------------------------ + /// This updates the offset for this breakpoint. All the locations currently + /// set for this breakpoint will have their offset adjusted when this is called. + /// + /// @param[in] offset + /// The offset to add to all locations. + //------------------------------------------------------------------ + void + SetOffset (lldb::addr_t offset); + + //------------------------------------------------------------------ + /// This updates the offset for this breakpoint. All the locations currently + /// set for this breakpoint will have their offset adjusted when this is called. + /// + /// @param[in] offset + /// The offset to add to all locations. + //------------------------------------------------------------------ + lldb::addr_t + GetOffset () const + { + return m_offset; + } + + //------------------------------------------------------------------ /// In response to this method the resolver scans all the modules in the breakpoint's /// target, and adds any new locations it finds. /// @@ -145,8 +168,12 @@ protected: /// matching addresses to unique entries, and skip the prologue if asked to do so, and then set /// breakpoint locations in this breakpoint for all the resultant addresses. void SetSCMatchesByLine (SearchFilter &filter, SymbolContextList &sc_list, bool skip_prologue, const char *log_ident); + + lldb::BreakpointLocationSP + AddLocation(Address loc_addr, bool *new_location = NULL); Breakpoint *m_breakpoint; // This is the breakpoint we add locations to. + lldb::addr_t m_offset; // A random offset the user asked us to add to any breakpoints we set. private: // Subclass identifier (for llvm isa/dyn_cast) diff --git a/include/lldb/Breakpoint/BreakpointResolverFileLine.h b/include/lldb/Breakpoint/BreakpointResolverFileLine.h index 2dde1546f1261..cea192b5edbfc 100644 --- a/include/lldb/Breakpoint/BreakpointResolverFileLine.h +++ b/include/lldb/Breakpoint/BreakpointResolverFileLine.h @@ -31,6 +31,7 @@ public: BreakpointResolverFileLine (Breakpoint *bkpt, const FileSpec &resolver, uint32_t line_no, + lldb::addr_t m_offset, bool check_inlines, bool skip_prologue, bool exact_match); diff --git a/include/lldb/Breakpoint/BreakpointResolverFileRegex.h b/include/lldb/Breakpoint/BreakpointResolverFileRegex.h index a8d7a50b5d936..ce67c2dc98ec5 100644 --- a/include/lldb/Breakpoint/BreakpointResolverFileRegex.h +++ b/include/lldb/Breakpoint/BreakpointResolverFileRegex.h @@ -12,9 +12,11 @@ // C Includes // C++ Includes +#include <set> // Other libraries and framework includes // Project includes #include "lldb/Breakpoint/BreakpointResolver.h" +#include "lldb/Core/ConstString.h" namespace lldb_private { @@ -30,6 +32,7 @@ class BreakpointResolverFileRegex : public: BreakpointResolverFileRegex (Breakpoint *bkpt, RegularExpression ®ex, + const std::unordered_set<std::string> &func_name_set, bool exact_match); ~BreakpointResolverFileRegex() override; @@ -48,6 +51,9 @@ public: void Dump (Stream *s) const override; + + void + AddFunctionName(const char *func_name); /// Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const BreakpointResolverFileRegex *) { return true; } @@ -61,7 +67,8 @@ public: protected: friend class Breakpoint; RegularExpression m_regex; // This is the line expression that we are looking for. - bool m_exact_match; + bool m_exact_match; // If true, then if the source we match is in a comment, we won't set a location there. + std::unordered_set<std::string> m_function_names; // Limit the search to functions in the comp_unit passed in. private: DISALLOW_COPY_AND_ASSIGN(BreakpointResolverFileRegex); diff --git a/include/lldb/Breakpoint/BreakpointResolverName.h b/include/lldb/Breakpoint/BreakpointResolverName.h index aaae9c1a12cfe..a11359dd00942 100644 --- a/include/lldb/Breakpoint/BreakpointResolverName.h +++ b/include/lldb/Breakpoint/BreakpointResolverName.h @@ -18,6 +18,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Breakpoint/BreakpointResolver.h" +#include "lldb/Core/Module.h" namespace lldb_private { @@ -37,6 +38,7 @@ public: uint32_t name_type_mask, lldb::LanguageType language, Breakpoint::MatchType type, + lldb::addr_t offset, bool skip_prologue); // This one takes an array of names. It is always MatchType = Exact. @@ -45,6 +47,7 @@ public: size_t num_names, uint32_t name_type_mask, lldb::LanguageType language, + lldb::addr_t offset, bool skip_prologue); // This one takes a C++ array of names. It is always MatchType = Exact. @@ -52,18 +55,21 @@ public: std::vector<std::string> names, uint32_t name_type_mask, lldb::LanguageType language, + lldb::addr_t offset, bool skip_prologue); // Creates a function breakpoint by regular expression. Takes over control of the lifespan of func_regex. BreakpointResolverName (Breakpoint *bkpt, RegularExpression &func_regex, lldb::LanguageType language, + lldb::addr_t offset, bool skip_prologue); BreakpointResolverName (Breakpoint *bkpt, const char *class_name, const char *method, Breakpoint::MatchType type, + lldb::addr_t offset, bool skip_prologue); ~BreakpointResolverName() override; @@ -95,26 +101,7 @@ public: protected: BreakpointResolverName(const BreakpointResolverName &rhs); - struct LookupInfo - { - ConstString name; - ConstString lookup_name; - uint32_t name_type_mask; // See FunctionNameType - bool match_name_after_lookup; - - LookupInfo () : - name(), - lookup_name(), - name_type_mask (0), - match_name_after_lookup (false) - { - } - - void - Prune (SymbolContextList &sc_list, - size_t start_idx) const; - }; - std::vector<LookupInfo> m_lookups; + std::vector<Module::LookupInfo> m_lookups; ConstString m_class_name; RegularExpression m_regex; Breakpoint::MatchType m_match_type; diff --git a/include/lldb/Breakpoint/BreakpointSite.h b/include/lldb/Breakpoint/BreakpointSite.h index 6cebcab8e2db6..27a23527d9fa9 100644 --- a/include/lldb/Breakpoint/BreakpointSite.h +++ b/include/lldb/Breakpoint/BreakpointSite.h @@ -14,12 +14,12 @@ // C++ Includes #include <list> +#include <mutex> // Other libraries and framework includes // Project includes #include "lldb/lldb-forward.h" -#include "lldb/Host/Mutex.h" #include "lldb/Core/UserID.h" #include "lldb/Breakpoint/StoppointLocation.h" #include "lldb/Breakpoint/BreakpointLocationCollection.h" @@ -297,7 +297,7 @@ private: // Consider adding an optimization where if there is only one // owner, we don't store a list. The usual case will be only one owner... BreakpointLocationCollection m_owners; ///< This has the BreakpointLocations that share this breakpoint site. - Mutex m_owners_mutex; ///< This mutex protects the owners collection. + std::recursive_mutex m_owners_mutex; ///< This mutex protects the owners collection. static lldb::break_id_t GetNextID(); diff --git a/include/lldb/Breakpoint/BreakpointSiteList.h b/include/lldb/Breakpoint/BreakpointSiteList.h index d7bb8fd777ef4..e681aa3599f7c 100644 --- a/include/lldb/Breakpoint/BreakpointSiteList.h +++ b/include/lldb/Breakpoint/BreakpointSiteList.h @@ -12,12 +12,13 @@ // C Includes // C++ Includes -#include <map> #include <functional> +#include <map> +#include <mutex> + // Other libraries and framework includes // Project includes #include "lldb/Breakpoint/BreakpointSite.h" -#include "lldb/Host/Mutex.h" namespace lldb_private { @@ -189,16 +190,17 @@ public: size_t GetSize() const { - Mutex::Locker locker(m_mutex); + std::lock_guard<std::recursive_mutex> guard(m_mutex); return m_bp_site_list.size(); } bool IsEmpty() const { - Mutex::Locker locker(m_mutex); + std::lock_guard<std::recursive_mutex> guard(m_mutex); return m_bp_site_list.empty(); } + protected: typedef std::map<lldb::addr_t, lldb::BreakpointSiteSP> collection; @@ -208,7 +210,7 @@ protected: collection::const_iterator GetIDConstIterator(lldb::break_id_t breakID) const; - mutable Mutex m_mutex; + mutable std::recursive_mutex m_mutex; collection m_bp_site_list; // The breakpoint site list. }; diff --git a/include/lldb/Breakpoint/WatchpointList.h b/include/lldb/Breakpoint/WatchpointList.h index d16cb25e3b7d1..7369623d1ce21 100644 --- a/include/lldb/Breakpoint/WatchpointList.h +++ b/include/lldb/Breakpoint/WatchpointList.h @@ -13,12 +13,13 @@ // C Includes // C++ Includes #include <list> +#include <mutex> #include <vector> + // Other libraries and framework includes // Project includes #include "lldb/lldb-private.h" #include "lldb/Core/Address.h" -#include "lldb/Host/Mutex.h" namespace lldb_private { @@ -217,7 +218,7 @@ public: size_t GetSize() const { - Mutex::Locker locker(m_mutex); + std::lock_guard<std::recursive_mutex> guard(m_mutex); return m_watchpoints.size(); } @@ -250,7 +251,7 @@ public: /// The locker object that is set. //------------------------------------------------------------------ void - GetListMutex (lldb_private::Mutex::Locker &locker); + GetListMutex(std::unique_lock<std::recursive_mutex> &lock); protected: typedef std::list<lldb::WatchpointSP> wp_collection; @@ -266,7 +267,7 @@ protected: GetIDConstIterator(lldb::watch_id_t watchID) const; wp_collection m_watchpoints; - mutable Mutex m_mutex; + mutable std::recursive_mutex m_mutex; lldb::watch_id_t m_next_wp_id; }; |