diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 20:51:52 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 20:51:52 +0000 |
commit | 5f29bb8a675e8f96452b632e7129113f7dec850e (patch) | |
tree | 3d3f2a0d3ad10872a4dcaba8ec8d1d20c87ab147 /include/lldb/Breakpoint | |
parent | 88c643b6fec27eec436c8d138fee6346e92337d6 (diff) | |
download | src-5f29bb8a675e8f96452b632e7129113f7dec850e.tar.gz src-5f29bb8a675e8f96452b632e7129113f7dec850e.zip |
Vendor import of stripped lldb trunk r366426 (just before the release_90
branch point):
https://llvm.org/svn/llvm-project/lldb/trunk@366426
Notes
Notes:
svn path=/vendor/lldb/dist/; revision=351290
Diffstat (limited to 'include/lldb/Breakpoint')
24 files changed, 431 insertions, 993 deletions
diff --git a/include/lldb/Breakpoint/Breakpoint.h b/include/lldb/Breakpoint/Breakpoint.h index 5861a3be36e1..f561b6d900a1 100644 --- a/include/lldb/Breakpoint/Breakpoint.h +++ b/include/lldb/Breakpoint/Breakpoint.h @@ -1,9 +1,8 @@ //===-- Breakpoint.h --------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -28,12 +27,9 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class Breakpoint Breakpoint.h "lldb/Breakpoint/Breakpoint.h" Class that +/// \class Breakpoint Breakpoint.h "lldb/Breakpoint/Breakpoint.h" Class that /// manages logical breakpoint setting. -//---------------------------------------------------------------------- -//---------------------------------------------------------------------- /// General Outline: /// A breakpoint has four main parts, a filter, a resolver, the list of /// breakpoint @@ -79,17 +75,14 @@ namespace lldb_private { /// subtle point worth observing here is that you don't actually stop at a /// Breakpoint, you always stop at one of its locations. So the "should stop" /// tests are done by the location, not by the breakpoint. -//---------------------------------------------------------------------- class Breakpoint : public std::enable_shared_from_this<Breakpoint>, public Stoppoint { public: - static const ConstString &GetEventIdentifier(); + static ConstString GetEventIdentifier(); - //------------------------------------------------------------------ /// An enum specifying the match style for breakpoint settings. At present /// only used for function name style breakpoints. - //------------------------------------------------------------------ - typedef enum { Exact, Regexp, Glob } MatchType; + enum MatchType { Exact, Regexp, Glob }; private: enum class OptionNames : uint32_t { Names = 0, Hardware, LastOptionName }; @@ -109,9 +102,9 @@ public: ~BreakpointEventData() override; - static const ConstString &GetFlavorString(); + static ConstString GetFlavorString(); - const ConstString &GetFlavor() const override; + ConstString GetFlavor() const override; lldb::BreakpointEventType GetBreakpointEventType() const; @@ -147,19 +140,6 @@ public: DISALLOW_COPY_AND_ASSIGN(BreakpointEventData); }; - class BreakpointPrecondition { - public: - virtual ~BreakpointPrecondition() = default; - - virtual bool EvaluatePrecondition(StoppointCallbackContext &context); - - virtual Status ConfigurePrecondition(Args &options); - - virtual void GetDescription(Stream &stream, lldb::DescriptionLevel level); - }; - - typedef std::shared_ptr<BreakpointPrecondition> BreakpointPreconditionSP; - // Saving & restoring breakpoints: static lldb::BreakpointSP CreateFromStructuredData( Target &target, StructuredData::ObjectSP &data_object_sp, Status &error); @@ -171,173 +151,138 @@ public: virtual StructuredData::ObjectSP SerializeToStructuredData(); static const char *GetSerializationKey() { return "Breakpoint"; } - //------------------------------------------------------------------ /// Destructor. /// /// The destructor is not virtual since there should be no reason to /// subclass breakpoints. The varieties of breakpoints are specified /// instead by providing different resolvers & filters. - //------------------------------------------------------------------ ~Breakpoint() override; - //------------------------------------------------------------------ // Methods - //------------------------------------------------------------------ - //------------------------------------------------------------------ - /// Tell whether this breakpoint is an "internal" breakpoint. @return + /// Tell whether this breakpoint is an "internal" breakpoint. \return /// Returns \b true if this is an internal breakpoint, \b false otherwise. - //------------------------------------------------------------------ bool IsInternal() const; - //------------------------------------------------------------------ /// Standard "Dump" method. At present it does nothing. - //------------------------------------------------------------------ void Dump(Stream *s) override; - //------------------------------------------------------------------ // The next set of methods provide ways to tell the breakpoint to update it's // location list - usually done when modules appear or disappear. - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// Tell this breakpoint to clear all its breakpoint sites. Done when the /// process holding the breakpoint sites is destroyed. - //------------------------------------------------------------------ void ClearAllBreakpointSites(); - //------------------------------------------------------------------ /// Tell this breakpoint to scan it's target's module list and resolve any /// new locations that match the breakpoint's specifications. - //------------------------------------------------------------------ void ResolveBreakpoint(); - //------------------------------------------------------------------ /// Tell this breakpoint to scan a given module list and resolve any new /// locations that match the breakpoint's specifications. /// - /// @param[in] module_list + /// \param[in] module_list /// The list of modules to look in for new locations. /// - /// @param[in] send_event + /// \param[in] send_event /// If \b true, send a breakpoint location added event for non-internal /// breakpoints. - //------------------------------------------------------------------ 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 breakpoint's specifications. /// - /// @param[in] changed_modules + /// \param[in] changed_modules /// The list of modules to look in for new locations. /// - /// @param[in] new_locations + /// \param[in] new_locations /// Fills new_locations with the new locations that were made. - //------------------------------------------------------------------ void ResolveBreakpointInModules(ModuleList &module_list, BreakpointLocationCollection &new_locations); - //------------------------------------------------------------------ /// Like ResolveBreakpointInModules, but allows for "unload" events, in /// which case we will remove any locations that are in modules that got /// unloaded. /// - /// @param[in] changedModules + /// \param[in] changedModules /// The list of modules to look in for new locations. - /// @param[in] load_event + /// \param[in] load_event /// If \b true then the modules were loaded, if \b false, unloaded. - /// @param[in] delete_locations + /// \param[in] delete_locations /// If \b true then the modules were unloaded delete any locations in the /// changed modules. - //------------------------------------------------------------------ void ModulesChanged(ModuleList &changed_modules, bool load_event, bool delete_locations = false); - //------------------------------------------------------------------ /// Tells the breakpoint the old module \a old_module_sp has been replaced /// by new_module_sp (usually because the underlying file has been rebuilt, /// and the old version is gone.) /// - /// @param[in] old_module_sp + /// \param[in] old_module_sp /// The old module that is going away. - /// @param[in] new_module_sp + /// \param[in] new_module_sp /// The new module that is replacing it. - //------------------------------------------------------------------ void ModuleReplaced(lldb::ModuleSP old_module_sp, lldb::ModuleSP new_module_sp); - //------------------------------------------------------------------ // The next set of methods provide access to the breakpoint locations for // this breakpoint. - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// Add a location to the breakpoint's location list. This is only meant to /// be called by the breakpoint's resolver. FIXME: how do I ensure that? /// - /// @param[in] addr + /// \param[in] addr /// The Address specifying the new location. - /// @param[out] new_location + /// \param[out] new_location /// Set to \b true if a new location was created, to \b false if there /// already was a location at this Address. - /// @return + /// \return /// Returns a pointer to the new location. - //------------------------------------------------------------------ lldb::BreakpointLocationSP AddLocation(const Address &addr, bool *new_location = nullptr); - //------------------------------------------------------------------ /// Find a breakpoint location by Address. /// - /// @param[in] addr + /// \param[in] addr /// The Address specifying the location. - /// @return + /// \return /// Returns a shared pointer to the location at \a addr. The pointer /// in the shared pointer will be nullptr if there is no location at that /// address. - //------------------------------------------------------------------ lldb::BreakpointLocationSP FindLocationByAddress(const Address &addr); - //------------------------------------------------------------------ /// Find a breakpoint location ID by Address. /// - /// @param[in] addr + /// \param[in] addr /// The Address specifying the location. - /// @return + /// \return /// Returns the UID of the location at \a addr, or \b LLDB_INVALID_ID if /// there is no breakpoint location at that address. - //------------------------------------------------------------------ lldb::break_id_t FindLocationIDByAddress(const Address &addr); - //------------------------------------------------------------------ /// Find a breakpoint location for a given breakpoint location ID. /// - /// @param[in] bp_loc_id + /// \param[in] bp_loc_id /// The ID specifying the location. - /// @return + /// \return /// Returns a shared pointer to the location with ID \a bp_loc_id. The /// pointer /// in the shared pointer will be nullptr if there is no location with that /// ID. - //------------------------------------------------------------------ lldb::BreakpointLocationSP FindLocationByID(lldb::break_id_t bp_loc_id); - //------------------------------------------------------------------ /// Get breakpoint locations by index. /// - /// @param[in] index + /// \param[in] index /// The location index. /// - /// @return + /// \return /// Returns a shared pointer to the location with index \a /// index. The shared pointer might contain nullptr if \a index is /// greater than then number of actual locations. - //------------------------------------------------------------------ lldb::BreakpointLocationSP GetLocationAtIndex(size_t index); - //------------------------------------------------------------------ /// Removes all invalid breakpoint locations. /// /// Removes all breakpoint locations with architectures that aren't @@ -348,86 +293,61 @@ public: /// This is typically used after the process calls exec, or anytime the /// architecture of the target changes. /// - /// @param[in] arch + /// \param[in] arch /// If valid, check the module in each breakpoint to make sure /// they are compatible, otherwise, ignore architecture. - //------------------------------------------------------------------ void RemoveInvalidLocations(const ArchSpec &arch); - //------------------------------------------------------------------ // The next section deals with various breakpoint options. - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// If \a enable is \b true, enable the breakpoint, if \b false disable it. - //------------------------------------------------------------------ void SetEnabled(bool enable) override; - //------------------------------------------------------------------ /// Check the Enable/Disable state. - /// @return + /// \return /// \b true if the breakpoint is enabled, \b false if disabled. - //------------------------------------------------------------------ bool IsEnabled() override; - //------------------------------------------------------------------ /// Set the breakpoint to ignore the next \a count breakpoint hits. - /// @param[in] count + /// \param[in] count /// The number of breakpoint hits to ignore. - //------------------------------------------------------------------ void SetIgnoreCount(uint32_t count); - //------------------------------------------------------------------ /// Return the current ignore count/ - /// @return + /// \return /// The number of breakpoint hits to be ignored. - //------------------------------------------------------------------ uint32_t GetIgnoreCount() const; - //------------------------------------------------------------------ - /// Return the current hit count for all locations. @return + /// Return the current hit count for all locations. \return /// The current hit count for all locations. - //------------------------------------------------------------------ uint32_t GetHitCount() const; - //------------------------------------------------------------------ /// If \a one_shot is \b true, breakpoint will be deleted on first hit. - //------------------------------------------------------------------ void SetOneShot(bool one_shot); - //------------------------------------------------------------------ /// Check the OneShot state. - /// @return + /// \return /// \b true if the breakpoint is one shot, \b false otherwise. - //------------------------------------------------------------------ bool IsOneShot() const; - //------------------------------------------------------------------ /// If \a auto_continue is \b true, breakpoint will auto-continue when on /// hit. - //------------------------------------------------------------------ void SetAutoContinue(bool auto_continue); - //------------------------------------------------------------------ /// Check the AutoContinue state. - /// @return + /// \return /// \b true if the breakpoint is set to auto-continue, \b false otherwise. - //------------------------------------------------------------------ bool IsAutoContinue() const; - //------------------------------------------------------------------ /// Set the valid thread to be checked when the breakpoint is hit. - /// @param[in] thread_id + /// \param[in] thread_id /// If this thread hits the breakpoint, we stop, otherwise not. - //------------------------------------------------------------------ void SetThreadID(lldb::tid_t thread_id); - //------------------------------------------------------------------ /// Return the current stop thread value. - /// @return + /// \return /// The thread id for which the breakpoint hit will stop, /// LLDB_INVALID_THREAD_ID for all threads. - //------------------------------------------------------------------ lldb::tid_t GetThreadID() const; void SetThreadIndex(uint32_t index); @@ -442,22 +362,20 @@ public: const char *GetQueueName() const; - //------------------------------------------------------------------ /// Set the callback action invoked when the breakpoint is hit. /// - /// @param[in] callback + /// \param[in] callback /// The method that will get called when the breakpoint is hit. - /// @param[in] baton + /// \param[in] baton /// A void * pointer that will get passed back to the callback function. - /// @param[in] is_synchronous + /// \param[in] is_synchronous /// If \b true the callback will be run on the private event thread /// before the stop event gets reported. If false, the callback will get /// handled on the public event thread after the stop has been posted. /// - /// @return + /// \return /// \b true if the process should stop when you hit the breakpoint. /// \b false if it should continue. - //------------------------------------------------------------------ void SetCallback(BreakpointHitCallback callback, void *baton, bool is_synchronous = false); @@ -467,92 +385,72 @@ public: void ClearCallback(); - //------------------------------------------------------------------ /// Set the breakpoint's condition. /// - /// @param[in] condition + /// \param[in] condition /// The condition expression to evaluate when the breakpoint is hit. /// Pass in nullptr to clear the condition. - //------------------------------------------------------------------ void SetCondition(const char *condition); - //------------------------------------------------------------------ /// Return a pointer to the text of the condition expression. /// - /// @return + /// \return /// A pointer to the condition expression text, or nullptr if no // condition has been set. - //------------------------------------------------------------------ const char *GetConditionText() const; - //------------------------------------------------------------------ // The next section are various utility functions. - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// Return the number of breakpoint locations that have resolved to actual /// breakpoint sites. /// - /// @return + /// \return /// The number locations resolved breakpoint sites. - //------------------------------------------------------------------ size_t GetNumResolvedLocations() const; - //------------------------------------------------------------------ /// Return whether this breakpoint has any resolved locations. /// - /// @return + /// \return /// True if GetNumResolvedLocations > 0 - //------------------------------------------------------------------ bool HasResolvedLocations() const; - //------------------------------------------------------------------ /// Return the number of breakpoint locations. /// - /// @return + /// \return /// The number breakpoint locations. - //------------------------------------------------------------------ size_t GetNumLocations() const; - //------------------------------------------------------------------ /// Put a description of this breakpoint into the stream \a s. /// - /// @param[in] s + /// \param[in] s /// Stream into which to dump the description. /// - /// @param[in] level + /// \param[in] level /// The description level that indicates the detail level to /// provide. /// - /// @see lldb::DescriptionLevel - //------------------------------------------------------------------ + /// \see lldb::DescriptionLevel void GetDescription(Stream *s, lldb::DescriptionLevel level, bool show_locations = false); - //------------------------------------------------------------------ /// Set the "kind" description for a breakpoint. If the breakpoint is hit /// the stop info will show this "kind" description instead of the /// breakpoint number. Mostly useful for internal breakpoints, where the /// breakpoint number doesn't have meaning to the user. /// - /// @param[in] kind + /// \param[in] kind /// New "kind" description. - //------------------------------------------------------------------ void SetBreakpointKind(const char *kind) { m_kind_description.assign(kind); } - //------------------------------------------------------------------ /// Return the "kind" description for a breakpoint. /// - /// @return + /// \return /// The breakpoint kind, or nullptr if none is set. - //------------------------------------------------------------------ const char *GetBreakpointKind() const { return m_kind_description.c_str(); } - //------------------------------------------------------------------ /// Accessor for the breakpoint Target. - /// @return + /// \return /// This breakpoint's Target. - //------------------------------------------------------------------ Target &GetTarget() { return m_target; } const Target &GetTarget() const { return m_target; } @@ -561,13 +459,12 @@ public: void GetResolverDescription(Stream *s); - //------------------------------------------------------------------ /// Find breakpoint locations which match the (filename, line_number) /// description. The breakpoint location collection is to be filled with the /// matching locations. It should be initialized with 0 size by the API /// client. /// - /// @return + /// \return /// True if there is a match /// /// The locations which match the filename and line_number in loc_coll. @@ -575,46 +472,39 @@ public: /// size is 0 and true is returned, it means the breakpoint fully matches /// the /// description. - //------------------------------------------------------------------ - bool GetMatchingFileLine(const ConstString &filename, uint32_t line_number, + bool GetMatchingFileLine(ConstString filename, uint32_t line_number, BreakpointLocationCollection &loc_coll); void GetFilterDescription(Stream *s); - //------------------------------------------------------------------ /// Returns the BreakpointOptions structure set at the breakpoint level. /// /// Meant to be used by the BreakpointLocation class. /// - /// @return + /// \return /// A pointer to this breakpoint's BreakpointOptions. - //------------------------------------------------------------------ BreakpointOptions *GetOptions(); - //------------------------------------------------------------------ /// Returns the BreakpointOptions structure set at the breakpoint level. /// /// Meant to be used by the BreakpointLocation class. /// - /// @return + /// \return /// A pointer to this breakpoint's BreakpointOptions. - //------------------------------------------------------------------ const BreakpointOptions *GetOptions() const; - //------------------------------------------------------------------ /// Invoke the callback action when the breakpoint is hit. /// /// Meant to be used by the BreakpointLocation class. /// - /// @param[in] context + /// \param[in] context /// Described the breakpoint event. /// - /// @param[in] bp_loc_id + /// \param[in] bp_loc_id /// Which breakpoint location hit this breakpoint. /// - /// @return + /// \return /// \b true if the target should stop at this breakpoint and \b false not. - //------------------------------------------------------------------ bool InvokeCallback(StoppointCallbackContext *context, lldb::break_id_t bp_loc_id); @@ -645,7 +535,6 @@ public: } } - //------------------------------------------------------------------ /// Set a pre-condition filter that overrides all user provided /// filters/callbacks etc. /// @@ -656,15 +545,14 @@ public: /// The Precondition should not continue the target, it should return true /// if the condition says to stop and false otherwise. /// - //------------------------------------------------------------------ - void SetPrecondition(BreakpointPreconditionSP precondition_sp) { + void SetPrecondition(lldb::BreakpointPreconditionSP precondition_sp) { m_precondition_sp = precondition_sp; } bool EvaluatePrecondition(StoppointCallbackContext &context); - BreakpointPreconditionSP GetPrecondition() { return m_precondition_sp; } - + lldb::BreakpointPreconditionSP GetPrecondition() { return m_precondition_sp; } + // Produces the OR'ed values for all the names assigned to this breakpoint. const BreakpointName::Permissions &GetPermissions() const { return m_permissions; @@ -686,39 +574,35 @@ public: protected: friend class Target; - //------------------------------------------------------------------ // Protected Methods - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// Constructors and Destructors /// Only the Target can make a breakpoint, and it owns the breakpoint /// lifespans. The constructor takes a filter and a resolver. Up in Target /// there are convenience variants that make breakpoints for some common /// cases. /// - /// @param[in] target + /// \param[in] target /// The target in which the breakpoint will be set. /// - /// @param[in] filter_sp + /// \param[in] filter_sp /// Shared pointer to the search filter that restricts the search domain of /// the breakpoint. /// - /// @param[in] resolver_sp + /// \param[in] resolver_sp /// Shared pointer to the resolver object that will determine breakpoint /// matches. /// - /// @param hardware + /// \param hardware /// If true, request a hardware breakpoint to be used to implement the /// breakpoint locations. /// - /// @param resolve_indirect_symbols + /// \param resolve_indirect_symbols /// If true, and the address of a given breakpoint location in this /// breakpoint is set on an /// indirect symbol (i.e. Symbol::IsIndirect returns true) then the actual /// breakpoint site will /// be set on the target of the indirect symbol. - //------------------------------------------------------------------ // This is the generic constructor Breakpoint(Target &target, lldb::SearchFilterSP &filter_sp, lldb::BreakpointResolverSP &resolver_sp, bool hardware, @@ -749,9 +633,7 @@ private: // target - primarily from the dummy target to prime new targets. Breakpoint(Target &new_target, Breakpoint &bp_to_copy_from); - //------------------------------------------------------------------ // For Breakpoint only - //------------------------------------------------------------------ bool m_being_created; bool m_hardware; // If this breakpoint is required to use a hardware breakpoint @@ -764,9 +646,9 @@ private: m_filter_sp; // The filter that constrains the breakpoint's domain. lldb::BreakpointResolverSP m_resolver_sp; // The resolver that defines this breakpoint. - BreakpointPreconditionSP m_precondition_sp; // The precondition is a - // breakpoint-level hit filter - // that can be used + lldb::BreakpointPreconditionSP m_precondition_sp; // The precondition is a + // breakpoint-level hit + // filter that can be used // to skip certain breakpoint hits. For instance, exception breakpoints use // this to limit the stop to certain exception classes, while leaving the // condition & callback free for user specification. diff --git a/include/lldb/Breakpoint/BreakpointID.h b/include/lldb/Breakpoint/BreakpointID.h index 5acb942ed2ad..095132988eb2 100644 --- a/include/lldb/Breakpoint/BreakpointID.h +++ b/include/lldb/Breakpoint/BreakpointID.h @@ -1,9 +1,8 @@ //===-- BreakpointID.h ------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -19,9 +18,7 @@ namespace lldb_private { -//---------------------------------------------------------------------- // class BreakpointID -//---------------------------------------------------------------------- class BreakpointID { public: @@ -51,49 +48,43 @@ public: static bool IsValidIDExpression(llvm::StringRef str); static llvm::ArrayRef<llvm::StringRef> GetRangeSpecifiers(); - //------------------------------------------------------------------ /// Takes an input string containing the description of a breakpoint or /// breakpoint and location and returns a BreakpointID filled out with /// the proper id and location. /// - /// @param[in] input + /// \param[in] input /// A string containing JUST the breakpoint description. - /// @return + /// \return /// If \p input was not a valid breakpoint ID string, returns /// \b llvm::None. Otherwise returns a BreakpointID with members filled /// out accordingly. - //------------------------------------------------------------------ static llvm::Optional<BreakpointID> ParseCanonicalReference(llvm::StringRef input); - //------------------------------------------------------------------ /// Takes an input string and checks to see whether it is a breakpoint name. /// If it is a mal-formed breakpoint name, error will be set to an appropriate /// error string. /// - /// @param[in] input + /// \param[in] input /// A string containing JUST the breakpoint description. - /// @param[out] error + /// \param[out] error /// If the name is a well-formed breakpoint name, set to success, /// otherwise set to an error. - /// @return + /// \return /// \b true if the name is a breakpoint name (as opposed to an ID or /// range) false otherwise. - //------------------------------------------------------------------ static bool StringIsBreakpointName(llvm::StringRef str, Status &error); - //------------------------------------------------------------------ /// Takes a breakpoint ID and the breakpoint location id and returns /// a string containing the canonical description for the breakpoint /// or breakpoint location. /// - /// @param[out] break_id + /// \param[out] break_id /// This is the break id. /// - /// @param[out] break_loc_id + /// \param[out] break_loc_id /// This is breakpoint location id, or LLDB_INVALID_BREAK_ID is no /// location is to be specified. - //------------------------------------------------------------------ static void GetCanonicalReference(Stream *s, lldb::break_id_t break_id, lldb::break_id_t break_loc_id); diff --git a/include/lldb/Breakpoint/BreakpointIDList.h b/include/lldb/Breakpoint/BreakpointIDList.h index 2820b9fdcaa5..c6429220c7ff 100644 --- a/include/lldb/Breakpoint/BreakpointIDList.h +++ b/include/lldb/Breakpoint/BreakpointIDList.h @@ -1,9 +1,8 @@ //===-- BreakpointIDList.h --------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -21,9 +20,7 @@ namespace lldb_private { -//---------------------------------------------------------------------- // class BreakpointIDList -//---------------------------------------------------------------------- class BreakpointIDList { public: diff --git a/include/lldb/Breakpoint/BreakpointList.h b/include/lldb/Breakpoint/BreakpointList.h index c4fc650a29f0..fe10adbda8a6 100644 --- a/include/lldb/Breakpoint/BreakpointList.h +++ b/include/lldb/Breakpoint/BreakpointList.h @@ -1,9 +1,8 @@ //===-- BreakpointList.h ----------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -17,15 +16,11 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class BreakpointList BreakpointList.h "lldb/Breakpoint/BreakpointList.h" +/// \class BreakpointList BreakpointList.h "lldb/Breakpoint/BreakpointList.h" /// This class manages a list of breakpoints. -//---------------------------------------------------------------------- -//---------------------------------------------------------------------- /// General Outline: /// Allows adding and removing breakpoints and find by ID and index. -//---------------------------------------------------------------------- class BreakpointList { public: @@ -33,81 +28,66 @@ public: ~BreakpointList(); - //------------------------------------------------------------------ /// Add the breakpoint \a bp_sp to the list. /// - /// @param[in] bp_sp + /// \param[in] bp_sp /// Shared pointer to the breakpoint that will get added to the list. /// - /// @result + /// \result /// Returns breakpoint id. - //------------------------------------------------------------------ lldb::break_id_t Add(lldb::BreakpointSP &bp_sp, bool notify); - //------------------------------------------------------------------ /// Standard "Dump" method. At present it does nothing. - //------------------------------------------------------------------ void Dump(Stream *s) const; - //------------------------------------------------------------------ /// Returns a shared pointer to the breakpoint with id \a breakID. Const /// version. /// - /// @param[in] breakID + /// \param[in] breakID /// The breakpoint ID to seek for. /// - /// @result + /// \result /// A shared pointer to the breakpoint. May contain a NULL pointer if the /// breakpoint doesn't exist. - //------------------------------------------------------------------ lldb::BreakpointSP FindBreakpointByID(lldb::break_id_t breakID) const; - //------------------------------------------------------------------ /// Returns a shared pointer to the breakpoint with index \a i. /// - /// @param[in] i + /// \param[in] i /// The breakpoint index to seek for. /// - /// @result + /// \result /// A shared pointer to the breakpoint. May contain a NULL pointer if the /// breakpoint doesn't exist. - //------------------------------------------------------------------ lldb::BreakpointSP GetBreakpointAtIndex(size_t i) const; - //------------------------------------------------------------------ /// Find all the breakpoints with a given name /// - /// @param[in] name + /// \param[in] name /// The breakpoint name for which to search. /// - /// @result + /// \result /// \bfalse if the input name was not a legal breakpoint name. - //------------------------------------------------------------------ bool FindBreakpointsByName(const char *name, BreakpointList &matching_bps); - //------------------------------------------------------------------ /// Returns the number of elements in this breakpoint list. /// - /// @result + /// \result /// The number of elements. - //------------------------------------------------------------------ size_t GetSize() const { std::lock_guard<std::recursive_mutex> guard(m_mutex); return m_breakpoints.size(); } - //------------------------------------------------------------------ /// Removes the breakpoint given by \b breakID from this list. /// - /// @param[in] breakID + /// \param[in] breakID /// The breakpoint index to remove. /// - /// @result + /// \result /// \b true if the breakpoint \a breakID was in the list. - //------------------------------------------------------------------ bool Remove(lldb::break_id_t breakID, bool notify); - //------------------------------------------------------------------ /// Removes all invalid breakpoint locations. /// /// Removes all breakpoint locations in the list with architectures that @@ -118,43 +98,36 @@ public: /// This is typically used after the process calls exec, or anytime the /// architecture of the target changes. /// - /// @param[in] arch + /// \param[in] arch /// If valid, check the module in each breakpoint to make sure /// they are compatible, otherwise, ignore architecture. - //------------------------------------------------------------------ void RemoveInvalidLocations(const ArchSpec &arch); void SetEnabledAll(bool enabled); void SetEnabledAllowed(bool enabled); - //------------------------------------------------------------------ /// Removes all the breakpoints from this list. - //------------------------------------------------------------------ void RemoveAll(bool notify); - //------------------------------------------------------------------ /// Removes all the breakpoints from this list - first checking the /// ePermDelete on the breakpoints. This call should be used unless you are /// shutting down and need to actually clear them all. - //------------------------------------------------------------------ void RemoveAllowed(bool notify); - //------------------------------------------------------------------ /// Tell all the breakpoints to update themselves due to a change in the /// modules in \a module_list. \a added says whether the module was loaded /// or unloaded. /// - /// @param[in] module_list + /// \param[in] module_list /// The module list that has changed. /// - /// @param[in] load + /// \param[in] load /// \b true if the modules are loaded, \b false if unloaded. /// - /// @param[in] delete_locations + /// \param[in] delete_locations /// If \a load is \b false, then delete breakpoint locations when /// when updating breakpoints. - //------------------------------------------------------------------ void UpdateBreakpoints(ModuleList &module_list, bool load, bool delete_locations); @@ -163,12 +136,10 @@ public: void ClearAllBreakpointSites(); - //------------------------------------------------------------------ /// Sets the passed in Locker to hold the Breakpoint List mutex. /// - /// @param[in] locker + /// \param[in] locker /// The locker object that is set. - //------------------------------------------------------------------ void GetListMutex(std::unique_lock<std::recursive_mutex> &lock); protected: diff --git a/include/lldb/Breakpoint/BreakpointLocation.h b/include/lldb/Breakpoint/BreakpointLocation.h index 6448cb16e927..7b27160563a0 100644 --- a/include/lldb/Breakpoint/BreakpointLocation.h +++ b/include/lldb/Breakpoint/BreakpointLocation.h @@ -1,9 +1,8 @@ //===-- BreakpointLocation.h ------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -21,13 +20,10 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class BreakpointLocation BreakpointLocation.h +/// \class BreakpointLocation BreakpointLocation.h /// "lldb/Breakpoint/BreakpointLocation.h" Class that manages one unique (by /// address) instance of a logical breakpoint. -//---------------------------------------------------------------------- -//---------------------------------------------------------------------- /// General Outline: /// A breakpoint location is defined by the breakpoint that produces it, /// and the address that resulted in this particular instantiation. Each @@ -37,7 +33,6 @@ namespace lldb_private { /// FIXME: Should we also store some fingerprint for the location, so /// we can map one location to the "equivalent location" on rerun? This would /// be useful if you've set options on the locations. -//---------------------------------------------------------------------- class BreakpointLocation : public std::enable_shared_from_this<BreakpointLocation>, @@ -45,100 +40,76 @@ class BreakpointLocation public: ~BreakpointLocation() override; - //------------------------------------------------------------------ - /// Gets the load address for this breakpoint location @return + /// Gets the load address for this breakpoint location \return /// Returns breakpoint location load address, \b /// LLDB_INVALID_ADDRESS if not yet set. - //------------------------------------------------------------------ lldb::addr_t GetLoadAddress() const override; - //------------------------------------------------------------------ - /// Gets the Address for this breakpoint location @return + /// Gets the Address for this breakpoint location \return /// Returns breakpoint location Address. - //------------------------------------------------------------------ Address &GetAddress(); - //------------------------------------------------------------------ - /// Gets the Breakpoint that created this breakpoint location @return + /// Gets the Breakpoint that created this breakpoint location \return /// Returns the owning breakpoint. - //------------------------------------------------------------------ Breakpoint &GetBreakpoint(); Target &GetTarget(); - //------------------------------------------------------------------ /// Determines whether we should stop due to a hit at this breakpoint /// location. /// /// Side Effects: This may evaluate the breakpoint condition, and run the /// callback. So this command may do a considerable amount of work. /// - /// @return + /// \return /// \b true if this breakpoint location thinks we should stop, /// \b false otherwise. - //------------------------------------------------------------------ bool ShouldStop(StoppointCallbackContext *context) override; - //------------------------------------------------------------------ // The next section deals with various breakpoint options. - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// If \a enable is \b true, enable the breakpoint, if \b false disable it. - //------------------------------------------------------------------ void SetEnabled(bool enabled); - //------------------------------------------------------------------ /// Check the Enable/Disable state. /// - /// @return + /// \return /// \b true if the breakpoint is enabled, \b false if disabled. - //------------------------------------------------------------------ bool IsEnabled() const; - //------------------------------------------------------------------ /// If \a auto_continue is \b true, set the breakpoint to continue when hit. - //------------------------------------------------------------------ void SetAutoContinue(bool auto_continue); - //------------------------------------------------------------------ /// Check the AutoContinue state. /// - /// @return + /// \return /// \b true if the breakpoint is set to auto-continue, \b false if not. - //------------------------------------------------------------------ bool IsAutoContinue() const; - //------------------------------------------------------------------ /// Return the current Ignore Count. /// - /// @return + /// \return /// The number of breakpoint hits to be ignored. - //------------------------------------------------------------------ uint32_t GetIgnoreCount(); - //------------------------------------------------------------------ /// Set the breakpoint to ignore the next \a count breakpoint hits. /// - /// @param[in] count + /// \param[in] count /// The number of breakpoint hits to ignore. - //------------------------------------------------------------------ void SetIgnoreCount(uint32_t n); - //------------------------------------------------------------------ /// Set the callback action invoked when the breakpoint is hit. /// /// The callback will return a bool indicating whether the target should /// stop at this breakpoint or not. /// - /// @param[in] callback + /// \param[in] callback /// The method that will get called when the breakpoint is hit. /// - /// @param[in] callback_baton_sp + /// \param[in] callback_baton_sp /// A shared pointer to a Baton that provides the void * needed /// for the callback. /// - /// @see lldb_private::Baton - //------------------------------------------------------------------ + /// \see lldb_private::Baton void SetCallback(BreakpointHitCallback callback, const lldb::BatonSP &callback_baton_sp, bool is_synchronous); @@ -147,31 +118,25 @@ public: void ClearCallback(); - //------------------------------------------------------------------ /// Set the breakpoint location's condition. /// - /// @param[in] condition + /// \param[in] condition /// The condition expression to evaluate when the breakpoint is hit. - //------------------------------------------------------------------ void SetCondition(const char *condition); - //------------------------------------------------------------------ /// Return a pointer to the text of the condition expression. /// - /// @return + /// \return /// A pointer to the condition expression text, or nullptr if no // condition has been set. - //------------------------------------------------------------------ const char *GetConditionText(size_t *hash = nullptr) const; bool ConditionSaysStop(ExecutionContext &exe_ctx, Status &error); - //------------------------------------------------------------------ /// Set the valid thread to be checked when the breakpoint is hit. /// - /// @param[in] thread_id + /// \param[in] thread_id /// If this thread hits the breakpoint, we stop, otherwise not. - //------------------------------------------------------------------ void SetThreadID(lldb::tid_t thread_id); lldb::tid_t GetThreadID(); @@ -188,150 +153,122 @@ public: const char *GetQueueName() const; - //------------------------------------------------------------------ // The next section deals with this location's breakpoint sites. - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// Try to resolve the breakpoint site for this location. /// - /// @return + /// \return /// \b true if we were successful at setting a breakpoint site, /// \b false otherwise. - //------------------------------------------------------------------ bool ResolveBreakpointSite(); - //------------------------------------------------------------------ /// Clear this breakpoint location's breakpoint site - for instance when /// disabling the breakpoint. /// - /// @return + /// \return /// \b true if there was a breakpoint site to be cleared, \b false /// otherwise. - //------------------------------------------------------------------ bool ClearBreakpointSite(); - //------------------------------------------------------------------ - /// Return whether this breakpoint location has a breakpoint site. @return + /// Return whether this breakpoint location has a breakpoint site. \return /// \b true if there was a breakpoint site for this breakpoint /// location, \b false otherwise. - //------------------------------------------------------------------ bool IsResolved() const; lldb::BreakpointSiteSP GetBreakpointSite() const; - //------------------------------------------------------------------ // The next section are generic report functions. - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// Print a description of this breakpoint location to the stream \a s. /// - /// @param[in] s + /// \param[in] s /// The stream to which to print the description. /// - /// @param[in] level + /// \param[in] level /// The description level that indicates the detail level to /// provide. /// - /// @see lldb::DescriptionLevel - //------------------------------------------------------------------ + /// \see lldb::DescriptionLevel void GetDescription(Stream *s, lldb::DescriptionLevel level); - //------------------------------------------------------------------ /// Standard "Dump" method. At present it does nothing. - //------------------------------------------------------------------ void Dump(Stream *s) const override; - //------------------------------------------------------------------ /// Use this to set location specific breakpoint options. /// /// It will create a copy of the containing breakpoint's options if that /// hasn't been done already /// - /// @return + /// \return /// A pointer to the breakpoint options. - //------------------------------------------------------------------ BreakpointOptions *GetLocationOptions(); - //------------------------------------------------------------------ /// Use this to access breakpoint options from this breakpoint location. /// This will return the options that have a setting for the specified /// BreakpointOptions kind. /// - /// @param[in] kind + /// \param[in] kind /// The particular option you are looking up. - /// @return + /// \return /// A pointer to the containing breakpoint's options if this /// location doesn't have its own copy. - //------------------------------------------------------------------ const BreakpointOptions *GetOptionsSpecifyingKind( BreakpointOptions::OptionKind kind) const; bool ValidForThisThread(Thread *thread); - //------------------------------------------------------------------ /// Invoke the callback action when the breakpoint is hit. /// /// Meant to be used by the BreakpointLocation class. /// - /// @param[in] context + /// \param[in] context /// Described the breakpoint event. /// - /// @param[in] bp_loc_id + /// \param[in] bp_loc_id /// Which breakpoint location hit this breakpoint. /// - /// @return + /// \return /// \b true if the target should stop at this breakpoint and \b /// false not. - //------------------------------------------------------------------ bool InvokeCallback(StoppointCallbackContext *context); - //------------------------------------------------------------------ /// Returns whether we should resolve Indirect functions in setting the /// breakpoint site for this location. /// - /// @return + /// \return /// \b true if the breakpoint SITE for this location should be set on the /// resolved location for Indirect functions. - //------------------------------------------------------------------ bool ShouldResolveIndirectFunctions() { return m_should_resolve_indirect_functions; } - //------------------------------------------------------------------ /// Returns whether the address set in the breakpoint site for this location /// was found by resolving an indirect symbol. /// - /// @return + /// \return /// \b true or \b false as given in the description above. - //------------------------------------------------------------------ bool IsIndirect() { return m_is_indirect; } void SetIsIndirect(bool is_indirect) { m_is_indirect = is_indirect; } - //------------------------------------------------------------------ /// Returns whether the address set in the breakpoint location was re-routed /// to the target of a re-exported symbol. /// - /// @return + /// \return /// \b true or \b false as given in the description above. - //------------------------------------------------------------------ bool IsReExported() { return m_is_reexported; } void SetIsReExported(bool is_reexported) { m_is_reexported = is_reexported; } - //------------------------------------------------------------------ /// Returns whether the two breakpoint locations might represent "equivalent /// locations". This is used when modules changed to determine if a Location /// in the old module might be the "same as" the input location. /// - /// @param[in] location + /// \param[in] location /// The location to compare against. /// - /// @return + /// \return /// \b true or \b false as given in the description above. - //------------------------------------------------------------------ bool EquivalentToLocation(BreakpointLocation &location); protected: @@ -340,16 +277,14 @@ protected: friend class Process; friend class StopInfoBreakpoint; - //------------------------------------------------------------------ /// Set the breakpoint site for this location to \a bp_site_sp. /// - /// @param[in] bp_site_sp + /// \param[in] bp_site_sp /// The breakpoint site we are setting for this location. /// - /// @return + /// \return /// \b true if we were successful at setting the breakpoint site, /// \b false otherwise. - //------------------------------------------------------------------ bool SetBreakpointSite(lldb::BreakpointSiteSP &bp_site_sp); void DecrementIgnoreCount(); @@ -363,46 +298,40 @@ private: void UndoBumpHitCount(); - //------------------------------------------------------------------ // Constructors and Destructors // // Only the Breakpoint can make breakpoint locations, and it owns them. - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// Constructor. /// - /// @param[in] owner + /// \param[in] owner /// A back pointer to the breakpoint that owns this location. /// - /// @param[in] addr + /// \param[in] addr /// The Address defining this location. /// - /// @param[in] tid + /// \param[in] tid /// The thread for which this breakpoint location is valid, or /// LLDB_INVALID_THREAD_ID if it is valid for all threads. /// - /// @param[in] hardware + /// \param[in] hardware /// \b true if a hardware breakpoint is requested. - //------------------------------------------------------------------ BreakpointLocation(lldb::break_id_t bid, Breakpoint &owner, const Address &addr, lldb::tid_t tid, bool hardware, bool check_for_resolver = true); - //------------------------------------------------------------------ // Data members: - //------------------------------------------------------------------ bool m_being_created; bool m_should_resolve_indirect_functions; bool m_is_reexported; bool m_is_indirect; Address m_address; ///< The address defining this location. Breakpoint &m_owner; ///< The breakpoint that produced this object. - std::unique_ptr<BreakpointOptions> m_options_ap; ///< Breakpoint options - ///pointer, nullptr if we're - ///using our breakpoint's - ///options. + std::unique_ptr<BreakpointOptions> m_options_up; ///< 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 diff --git a/include/lldb/Breakpoint/BreakpointLocationCollection.h b/include/lldb/Breakpoint/BreakpointLocationCollection.h index 5a188539622b..3da52eb7962a 100644 --- a/include/lldb/Breakpoint/BreakpointLocationCollection.h +++ b/include/lldb/Breakpoint/BreakpointLocationCollection.h @@ -1,9 +1,8 @@ //===-- BreakpointLocationCollection.h --------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -23,165 +22,141 @@ public: BreakpointLocationCollection(); ~BreakpointLocationCollection(); + + BreakpointLocationCollection &operator=(const BreakpointLocationCollection &rhs); - //------------------------------------------------------------------ /// Add the breakpoint \a bp_loc_sp to the list. /// - /// @param[in] bp_sp + /// \param[in] bp_sp /// Shared pointer to the breakpoint location that will get added /// to the list. /// - /// @result + /// \result /// Returns breakpoint location id. - //------------------------------------------------------------------ void Add(const lldb::BreakpointLocationSP &bp_loc_sp); - //------------------------------------------------------------------ /// Removes the breakpoint location given by \b breakID from this /// list. /// - /// @param[in] break_id + /// \param[in] break_id /// The breakpoint index to remove. /// - /// @param[in] break_loc_id + /// \param[in] break_loc_id /// The breakpoint location index in break_id to remove. /// - /// @result + /// \result /// \b true if the breakpoint was in the list. - //------------------------------------------------------------------ bool Remove(lldb::break_id_t break_id, lldb::break_id_t break_loc_id); - //------------------------------------------------------------------ /// Returns a shared pointer to the breakpoint location with id \a /// breakID. /// - /// @param[in] break_id + /// \param[in] break_id /// The breakpoint ID to seek for. /// - /// @param[in] break_loc_id + /// \param[in] break_loc_id /// The breakpoint location ID in \a break_id to seek for. /// - /// @result + /// \result /// A shared pointer to the breakpoint. May contain a NULL /// pointer if the breakpoint doesn't exist. - //------------------------------------------------------------------ lldb::BreakpointLocationSP FindByIDPair(lldb::break_id_t break_id, lldb::break_id_t break_loc_id); - //------------------------------------------------------------------ /// Returns a shared pointer to the breakpoint location with id \a /// breakID, const version. /// - /// @param[in] breakID + /// \param[in] breakID /// The breakpoint location ID to seek for. /// - /// @param[in] break_loc_id + /// \param[in] break_loc_id /// The breakpoint location ID in \a break_id to seek for. /// - /// @result + /// \result /// A shared pointer to the breakpoint. May contain a NULL /// pointer if the breakpoint doesn't exist. - //------------------------------------------------------------------ const lldb::BreakpointLocationSP FindByIDPair(lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const; - //------------------------------------------------------------------ /// Returns a shared pointer to the breakpoint location with index /// \a i. /// - /// @param[in] i + /// \param[in] i /// The breakpoint location index to seek for. /// - /// @result + /// \result /// A shared pointer to the breakpoint. May contain a NULL /// pointer if the breakpoint doesn't exist. - //------------------------------------------------------------------ lldb::BreakpointLocationSP GetByIndex(size_t i); - //------------------------------------------------------------------ /// Returns a shared pointer to the breakpoint location with index /// \a i, const version. /// - /// @param[in] i + /// \param[in] i /// The breakpoint location index to seek for. /// - /// @result + /// \result /// A shared pointer to the breakpoint. May contain a NULL /// pointer if the breakpoint doesn't exist. - //------------------------------------------------------------------ const lldb::BreakpointLocationSP GetByIndex(size_t i) const; - //------------------------------------------------------------------ /// Returns the number of elements in this breakpoint location list. /// - /// @result + /// \result /// The number of elements. - //------------------------------------------------------------------ size_t GetSize() const { return m_break_loc_collection.size(); } - //------------------------------------------------------------------ /// Enquires of all the breakpoint locations in this list whether /// we should stop at a hit at \a breakID. /// - /// @param[in] context + /// \param[in] context /// This contains the information about this stop. /// - /// @param[in] breakID + /// \param[in] breakID /// This break ID that we hit. /// - /// @return + /// \return /// \b true if we should stop, \b false otherwise. - //------------------------------------------------------------------ bool ShouldStop(StoppointCallbackContext *context); - //------------------------------------------------------------------ /// Print a description of the breakpoint locations in this list /// to the stream \a s. /// - /// @param[in] s + /// \param[in] s /// The stream to which to print the description. /// - /// @param[in] level + /// \param[in] level /// The description level that indicates the detail level to /// provide. /// - /// @see lldb::DescriptionLevel - //------------------------------------------------------------------ + /// \see lldb::DescriptionLevel void GetDescription(Stream *s, lldb::DescriptionLevel level); - //------------------------------------------------------------------ /// Check whether this collection of breakpoint locations have any /// thread specifiers, and if yes, is \a thread_id contained in any /// of these specifiers. /// - /// @param[in] thread + /// \param[in] thread /// The thread against which to test. /// /// return /// \b true if the collection contains at least one location that /// would be valid for this thread, false otherwise. - //------------------------------------------------------------------ bool ValidForThisThread(Thread *thread); - //------------------------------------------------------------------ /// Tell whether ALL the breakpoints in the location collection are internal. /// - /// @result + /// \result /// \b true if all breakpoint locations are owned by internal breakpoints, /// \b false otherwise. - //------------------------------------------------------------------ bool IsInternal() const; protected: - //------------------------------------------------------------------ // Classes that inherit from BreakpointLocationCollection can see and modify // these - //------------------------------------------------------------------ private: - //------------------------------------------------------------------ // For BreakpointLocationCollection only - //------------------------------------------------------------------ typedef std::vector<lldb::BreakpointLocationSP> collection; diff --git a/include/lldb/Breakpoint/BreakpointLocationList.h b/include/lldb/Breakpoint/BreakpointLocationList.h index 01ee5b5dcce9..b7e0e49cff83 100644 --- a/include/lldb/Breakpoint/BreakpointLocationList.h +++ b/include/lldb/Breakpoint/BreakpointLocationList.h @@ -1,9 +1,8 @@ //===-- BreakpointLocationList.h --------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -20,12 +19,10 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class BreakpointLocationList BreakpointLocationList.h +/// \class BreakpointLocationList BreakpointLocationList.h /// "lldb/Breakpoint/BreakpointLocationList.h" This class is used by /// Breakpoint to manage a list of breakpoint locations, each breakpoint /// location in the list has a unique ID, and is unique by Address as well. -//---------------------------------------------------------------------- class BreakpointLocationList { // Only Breakpoints can make the location list, or add elements to it. This // is not just some random collection of locations. Rather, the act of @@ -37,178 +34,146 @@ class BreakpointLocationList { public: virtual ~BreakpointLocationList(); - //------------------------------------------------------------------ /// Standard "Dump" method. At present it does nothing. - //------------------------------------------------------------------ void Dump(Stream *s) const; - //------------------------------------------------------------------ /// Returns a shared pointer to the breakpoint location at address \a addr - /// const version. /// - /// @param[in] addr + /// \param[in] addr /// The address to look for. /// - /// @result + /// \result /// A shared pointer to the breakpoint. May contain a nullptr /// pointer if the breakpoint doesn't exist. - //------------------------------------------------------------------ const lldb::BreakpointLocationSP FindByAddress(const Address &addr) const; - //------------------------------------------------------------------ /// Returns a shared pointer to the breakpoint location with id \a breakID, /// const version. /// - /// @param[in] breakID + /// \param[in] breakID /// The breakpoint location ID to seek for. /// - /// @result + /// \result /// A shared pointer to the breakpoint. May contain a nullptr /// pointer if the breakpoint doesn't exist. - //------------------------------------------------------------------ lldb::BreakpointLocationSP FindByID(lldb::break_id_t breakID) const; - //------------------------------------------------------------------ /// Returns the breakpoint location id to the breakpoint location at address /// \a addr. /// - /// @param[in] addr + /// \param[in] addr /// The address to match. /// - /// @result + /// \result /// The ID of the breakpoint location, or LLDB_INVALID_BREAK_ID. - //------------------------------------------------------------------ lldb::break_id_t FindIDByAddress(const Address &addr); - //------------------------------------------------------------------ /// Returns a breakpoint location list of the breakpoint locations in the /// module \a module. This list is allocated, and owned by the caller. /// - /// @param[in] module + /// \param[in] module /// The module to seek in. /// - /// @param[in] + /// \param[in] /// A breakpoint collection that gets any breakpoint locations /// that match \a module appended to. /// - /// @result + /// \result /// The number of matches - //------------------------------------------------------------------ size_t FindInModule(Module *module, BreakpointLocationCollection &bp_loc_list); - //------------------------------------------------------------------ /// Returns a shared pointer to the breakpoint location with index \a i. /// - /// @param[in] i + /// \param[in] i /// The breakpoint location index to seek for. /// - /// @result + /// \result /// A shared pointer to the breakpoint. May contain a nullptr /// pointer if the breakpoint doesn't exist. - //------------------------------------------------------------------ lldb::BreakpointLocationSP GetByIndex(size_t i); - //------------------------------------------------------------------ /// Returns a shared pointer to the breakpoint location with index \a i, /// const version. /// - /// @param[in] i + /// \param[in] i /// The breakpoint location index to seek for. /// - /// @result + /// \result /// A shared pointer to the breakpoint. May contain a nullptr /// pointer if the breakpoint doesn't exist. - //------------------------------------------------------------------ const lldb::BreakpointLocationSP GetByIndex(size_t i) const; - //------------------------------------------------------------------ /// Removes all the locations in this list from their breakpoint site owners /// list. - //------------------------------------------------------------------ void ClearAllBreakpointSites(); - //------------------------------------------------------------------ /// Tells all the breakpoint locations in this list to attempt to resolve /// any possible breakpoint sites. - //------------------------------------------------------------------ void ResolveAllBreakpointSites(); - //------------------------------------------------------------------ /// Returns the number of breakpoint locations in this list with resolved /// breakpoints. /// - /// @result + /// \result /// Number of qualifying breakpoint locations. - //------------------------------------------------------------------ size_t GetNumResolvedLocations() const; - //------------------------------------------------------------------ /// Returns the number hit count of all locations in this list. /// - /// @result + /// \result /// Hit count of all locations in this list. - //------------------------------------------------------------------ uint32_t GetHitCount() const; - //------------------------------------------------------------------ /// Enquires of the breakpoint location in this list with ID \a breakID /// whether we should stop. /// - /// @param[in] context + /// \param[in] context /// This contains the information about this stop. /// - /// @param[in] breakID + /// \param[in] breakID /// This break ID that we hit. /// - /// @return + /// \return /// \b true if we should stop, \b false otherwise. - //------------------------------------------------------------------ bool ShouldStop(StoppointCallbackContext *context, lldb::break_id_t breakID); - //------------------------------------------------------------------ /// Returns the number of elements in this breakpoint location list. /// - /// @result + /// \result /// The number of elements. - //------------------------------------------------------------------ size_t GetSize() const { return m_locations.size(); } - //------------------------------------------------------------------ /// Print a description of the breakpoint locations in this list to the /// stream \a s. /// - /// @param[in] s + /// \param[in] s /// The stream to which to print the description. /// - /// @param[in] level + /// \param[in] level /// The description level that indicates the detail level to /// provide. /// - /// @see lldb::DescriptionLevel - //------------------------------------------------------------------ + /// \see lldb::DescriptionLevel void GetDescription(Stream *s, lldb::DescriptionLevel level); protected: - //------------------------------------------------------------------ /// This is the standard constructor. /// /// It creates an empty breakpoint location list. It is protected here /// because only Breakpoints are allowed to create the breakpoint location /// list. - //------------------------------------------------------------------ BreakpointLocationList(Breakpoint &owner); - //------------------------------------------------------------------ /// Add the breakpoint \a bp_loc_sp to the list. /// - /// @param[in] bp_sp + /// \param[in] bp_sp /// Shared pointer to the breakpoint location that will get /// added to the list. /// - /// @result + /// \result /// Returns breakpoint location id. - //------------------------------------------------------------------ lldb::BreakpointLocationSP Create(const Address &addr, bool resolve_indirect_symbols); diff --git a/include/lldb/Breakpoint/BreakpointName.h b/include/lldb/Breakpoint/BreakpointName.h index 5e5a04fe9117..61020a628070 100644 --- a/include/lldb/Breakpoint/BreakpointName.h +++ b/include/lldb/Breakpoint/BreakpointName.h @@ -1,9 +1,8 @@ //===-- BreakpointName.h --------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -137,13 +136,13 @@ public: } }; - BreakpointName(const ConstString &name, const char *help = nullptr) : + BreakpointName(ConstString name, const char *help = nullptr) : m_name(name), m_options(false) { SetHelp(help); } - BreakpointName(const ConstString &name, + BreakpointName(ConstString name, BreakpointOptions &options, const Permissions &permissions = Permissions(), const char *help = nullptr) : @@ -157,10 +156,10 @@ public: m_permissions(rhs.m_permissions), m_help(rhs.m_help) {} - BreakpointName(const ConstString &name, const Breakpoint &bkpt, + BreakpointName(ConstString name, const Breakpoint &bkpt, const char *help); - const ConstString &GetName() const { return m_name; } + ConstString GetName() const { return m_name; } BreakpointOptions &GetOptions() { return m_options; } const BreakpointOptions &GetOptions() const { return m_options; } diff --git a/include/lldb/Breakpoint/BreakpointOptions.h b/include/lldb/Breakpoint/BreakpointOptions.h index e91df20ed305..cdac5d3dbd75 100644 --- a/include/lldb/Breakpoint/BreakpointOptions.h +++ b/include/lldb/Breakpoint/BreakpointOptions.h @@ -1,9 +1,8 @@ //===-- BreakpointOptions.h -------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -21,11 +20,9 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class BreakpointOptions BreakpointOptions.h +/// \class BreakpointOptions BreakpointOptions.h /// "lldb/Breakpoint/BreakpointOptions.h" Class that manages the options on a /// breakpoint or breakpoint location. -//---------------------------------------------------------------------- class BreakpointOptions { friend class BreakpointLocation; @@ -96,32 +93,26 @@ public: typedef std::shared_ptr<CommandBaton> CommandBatonSP; - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// This constructor allows you to specify all the breakpoint options except /// the callback. That one is more complicated, and better to do by hand. /// - /// @param[in] condition + /// \param[in] condition /// The expression which if it evaluates to \b true if we are to stop /// - /// @param[in] enabled + /// \param[in] enabled /// Is this breakpoint enabled. /// - /// @param[in] ignore + /// \param[in] ignore /// How many breakpoint hits we should ignore before stopping. /// - //------------------------------------------------------------------ BreakpointOptions(const char *condition, bool enabled = true, int32_t ignore = 0, bool one_shot = false, bool auto_continue = false); - //------------------------------------------------------------------ /// Breakpoints make options with all flags set. Locations and Names make /// options with no flags set. - //------------------------------------------------------------------ BreakpointOptions(bool all_flags_set); BreakpointOptions(const BreakpointOptions &rhs); @@ -136,17 +127,12 @@ public: static const char *GetSerializationKey() { return "BKPTOptions"; } - //------------------------------------------------------------------ // Operators - //------------------------------------------------------------------ const BreakpointOptions &operator=(const BreakpointOptions &rhs); - //------------------------------------------------------------------ /// Copy over only the options set in the incoming BreakpointOptions. - //------------------------------------------------------------------ void CopyOverSetOptions(const BreakpointOptions &rhs); - //------------------------------------------------------------------ // Callbacks // // Breakpoint callbacks come in two forms, synchronous and asynchronous. @@ -178,21 +164,18 @@ public: // should be the last action the callback does. We will relax this condition // at some point, but it will take a bit of plumbing to get that to work. // - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// Adds a callback to the breakpoint option set. /// - /// @param[in] callback + /// \param[in] callback /// The function to be called when the breakpoint gets hit. /// - /// @param[in] baton_sp + /// \param[in] baton_sp /// A baton which will get passed back to the callback when it is invoked. /// - /// @param[in] synchronous + /// \param[in] synchronous /// Whether this is a synchronous or asynchronous callback. See discussion /// above. - //------------------------------------------------------------------ void SetCallback(BreakpointHitCallback callback, const lldb::BatonSP &baton_sp, bool synchronous = false); @@ -200,30 +183,25 @@ public: const BreakpointOptions::CommandBatonSP &command_baton_sp, bool synchronous = false); - //------------------------------------------------------------------ /// Returns the command line commands for the callback on this breakpoint. /// - /// @param[out] command_list + /// \param[out] command_list /// The commands will be appended to this list. /// - /// @return + /// \return /// \btrue if the command callback is a command-line callback, /// \bfalse otherwise. - //------------------------------------------------------------------ bool GetCommandLineCallbacks(StringList &command_list); - //------------------------------------------------------------------ /// Remove the callback from this option set. - //------------------------------------------------------------------ void ClearCallback(); // The rest of these functions are meant to be used only within the // breakpoint handling mechanism. - //------------------------------------------------------------------ /// Use this function to invoke the callback for a specific stop. /// - /// @param[in] context + /// \param[in] context /// The context in which the callback is to be invoked. This includes the /// stop event, the /// execution context of the stop (since you might hit the same breakpoint @@ -231,169 +209,128 @@ public: /// whether we are currently executing synchronous or asynchronous /// callbacks. /// - /// @param[in] break_id + /// \param[in] break_id /// The breakpoint ID that owns this option set. /// - /// @param[in] break_loc_id + /// \param[in] break_loc_id /// The breakpoint location ID that owns this option set. /// - /// @return + /// \return /// The callback return value. - //------------------------------------------------------------------ bool InvokeCallback(StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id); - //------------------------------------------------------------------ /// Used in InvokeCallback to tell whether it is the right time to run this /// kind of callback. /// - /// @return + /// \return /// The synchronicity of our callback. - //------------------------------------------------------------------ bool IsCallbackSynchronous() const { return m_callback_is_synchronous; } - //------------------------------------------------------------------ /// Fetch the baton from the callback. /// - /// @return + /// \return /// The baton. - //------------------------------------------------------------------ Baton *GetBaton(); - //------------------------------------------------------------------ /// Fetch a const version of the baton from the callback. /// - /// @return + /// \return /// The baton. - //------------------------------------------------------------------ const Baton *GetBaton() const; - //------------------------------------------------------------------ // Condition - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// Set the breakpoint option's condition. /// - /// @param[in] condition + /// \param[in] condition /// The condition expression to evaluate when the breakpoint is hit. - //------------------------------------------------------------------ void SetCondition(const char *condition); - //------------------------------------------------------------------ /// Return a pointer to the text of the condition expression. /// - /// @return + /// \return /// A pointer to the condition expression text, or nullptr if no // condition has been set. - //------------------------------------------------------------------ const char *GetConditionText(size_t *hash = nullptr) const; - //------------------------------------------------------------------ // Enabled/Ignore Count - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// Check the Enable/Disable state. - /// @return + /// \return /// \b true if the breakpoint is enabled, \b false if disabled. - //------------------------------------------------------------------ bool IsEnabled() const { return m_enabled; } - //------------------------------------------------------------------ /// If \a enable is \b true, enable the breakpoint, if \b false disable it. - //------------------------------------------------------------------ void SetEnabled(bool enabled) { m_enabled = enabled; m_set_flags.Set(eEnabled); } - //------------------------------------------------------------------ /// Check the auto-continue state. - /// @return + /// \return /// \b true if the breakpoint is set to auto-continue, \b false otherwise. - //------------------------------------------------------------------ bool IsAutoContinue() const { return m_auto_continue; } - //------------------------------------------------------------------ /// Set the auto-continue state. - //------------------------------------------------------------------ void SetAutoContinue(bool auto_continue) { m_auto_continue = auto_continue; m_set_flags.Set(eAutoContinue); } - //------------------------------------------------------------------ /// Check the One-shot state. - /// @return + /// \return /// \b true if the breakpoint is one-shot, \b false otherwise. - //------------------------------------------------------------------ bool IsOneShot() const { return m_one_shot; } - //------------------------------------------------------------------ /// If \a enable is \b true, enable the breakpoint, if \b false disable it. - //------------------------------------------------------------------ void SetOneShot(bool one_shot) { m_one_shot = one_shot; m_set_flags.Set(eOneShot); } - //------------------------------------------------------------------ /// Set the breakpoint to ignore the next \a count breakpoint hits. - /// @param[in] count + /// \param[in] count /// The number of breakpoint hits to ignore. - //------------------------------------------------------------------ void SetIgnoreCount(uint32_t n) { m_ignore_count = n; m_set_flags.Set(eIgnoreCount); } - //------------------------------------------------------------------ /// Return the current Ignore Count. - /// @return + /// \return /// The number of breakpoint hits to be ignored. - //------------------------------------------------------------------ uint32_t GetIgnoreCount() const { return m_ignore_count; } - //------------------------------------------------------------------ /// Return the current thread spec for this option. This will return nullptr /// if the no thread specifications have been set for this Option yet. - /// @return + /// \return /// The thread specification pointer for this option, or nullptr if none /// has /// been set yet. - //------------------------------------------------------------------ const ThreadSpec *GetThreadSpecNoCreate() const; - //------------------------------------------------------------------ /// Returns a pointer to the ThreadSpec for this option, creating it. if it /// hasn't been created already. This API is used for setting the /// ThreadSpec items for this option. - //------------------------------------------------------------------ ThreadSpec *GetThreadSpec(); void SetThreadID(lldb::tid_t thread_id); void GetDescription(Stream *s, lldb::DescriptionLevel level) const; - //------------------------------------------------------------------ /// Returns true if the breakpoint option has a callback set. - //------------------------------------------------------------------ bool HasCallback() const; - //------------------------------------------------------------------ /// This is the default empty callback. - //------------------------------------------------------------------ static bool NullCallback(void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id); - //------------------------------------------------------------------ - /// Set a callback based on BreakpointOptions::CommandData. @param[in] + /// Set a callback based on BreakpointOptions::CommandData. \param[in] /// cmd_data /// A UP holding the new'ed CommandData object. /// The breakpoint will take ownership of pointer held by this object. - //------------------------------------------------------------------ void SetCommandDataCallback(std::unique_ptr<CommandData> &cmd_data); void Clear(); @@ -403,9 +340,7 @@ public: } protected: -//------------------------------------------------------------------ // Classes that inherit from BreakpointOptions can see and modify these - //------------------------------------------------------------------ bool IsOptionSet(OptionKind kind) { return m_set_flags.Test(kind); @@ -432,9 +367,7 @@ protected: void SetThreadSpec(std::unique_ptr<ThreadSpec> &thread_spec_up); private: - //------------------------------------------------------------------ // For BreakpointOptions only - //------------------------------------------------------------------ BreakpointHitCallback m_callback; // This is the callback function pointer lldb::BatonSP m_callback_baton_sp; // This is the client data for the callback bool m_baton_is_command_baton; @@ -443,7 +376,7 @@ private: bool m_one_shot; uint32_t m_ignore_count; // Number of times to ignore this breakpoint std::unique_ptr<ThreadSpec> - m_thread_spec_ap; // Thread for which this breakpoint will take + m_thread_spec_up; // Thread for which this breakpoint will take std::string m_condition_text; // The condition to test. size_t m_condition_text_hash; // Its hash, so that locations know when the // condition is updated. diff --git a/include/lldb/Breakpoint/BreakpointPrecondition.h b/include/lldb/Breakpoint/BreakpointPrecondition.h new file mode 100644 index 000000000000..2a9461b52fab --- /dev/null +++ b/include/lldb/Breakpoint/BreakpointPrecondition.h @@ -0,0 +1,30 @@ +//===-- BreakpointPrecondition.h --------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_BreakpointPrecondition_h_ +#define liblldb_BreakpointPrecondition_h_ + +#include "lldb/lldb-enumerations.h" + +namespace lldb_private { + +class Args; +class Status; +class StoppointCallbackContext; +class Stream; + +class BreakpointPrecondition { +public: + virtual ~BreakpointPrecondition() = default; + virtual bool EvaluatePrecondition(StoppointCallbackContext &context); + virtual Status ConfigurePrecondition(Args &args); + virtual void GetDescription(Stream &stream, lldb::DescriptionLevel level); +}; +} // namespace lldb_private + +#endif diff --git a/include/lldb/Breakpoint/BreakpointResolver.h b/include/lldb/Breakpoint/BreakpointResolver.h index 32008f3dd96f..11e183b33482 100644 --- a/include/lldb/Breakpoint/BreakpointResolver.h +++ b/include/lldb/Breakpoint/BreakpointResolver.h @@ -1,9 +1,8 @@ //===-- BreakpointResolver.h ------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -20,13 +19,10 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class BreakpointResolver BreakpointResolver.h +/// \class BreakpointResolver BreakpointResolver.h /// "lldb/Breakpoint/BreakpointResolver.h" This class works with SearchFilter /// to resolve logical breakpoints to their of concrete breakpoint locations. -//---------------------------------------------------------------------- -//---------------------------------------------------------------------- /// General Outline: /// The BreakpointResolver is a Searcher. In that protocol, the SearchFilter /// asks the question "At what depth of the symbol context descent do you want @@ -35,92 +31,73 @@ namespace lldb_private { /// Each Breakpoint has a BreakpointResolver, and it calls either /// ResolveBreakpoint or ResolveBreakpointInModules to tell it to look for new /// breakpoint locations. -//---------------------------------------------------------------------- class BreakpointResolver : public Searcher { friend class Breakpoint; public: - //------------------------------------------------------------------ /// The breakpoint resolver need to have a breakpoint for "ResolveBreakpoint /// to make sense. It can be constructed without a breakpoint, but you have /// to call SetBreakpoint before ResolveBreakpoint. /// - /// @param[in] bkpt + /// \param[in] bkpt /// The breakpoint that owns this resolver. - /// @param[in] resolverType + /// \param[in] resolverType /// The concrete breakpoint resolver type for this breakpoint. /// - /// @result + /// \result /// Returns breakpoint location id. - //------------------------------------------------------------------ BreakpointResolver(Breakpoint *bkpt, unsigned char resolverType, lldb::addr_t offset = 0); - //------------------------------------------------------------------ /// The Destructor is virtual, all significant breakpoint resolvers derive /// from this class. - //------------------------------------------------------------------ ~BreakpointResolver() override; - //------------------------------------------------------------------ /// This sets the breakpoint for this resolver. /// - /// @param[in] bkpt + /// \param[in] bkpt /// The breakpoint that owns this resolver. - //------------------------------------------------------------------ void 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 + /// \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 + /// \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. /// - /// @param[in] filter + /// \param[in] filter /// The filter that will manage the search for this resolver. - //------------------------------------------------------------------ virtual void ResolveBreakpoint(SearchFilter &filter); - //------------------------------------------------------------------ /// In response to this method the resolver scans the modules in the module /// list \a modules, and adds any new locations it finds. /// - /// @param[in] filter + /// \param[in] filter /// The filter that will manage the search for this resolver. - //------------------------------------------------------------------ virtual void ResolveBreakpointInModules(SearchFilter &filter, ModuleList &modules); - //------------------------------------------------------------------ /// Prints a canonical description for the breakpoint to the stream \a s. /// - /// @param[in] s + /// \param[in] s /// Stream to which the output is copied. - //------------------------------------------------------------------ void GetDescription(Stream *s) override = 0; - //------------------------------------------------------------------ /// Standard "Dump" method. At present it does nothing. - //------------------------------------------------------------------ virtual void Dump(Stream *s) const = 0; /// This section handles serializing and deserializing from StructuredData @@ -143,8 +120,6 @@ public: StructuredData::DictionarySP WrapOptionsDict(StructuredData::DictionarySP options_dict_sp); - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// An enumeration for keeping track of the concrete subclass that is /// actually instantiated. Values of this enumeration are kept in the /// BreakpointResolver's SubclassID field. They are used for concrete type @@ -164,7 +139,6 @@ public: // index, and one for UnknownResolver. static const char *g_ty_to_name[LastKnownResolverType + 2]; - //------------------------------------------------------------------ /// getResolverID - Return an ID for the concrete type of this object. This /// is used to implement the LLVM classof checks. This should not be used /// for any other purpose, as the values may change as LLDB evolves. @@ -221,7 +195,6 @@ public: } protected: - //------------------------------------------------------------------ /// Takes a symbol context list of matches which supposedly represent the /// same file and line number in a CU, and find the nearest actual line /// number that matches, and then filter down the matching addresses to @@ -236,7 +209,7 @@ protected: const char *) = delete; lldb::BreakpointLocationSP AddLocation(Address loc_addr, - bool *new_location = NULL); + bool *new_location = nullptr); 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 diff --git a/include/lldb/Breakpoint/BreakpointResolverAddress.h b/include/lldb/Breakpoint/BreakpointResolverAddress.h index 5d8c0b6b7530..949a788282b9 100644 --- a/include/lldb/Breakpoint/BreakpointResolverAddress.h +++ b/include/lldb/Breakpoint/BreakpointResolverAddress.h @@ -1,9 +1,8 @@ //===-- BreakpointResolverAddress.h -----------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -15,12 +14,10 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class BreakpointResolverAddress BreakpointResolverAddress.h +/// \class BreakpointResolverAddress BreakpointResolverAddress.h /// "lldb/Breakpoint/BreakpointResolverAddress.h" This class sets breakpoints /// on a given Address. This breakpoint only takes once, and then it won't /// attempt to reset itself. -//---------------------------------------------------------------------- class BreakpointResolverAddress : public BreakpointResolver { public: diff --git a/include/lldb/Breakpoint/BreakpointResolverFileLine.h b/include/lldb/Breakpoint/BreakpointResolverFileLine.h index 8671cd2e5562..f146a704ca54 100644 --- a/include/lldb/Breakpoint/BreakpointResolverFileLine.h +++ b/include/lldb/Breakpoint/BreakpointResolverFileLine.h @@ -1,9 +1,8 @@ //===-- BreakpointResolverFileLine.h ----------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -14,12 +13,10 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class BreakpointResolverFileLine BreakpointResolverFileLine.h +/// \class BreakpointResolverFileLine BreakpointResolverFileLine.h /// "lldb/Breakpoint/BreakpointResolverFileLine.h" This class sets breakpoints /// by file and line. Optionally, it will look for inlined instances of the /// file and line specification. -//---------------------------------------------------------------------- class BreakpointResolverFileLine : public BreakpointResolver { public: diff --git a/include/lldb/Breakpoint/BreakpointResolverFileRegex.h b/include/lldb/Breakpoint/BreakpointResolverFileRegex.h index db4f67cf3951..963145722e39 100644 --- a/include/lldb/Breakpoint/BreakpointResolverFileRegex.h +++ b/include/lldb/Breakpoint/BreakpointResolverFileRegex.h @@ -1,10 +1,9 @@ //===-- BreakpointResolverFileRegex.h ----------------------------*- C++ //-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -17,12 +16,10 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class BreakpointResolverFileRegex BreakpointResolverFileRegex.h +/// \class BreakpointResolverFileRegex BreakpointResolverFileRegex.h /// "lldb/Breakpoint/BreakpointResolverFileRegex.h" This class sets /// breakpoints by file and line. Optionally, it will look for inlined /// instances of the file and line specification. -//---------------------------------------------------------------------- class BreakpointResolverFileRegex : public BreakpointResolver { public: diff --git a/include/lldb/Breakpoint/BreakpointResolverName.h b/include/lldb/Breakpoint/BreakpointResolverName.h index 416e1aa301b1..85a41b6007f0 100644 --- a/include/lldb/Breakpoint/BreakpointResolverName.h +++ b/include/lldb/Breakpoint/BreakpointResolverName.h @@ -1,9 +1,8 @@ //===-- BreakpointResolverName.h --------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -18,11 +17,9 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class BreakpointResolverName BreakpointResolverName.h +/// \class BreakpointResolverName BreakpointResolverName.h /// "lldb/Breakpoint/BreakpointResolverName.h" This class sets breakpoints on /// a given function name, either by exact match or by regular expression. -//---------------------------------------------------------------------- class BreakpointResolverName : public BreakpointResolver { public: @@ -88,7 +85,7 @@ protected: lldb::LanguageType m_language; bool m_skip_prologue; - void AddNameLookup(const ConstString &name, + void AddNameLookup(ConstString name, lldb::FunctionNameType name_type_mask); }; diff --git a/include/lldb/Breakpoint/BreakpointResolverScripted.h b/include/lldb/Breakpoint/BreakpointResolverScripted.h index aaa9cbe4d354..980bb4693d03 100644 --- a/include/lldb/Breakpoint/BreakpointResolverScripted.h +++ b/include/lldb/Breakpoint/BreakpointResolverScripted.h @@ -1,9 +1,8 @@ //===-- BreakpointResolverScripted.h -----------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -17,12 +16,10 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class BreakpointResolverScripted BreakpointResolverScripted.h +/// \class BreakpointResolverScripted BreakpointResolverScripted.h /// "lldb/Breakpoint/BreakpointResolverScripted.h" This class sets breakpoints /// on a given Address. This breakpoint only takes once, and then it won't /// attempt to reset itself. -//---------------------------------------------------------------------- class BreakpointResolverScripted : public BreakpointResolver { public: diff --git a/include/lldb/Breakpoint/BreakpointSite.h b/include/lldb/Breakpoint/BreakpointSite.h index 8d1d69076b1c..51ed84f7bf2d 100644 --- a/include/lldb/Breakpoint/BreakpointSite.h +++ b/include/lldb/Breakpoint/BreakpointSite.h @@ -1,9 +1,8 @@ //===-- BreakpointSite.h ----------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -22,8 +21,7 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class BreakpointSite BreakpointSite.h "lldb/Breakpoint/BreakpointSite.h" +/// \class BreakpointSite BreakpointSite.h "lldb/Breakpoint/BreakpointSite.h" /// Class that manages the actual breakpoint that will be inserted into the /// running program. /// @@ -33,7 +31,6 @@ namespace lldb_private { /// that share this physical site. When the breakpoint is hit, all the /// locations are informed by the breakpoint site. Breakpoint sites are owned /// by the process. -//---------------------------------------------------------------------- class BreakpointSite : public std::enable_shared_from_this<BreakpointSite>, public StoppointLocation { @@ -50,182 +47,142 @@ public: ~BreakpointSite() override; - //---------------------------------------------------------------------- // This section manages the breakpoint traps - //---------------------------------------------------------------------- - //------------------------------------------------------------------ /// Returns the Opcode Bytes for this breakpoint - //------------------------------------------------------------------ uint8_t *GetTrapOpcodeBytes(); - //------------------------------------------------------------------ /// Returns the Opcode Bytes for this breakpoint - const version - //------------------------------------------------------------------ const uint8_t *GetTrapOpcodeBytes() const; - //------------------------------------------------------------------ /// Get the size of the trap opcode for this address - //------------------------------------------------------------------ size_t GetTrapOpcodeMaxByteSize() const; - //------------------------------------------------------------------ /// Sets the trap opcode - //------------------------------------------------------------------ bool SetTrapOpcode(const uint8_t *trap_opcode, uint32_t trap_opcode_size); - //------------------------------------------------------------------ /// Gets the original instruction bytes that were overwritten by the trap - //------------------------------------------------------------------ uint8_t *GetSavedOpcodeBytes(); - //------------------------------------------------------------------ /// Gets the original instruction bytes that were overwritten by the trap /// const version - //------------------------------------------------------------------ const uint8_t *GetSavedOpcodeBytes() const; - //------------------------------------------------------------------ /// Says whether \a addr and size \a size intersects with the address \a /// intersect_addr - //------------------------------------------------------------------ bool IntersectsRange(lldb::addr_t addr, size_t size, lldb::addr_t *intersect_addr, size_t *intersect_size, size_t *opcode_offset) const; - //------------------------------------------------------------------ /// Tells whether the current breakpoint site is enabled or not /// /// This is a low-level enable bit for the breakpoint sites. If a /// breakpoint site has no enabled owners, it should just get removed. This /// enable/disable is for the low-level target code to enable and disable /// breakpoint sites when single stepping, etc. - //------------------------------------------------------------------ bool IsEnabled() const; - //------------------------------------------------------------------ /// Sets whether the current breakpoint site is enabled or not /// - /// @param[in] enabled + /// \param[in] enabled /// \b true if the breakpoint is enabled, \b false otherwise. - //------------------------------------------------------------------ void SetEnabled(bool enabled); - //------------------------------------------------------------------ /// Enquires of the breakpoint locations that produced this breakpoint site /// whether we should stop at this location. /// - /// @param[in] context + /// \param[in] context /// This contains the information about this stop. /// - /// @return + /// \return /// \b true if we should stop, \b false otherwise. - //------------------------------------------------------------------ bool ShouldStop(StoppointCallbackContext *context) override; - //------------------------------------------------------------------ /// Standard Dump method /// - /// @param[in] context + /// \param[in] context /// The stream to dump this output. - //------------------------------------------------------------------ void Dump(Stream *s) const override; - //------------------------------------------------------------------ /// The "Owners" are the breakpoint locations that share this breakpoint /// site. The method adds the \a owner to this breakpoint site's owner list. /// - /// @param[in] context + /// \param[in] context /// \a owner is the Breakpoint Location to add. - //------------------------------------------------------------------ void AddOwner(const lldb::BreakpointLocationSP &owner); - //------------------------------------------------------------------ /// This method returns the number of breakpoint locations currently located /// at this breakpoint site. /// - /// @return + /// \return /// The number of owners. - //------------------------------------------------------------------ size_t GetNumberOfOwners(); - //------------------------------------------------------------------ /// This method returns the breakpoint location at index \a index located at /// this breakpoint site. The owners are listed ordinally from 0 to /// GetNumberOfOwners() - 1 so you can use this method to iterate over the /// owners /// - /// @param[in] index + /// \param[in] index /// The index in the list of owners for which you wish the owner location. - /// @return + /// \return /// A shared pointer to the breakpoint location at that index. - //------------------------------------------------------------------ lldb::BreakpointLocationSP GetOwnerAtIndex(size_t idx); - //------------------------------------------------------------------ /// This method copies the breakpoint site's owners into a new collection. /// It does this while the owners mutex is locked. /// - /// @param[out] out_collection + /// \param[out] out_collection /// The BreakpointLocationCollection into which to put the owners /// of this breakpoint site. /// - /// @return + /// \return /// The number of elements copied into out_collection. - //------------------------------------------------------------------ size_t CopyOwnersList(BreakpointLocationCollection &out_collection); - //------------------------------------------------------------------ /// Check whether the owners of this breakpoint site have any thread /// specifiers, and if yes, is \a thread contained in any of these /// specifiers. /// - /// @param[in] thread + /// \param[in] thread /// The thread against which to test. /// /// return /// \b true if the collection contains at least one location that /// would be valid for this thread, false otherwise. - //------------------------------------------------------------------ bool ValidForThisThread(Thread *thread); - //------------------------------------------------------------------ /// Print a description of this breakpoint site to the stream \a s. /// GetDescription tells you about the breakpoint site's owners. Use /// BreakpointSite::Dump(Stream *) to get information about the breakpoint /// site itself. /// - /// @param[in] s + /// \param[in] s /// The stream to which to print the description. /// - /// @param[in] level + /// \param[in] level /// The description level that indicates the detail level to /// provide. /// - /// @see lldb::DescriptionLevel - //------------------------------------------------------------------ + /// \see lldb::DescriptionLevel void GetDescription(Stream *s, lldb::DescriptionLevel level); - //------------------------------------------------------------------ /// Tell whether a breakpoint has a location at this site. /// - /// @param[in] bp_id + /// \param[in] bp_id /// The breakpoint id to query. /// - /// @result + /// \result /// \b true if bp_id has a location that is at this site, /// \b false otherwise. - //------------------------------------------------------------------ bool IsBreakpointAtThisSite(lldb::break_id_t bp_id); - //------------------------------------------------------------------ /// Tell whether ALL the breakpoints in the location collection are /// internal. /// - /// @result + /// \result /// \b true if all breakpoint locations are owned by internal breakpoints, /// \b false otherwise. - //------------------------------------------------------------------ bool IsInternal() const; BreakpointSite::Type GetType() const { return m_type; } @@ -242,13 +199,11 @@ private: void BumpHitCounts(); - //------------------------------------------------------------------ /// The method removes the owner at \a break_loc_id from this breakpoint /// list. /// - /// @param[in] context + /// \param[in] context /// \a break_loc_id is the Breakpoint Location to remove. - //------------------------------------------------------------------ size_t RemoveOwner(lldb::break_id_t break_id, lldb::break_id_t break_loc_id); BreakpointSite::Type m_type; ///< The type of this breakpoint site. diff --git a/include/lldb/Breakpoint/BreakpointSiteList.h b/include/lldb/Breakpoint/BreakpointSiteList.h index 2f2e31cd3126..b10d119fcce6 100644 --- a/include/lldb/Breakpoint/BreakpointSiteList.h +++ b/include/lldb/Breakpoint/BreakpointSiteList.h @@ -1,9 +1,8 @@ //===-- BreakpointSiteList.h ------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -18,11 +17,9 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class BreakpointSiteList BreakpointSiteList.h +/// \class BreakpointSiteList BreakpointSiteList.h /// "lldb/Breakpoint/BreakpointSiteList.h" Class that manages lists of /// BreakpointSite shared pointers. -//---------------------------------------------------------------------- class BreakpointSiteList { // At present Process directly accesses the map of BreakpointSites so it can // do quick lookups into the map (using GetMap). @@ -30,123 +27,101 @@ class BreakpointSiteList { friend class Process; public: - //------------------------------------------------------------------ /// Default constructor makes an empty list. - //------------------------------------------------------------------ BreakpointSiteList(); - //------------------------------------------------------------------ /// Destructor, currently does nothing. - //------------------------------------------------------------------ ~BreakpointSiteList(); - //------------------------------------------------------------------ /// Add a BreakpointSite to the list. /// - /// @param[in] bp_site_sp + /// \param[in] bp_site_sp /// A shared pointer to a breakpoint site being added to the list. /// - /// @return + /// \return /// The ID of the BreakpointSite in the list. - //------------------------------------------------------------------ lldb::break_id_t Add(const lldb::BreakpointSiteSP &bp_site_sp); - //------------------------------------------------------------------ - /// Standard Dump routine, doesn't do anything at present. @param[in] s + /// Standard Dump routine, doesn't do anything at present. \param[in] s /// Stream into which to dump the description. - //------------------------------------------------------------------ void Dump(Stream *s) const; - //------------------------------------------------------------------ /// Returns a shared pointer to the breakpoint site at address \a addr. /// - /// @param[in] addr + /// \param[in] addr /// The address to look for. /// - /// @result + /// \result /// A shared pointer to the breakpoint site. May contain a NULL /// pointer if no breakpoint site exists with a matching address. - //------------------------------------------------------------------ lldb::BreakpointSiteSP FindByAddress(lldb::addr_t addr); - //------------------------------------------------------------------ /// Returns a shared pointer to the breakpoint site with id \a breakID. /// - /// @param[in] breakID + /// \param[in] breakID /// The breakpoint site ID to seek for. /// - /// @result + /// \result /// A shared pointer to the breakpoint site. May contain a NULL pointer if /// the /// breakpoint doesn't exist. - //------------------------------------------------------------------ lldb::BreakpointSiteSP FindByID(lldb::break_id_t breakID); - //------------------------------------------------------------------ /// Returns a shared pointer to the breakpoint site with id \a breakID - /// const version. /// - /// @param[in] breakID + /// \param[in] breakID /// The breakpoint site ID to seek for. /// - /// @result + /// \result /// A shared pointer to the breakpoint site. May contain a NULL pointer if /// the /// breakpoint doesn't exist. - //------------------------------------------------------------------ const lldb::BreakpointSiteSP FindByID(lldb::break_id_t breakID) const; - //------------------------------------------------------------------ /// Returns the breakpoint site id to the breakpoint site at address \a /// addr. /// - /// @param[in] addr + /// \param[in] addr /// The address to match. /// - /// @result + /// \result /// The ID of the breakpoint site, or LLDB_INVALID_BREAK_ID. - //------------------------------------------------------------------ lldb::break_id_t FindIDByAddress(lldb::addr_t addr); - //------------------------------------------------------------------ /// Returns whether the breakpoint site \a bp_site_id has \a bp_id // as one of its owners. /// - /// @param[in] bp_site_id + /// \param[in] bp_site_id /// The breakpoint site id to query. /// - /// @param[in] bp_id + /// \param[in] bp_id /// The breakpoint id to look for in \a bp_site_id. /// - /// @result + /// \result /// True if \a bp_site_id exists in the site list AND \a bp_id is one of the /// owners of that site. - //------------------------------------------------------------------ bool BreakpointSiteContainsBreakpoint(lldb::break_id_t bp_site_id, lldb::break_id_t bp_id); void ForEach(std::function<void(BreakpointSite *)> const &callback); - //------------------------------------------------------------------ /// Removes the breakpoint site given by \b breakID from this list. /// - /// @param[in] breakID + /// \param[in] breakID /// The breakpoint site index to remove. /// - /// @result + /// \result /// \b true if the breakpoint site \a breakID was in the list. - //------------------------------------------------------------------ bool Remove(lldb::break_id_t breakID); - //------------------------------------------------------------------ /// Removes the breakpoint site at address \a addr from this list. /// - /// @param[in] addr + /// \param[in] addr /// The address from which to remove a breakpoint site. /// - /// @result + /// \result /// \b true if \a addr had a breakpoint site to remove from the list. - //------------------------------------------------------------------ bool RemoveByAddress(lldb::addr_t addr); bool FindInRange(lldb::addr_t lower_bound, lldb::addr_t upper_bound, @@ -155,27 +130,23 @@ public: typedef void (*BreakpointSiteSPMapFunc)(lldb::BreakpointSiteSP &bp, void *baton); - //------------------------------------------------------------------ /// Enquires of the breakpoint site on in this list with ID \a breakID /// whether we should stop for the breakpoint or not. /// - /// @param[in] context + /// \param[in] context /// This contains the information about this stop. /// - /// @param[in] breakID + /// \param[in] breakID /// This break ID that we hit. /// - /// @return + /// \return /// \b true if we should stop, \b false otherwise. - //------------------------------------------------------------------ bool ShouldStop(StoppointCallbackContext *context, lldb::break_id_t breakID); - //------------------------------------------------------------------ /// Returns the number of elements in the list. /// - /// @result + /// \result /// The number of elements. - //------------------------------------------------------------------ size_t GetSize() const { std::lock_guard<std::recursive_mutex> guard(m_mutex); return m_bp_site_list.size(); diff --git a/include/lldb/Breakpoint/Stoppoint.h b/include/lldb/Breakpoint/Stoppoint.h index 78baa6ce6cbb..f20b10074051 100644 --- a/include/lldb/Breakpoint/Stoppoint.h +++ b/include/lldb/Breakpoint/Stoppoint.h @@ -1,9 +1,8 @@ //===-- Stoppoint.h ---------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -17,16 +16,12 @@ namespace lldb_private { class Stoppoint { public: - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ Stoppoint(); virtual ~Stoppoint(); - //------------------------------------------------------------------ // Methods - //------------------------------------------------------------------ virtual void Dump(Stream *) = 0; virtual bool IsEnabled() = 0; @@ -41,9 +36,7 @@ protected: lldb::break_id_t m_bid; private: - //------------------------------------------------------------------ // For Stoppoint only - //------------------------------------------------------------------ DISALLOW_COPY_AND_ASSIGN(Stoppoint); }; diff --git a/include/lldb/Breakpoint/StoppointCallbackContext.h b/include/lldb/Breakpoint/StoppointCallbackContext.h index 1dac342d3325..c1724a6b276f 100644 --- a/include/lldb/Breakpoint/StoppointCallbackContext.h +++ b/include/lldb/Breakpoint/StoppointCallbackContext.h @@ -1,9 +1,8 @@ //===-- StoppointCallbackContext.h ------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -15,18 +14,14 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class StoppointCallbackContext StoppointCallbackContext.h +/// \class StoppointCallbackContext StoppointCallbackContext.h /// "lldb/Breakpoint/StoppointCallbackContext.h" Class holds the information /// that a breakpoint callback needs to evaluate this stop. -//---------------------------------------------------------------------- -//---------------------------------------------------------------------- /// General Outline: /// When we hit a breakpoint we need to package up whatever information is /// needed to evaluate breakpoint commands and conditions. This class is the /// container of that information. -//---------------------------------------------------------------------- class StoppointCallbackContext { public: @@ -35,17 +30,13 @@ public: StoppointCallbackContext(Event *event, const ExecutionContext &exe_ctx, bool synchronously = false); - //------------------------------------------------------------------ /// Clear the object's state. /// /// Sets the event, process and thread to NULL, and the frame index to an /// invalid value. - //------------------------------------------------------------------ void Clear(); - //------------------------------------------------------------------ // Member variables - //------------------------------------------------------------------ Event *event; // This is the event, the callback can modify this to indicate // the meaning of the breakpoint hit ExecutionContextRef diff --git a/include/lldb/Breakpoint/StoppointLocation.h b/include/lldb/Breakpoint/StoppointLocation.h index 5c78d2e3d659..3926f452e564 100644 --- a/include/lldb/Breakpoint/StoppointLocation.h +++ b/include/lldb/Breakpoint/StoppointLocation.h @@ -1,9 +1,8 @@ //===-- StoppointLocation.h -------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -18,9 +17,7 @@ namespace lldb_private { class StoppointLocation { public: - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ StoppointLocation(lldb::break_id_t bid, lldb::addr_t m_addr, bool hardware); StoppointLocation(lldb::break_id_t bid, lldb::addr_t m_addr, @@ -28,13 +25,9 @@ public: virtual ~StoppointLocation(); - //------------------------------------------------------------------ // Operators - //------------------------------------------------------------------ - //------------------------------------------------------------------ // Methods - //------------------------------------------------------------------ virtual lldb::addr_t GetLoadAddress() const { return m_addr; } virtual void SetLoadAddress(lldb::addr_t addr) { m_addr = addr; } @@ -60,9 +53,7 @@ public: lldb::break_id_t GetID() const { return m_loc_id; } protected: - //------------------------------------------------------------------ // Classes that inherit from StoppointLocation can see and modify these - //------------------------------------------------------------------ lldb::break_id_t m_loc_id; // Stoppoint location ID lldb::addr_t m_addr; // The load address of this stop point. The base Stoppoint doesn't @@ -85,11 +76,9 @@ protected: void DecrementHitCount(); private: - //------------------------------------------------------------------ // For StoppointLocation only - //------------------------------------------------------------------ DISALLOW_COPY_AND_ASSIGN(StoppointLocation); - StoppointLocation(); // Disallow default constructor + StoppointLocation() = delete; }; } // namespace lldb_private diff --git a/include/lldb/Breakpoint/Watchpoint.h b/include/lldb/Breakpoint/Watchpoint.h index 2aaae37eb095..e71f89b3e384 100644 --- a/include/lldb/Breakpoint/Watchpoint.h +++ b/include/lldb/Breakpoint/Watchpoint.h @@ -1,9 +1,8 @@ //===-- Watchpoint.h --------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -32,9 +31,9 @@ public: ~WatchpointEventData() override; - static const ConstString &GetFlavorString(); + static ConstString GetFlavorString(); - const ConstString &GetFlavor() const override; + ConstString GetFlavor() const override; lldb::WatchpointEventType GetWatchpointEventType() const; @@ -98,30 +97,26 @@ public: Target &GetTarget() { return m_target; } const Status &GetError() { return m_error; } - //------------------------------------------------------------------ /// Returns the WatchpointOptions structure set for this watchpoint. /// - /// @return + /// \return /// A pointer to this watchpoint's WatchpointOptions. - //------------------------------------------------------------------ WatchpointOptions *GetOptions() { return &m_options; } - //------------------------------------------------------------------ /// Set the callback action invoked when the watchpoint is hit. /// - /// @param[in] callback + /// \param[in] callback /// The method that will get called when the watchpoint is hit. - /// @param[in] callback_baton + /// \param[in] callback_baton /// A void * pointer that will get passed back to the callback function. - /// @param[in] is_synchronous + /// \param[in] is_synchronous /// If \b true the callback will be run on the private event thread /// before the stop event gets reported. If false, the callback will get /// handled on the public event thread after the stop has been posted. /// - /// @return + /// \return /// \b true if the process should stop when you hit the watchpoint. /// \b false if it should continue. - //------------------------------------------------------------------ void SetCallback(WatchpointHitCallback callback, void *callback_baton, bool is_synchronous = false); @@ -131,36 +126,28 @@ public: void ClearCallback(); - //------------------------------------------------------------------ /// Invoke the callback action when the watchpoint is hit. /// - /// @param[in] context + /// \param[in] context /// Described the watchpoint event. /// - /// @return + /// \return /// \b true if the target should stop at this watchpoint and \b false not. - //------------------------------------------------------------------ bool InvokeCallback(StoppointCallbackContext *context); - //------------------------------------------------------------------ // Condition - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// Set the watchpoint's condition. /// - /// @param[in] condition + /// \param[in] condition /// The condition expression to evaluate when the watchpoint is hit. /// Pass in nullptr to clear the condition. - //------------------------------------------------------------------ void SetCondition(const char *condition); - //------------------------------------------------------------------ /// Return a pointer to the text of the condition expression. /// - /// @return + /// \return /// A pointer to the condition expression text, or nullptr if no // condition has been set. - //------------------------------------------------------------------ const char *GetConditionText() const; void TurnOnEphemeralMode(); @@ -214,7 +201,7 @@ private: // the callback machinery. bool m_being_created; - std::unique_ptr<UserExpression> m_condition_ap; // The condition to test. + std::unique_ptr<UserExpression> m_condition_up; // The condition to test. void SetID(lldb::watch_id_t id) { m_loc_id = id; } diff --git a/include/lldb/Breakpoint/WatchpointList.h b/include/lldb/Breakpoint/WatchpointList.h index 9bfa817456bc..98c64832d46d 100644 --- a/include/lldb/Breakpoint/WatchpointList.h +++ b/include/lldb/Breakpoint/WatchpointList.h @@ -1,9 +1,8 @@ //===-- WatchpointList.h ----------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -19,12 +18,10 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class WatchpointList WatchpointList.h "lldb/Breakpoint/WatchpointList.h" +/// \class WatchpointList WatchpointList.h "lldb/Breakpoint/WatchpointList.h" /// This class is used by Watchpoint to manage a list of watchpoints, // each watchpoint in the list has a unique ID, and is unique by Address as // well. -//---------------------------------------------------------------------- class WatchpointList { // Only Target can make the watchpoint list, or add elements to it. This is @@ -34,193 +31,157 @@ class WatchpointList { friend class Target; public: - //------------------------------------------------------------------ /// Default constructor makes an empty list. - //------------------------------------------------------------------ WatchpointList(); - //------------------------------------------------------------------ /// Destructor, currently does nothing. - //------------------------------------------------------------------ ~WatchpointList(); - //------------------------------------------------------------------ /// Add a Watchpoint to the list. /// - /// @param[in] wp_sp + /// \param[in] wp_sp /// A shared pointer to a watchpoint being added to the list. /// - /// @return + /// \return /// The ID of the Watchpoint in the list. - //------------------------------------------------------------------ lldb::watch_id_t Add(const lldb::WatchpointSP &wp_sp, bool notify); - //------------------------------------------------------------------ /// Standard "Dump" method. - //------------------------------------------------------------------ void Dump(Stream *s) const; - //------------------------------------------------------------------ /// Dump with lldb::DescriptionLevel. - //------------------------------------------------------------------ void DumpWithLevel(Stream *s, lldb::DescriptionLevel description_level) const; - //------------------------------------------------------------------ /// Returns a shared pointer to the watchpoint at address \a addr - const /// version. /// - /// @param[in] addr + /// \param[in] addr /// The address to look for. /// - /// @result + /// \result /// A shared pointer to the watchpoint. May contain a NULL /// pointer if the watchpoint doesn't exist. - //------------------------------------------------------------------ const lldb::WatchpointSP FindByAddress(lldb::addr_t addr) const; - //------------------------------------------------------------------ /// Returns a shared pointer to the watchpoint with watchpoint spec \a spec /// - const version. /// - /// @param[in] spec + /// \param[in] spec /// The watchpoint spec to look for. /// - /// @result + /// \result /// A shared pointer to the watchpoint. May contain a NULL /// pointer if the watchpoint doesn't exist. - //------------------------------------------------------------------ const lldb::WatchpointSP FindBySpec(std::string spec) const; - //------------------------------------------------------------------ /// Returns a shared pointer to the watchpoint with id \a watchID, const /// version. /// - /// @param[in] watchID + /// \param[in] watchID /// The watchpoint location ID to seek for. /// - /// @result + /// \result /// A shared pointer to the watchpoint. May contain a NULL /// pointer if the watchpoint doesn't exist. - //------------------------------------------------------------------ lldb::WatchpointSP FindByID(lldb::watch_id_t watchID) const; - //------------------------------------------------------------------ /// Returns the watchpoint id to the watchpoint at address \a addr. /// - /// @param[in] addr + /// \param[in] addr /// The address to match. /// - /// @result + /// \result /// The ID of the watchpoint, or LLDB_INVALID_WATCH_ID. - //------------------------------------------------------------------ lldb::watch_id_t FindIDByAddress(lldb::addr_t addr); - //------------------------------------------------------------------ /// Returns the watchpoint id to the watchpoint with watchpoint spec \a /// spec. /// - /// @param[in] spec + /// \param[in] spec /// The watchpoint spec to match. /// - /// @result + /// \result /// The ID of the watchpoint, or LLDB_INVALID_WATCH_ID. - //------------------------------------------------------------------ lldb::watch_id_t FindIDBySpec(std::string spec); - //------------------------------------------------------------------ /// Returns a shared pointer to the watchpoint with index \a i. /// - /// @param[in] i + /// \param[in] i /// The watchpoint index to seek for. /// - /// @result + /// \result /// A shared pointer to the watchpoint. May contain a NULL pointer if /// the watchpoint doesn't exist. - //------------------------------------------------------------------ lldb::WatchpointSP GetByIndex(uint32_t i); - //------------------------------------------------------------------ /// Returns a shared pointer to the watchpoint with index \a i, const /// version. /// - /// @param[in] i + /// \param[in] i /// The watchpoint index to seek for. /// - /// @result + /// \result /// A shared pointer to the watchpoint. May contain a NULL pointer if /// the watchpoint location doesn't exist. - //------------------------------------------------------------------ const lldb::WatchpointSP GetByIndex(uint32_t i) const; - //------------------------------------------------------------------ /// Removes the watchpoint given by \b watchID from this list. /// - /// @param[in] watchID + /// \param[in] watchID /// The watchpoint ID to remove. /// - /// @result + /// \result /// \b true if the watchpoint \a watchID was in the list. - //------------------------------------------------------------------ bool Remove(lldb::watch_id_t watchID, bool notify); - //------------------------------------------------------------------ /// Returns the number hit count of all watchpoints in this list. /// - /// @result + /// \result /// Hit count of all watchpoints in this list. - //------------------------------------------------------------------ uint32_t GetHitCount() const; - //------------------------------------------------------------------ /// Enquires of the watchpoint in this list with ID \a watchID whether we /// should stop. /// - /// @param[in] context + /// \param[in] context /// This contains the information about this stop. /// - /// @param[in] watchID + /// \param[in] watchID /// This watch ID that we hit. /// - /// @return + /// \return /// \b true if we should stop, \b false otherwise. - //------------------------------------------------------------------ bool ShouldStop(StoppointCallbackContext *context, lldb::watch_id_t watchID); - //------------------------------------------------------------------ /// Returns the number of elements in this watchpoint list. /// - /// @result + /// \result /// The number of elements. - //------------------------------------------------------------------ size_t GetSize() const { std::lock_guard<std::recursive_mutex> guard(m_mutex); return m_watchpoints.size(); } - //------------------------------------------------------------------ /// Print a description of the watchpoints in this list to the stream \a s. /// - /// @param[in] s + /// \param[in] s /// The stream to which to print the description. /// - /// @param[in] level + /// \param[in] level /// The description level that indicates the detail level to /// provide. /// - /// @see lldb::DescriptionLevel - //------------------------------------------------------------------ + /// \see lldb::DescriptionLevel void GetDescription(Stream *s, lldb::DescriptionLevel level); void SetEnabledAll(bool enabled); void RemoveAll(bool notify); - //------------------------------------------------------------------ /// Sets the passed in Locker to hold the Watchpoint List mutex. /// - /// @param[in] locker + /// \param[in] locker /// The locker object that is set. - //------------------------------------------------------------------ void GetListMutex(std::unique_lock<std::recursive_mutex> &lock); protected: diff --git a/include/lldb/Breakpoint/WatchpointOptions.h b/include/lldb/Breakpoint/WatchpointOptions.h index 0f4f399b5e4d..b395dde21901 100644 --- a/include/lldb/Breakpoint/WatchpointOptions.h +++ b/include/lldb/Breakpoint/WatchpointOptions.h @@ -1,9 +1,8 @@ //===-- WatchpointOptions.h -------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -19,49 +18,38 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class WatchpointOptions WatchpointOptions.h +/// \class WatchpointOptions WatchpointOptions.h /// "lldb/Breakpoint/WatchpointOptions.h" Class that manages the options on a /// watchpoint. -//---------------------------------------------------------------------- class WatchpointOptions { public: - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// Default constructor. The watchpoint is enabled, and has no condition, /// callback, ignore count, etc... - //------------------------------------------------------------------ WatchpointOptions(); WatchpointOptions(const WatchpointOptions &rhs); static WatchpointOptions *CopyOptionsNoCallback(WatchpointOptions &rhs); - //------------------------------------------------------------------ /// This constructor allows you to specify all the watchpoint options. /// - /// @param[in] callback + /// \param[in] callback /// This is the plugin for some code that gets run, returns \b true if we /// are to stop. /// - /// @param[in] baton + /// \param[in] baton /// Client data that will get passed to the callback. /// - /// @param[in] thread_id + /// \param[in] thread_id /// Only stop if \a thread_id hits the watchpoint. - //------------------------------------------------------------------ WatchpointOptions(WatchpointHitCallback callback, void *baton, lldb::tid_t thread_id = LLDB_INVALID_THREAD_ID); virtual ~WatchpointOptions(); - //------------------------------------------------------------------ // Operators - //------------------------------------------------------------------ const WatchpointOptions &operator=(const WatchpointOptions &rhs); - //------------------------------------------------------------------ // Callbacks // // Watchpoint callbacks come in two forms, synchronous and asynchronous. @@ -89,36 +77,30 @@ public: // take a bit of plumbing to get // that to work. // - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// Adds a callback to the watchpoint option set. /// - /// @param[in] callback + /// \param[in] callback /// The function to be called when the watchpoint gets hit. /// - /// @param[in] baton_sp + /// \param[in] baton_sp /// A baton which will get passed back to the callback when it is invoked. /// - /// @param[in] synchronous + /// \param[in] synchronous /// Whether this is a synchronous or asynchronous callback. See discussion /// above. - //------------------------------------------------------------------ void SetCallback(WatchpointHitCallback callback, const lldb::BatonSP &baton_sp, bool synchronous = false); - //------------------------------------------------------------------ /// Remove the callback from this option set. - //------------------------------------------------------------------ void ClearCallback(); // The rest of these functions are meant to be used only within the // watchpoint handling mechanism. - //------------------------------------------------------------------ /// Use this function to invoke the callback for a specific stop. /// - /// @param[in] context + /// \param[in] context /// The context in which the callback is to be invoked. This includes the /// stop event, the /// execution context of the stop (since you might hit the same watchpoint @@ -126,77 +108,60 @@ public: /// whether we are currently executing synchronous or asynchronous /// callbacks. /// - /// @param[in] watch_id + /// \param[in] watch_id /// The watchpoint ID that owns this option set. /// - /// @return + /// \return /// The callback return value. - //------------------------------------------------------------------ bool InvokeCallback(StoppointCallbackContext *context, lldb::user_id_t watch_id); - //------------------------------------------------------------------ /// Used in InvokeCallback to tell whether it is the right time to run this /// kind of callback. /// - /// @return + /// \return /// The synchronicity of our callback. - //------------------------------------------------------------------ bool IsCallbackSynchronous() { return m_callback_is_synchronous; } - //------------------------------------------------------------------ /// Fetch the baton from the callback. /// - /// @return + /// \return /// The baton. - //------------------------------------------------------------------ Baton *GetBaton(); - //------------------------------------------------------------------ /// Fetch a const version of the baton from the callback. /// - /// @return + /// \return /// The baton. - //------------------------------------------------------------------ const Baton *GetBaton() const; - //------------------------------------------------------------------ /// Return the current thread spec for this option. This will return nullptr /// if the no thread specifications have been set for this Option yet. - /// @return + /// \return /// The thread specification pointer for this option, or nullptr if none /// has /// been set yet. - //------------------------------------------------------------------ const ThreadSpec *GetThreadSpecNoCreate() const; - //------------------------------------------------------------------ /// Returns a pointer to the ThreadSpec for this option, creating it. if it /// hasn't been created already. This API is used for setting the /// ThreadSpec items for this option. - //------------------------------------------------------------------ ThreadSpec *GetThreadSpec(); void SetThreadID(lldb::tid_t thread_id); void GetDescription(Stream *s, lldb::DescriptionLevel level) const; - //------------------------------------------------------------------ /// Get description for callback only. - //------------------------------------------------------------------ void GetCallbackDescription(Stream *s, lldb::DescriptionLevel level) const; - //------------------------------------------------------------------ /// Returns true if the watchpoint option has a callback set. - //------------------------------------------------------------------ bool HasCallback(); - //------------------------------------------------------------------ /// This is the default empty callback. - /// @return + /// \return /// The thread id for which the watchpoint hit will stop, /// LLDB_INVALID_THREAD_ID for all threads. - //------------------------------------------------------------------ static bool NullCallback(void *baton, StoppointCallbackContext *context, lldb::user_id_t watch_id); @@ -219,19 +184,15 @@ public: }; protected: - //------------------------------------------------------------------ // Classes that inherit from WatchpointOptions can see and modify these - //------------------------------------------------------------------ private: - //------------------------------------------------------------------ // For WatchpointOptions only - //------------------------------------------------------------------ WatchpointHitCallback m_callback; // This is the callback function pointer lldb::BatonSP m_callback_baton_sp; // This is the client data for the callback bool m_callback_is_synchronous; std::unique_ptr<ThreadSpec> - m_thread_spec_ap; // Thread for which this watchpoint will take + m_thread_spec_up; // Thread for which this watchpoint will take }; } // namespace lldb_private |