| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| //===-- BreakpointID.h ------------------------------------------*- C++ -*-===// | ||
| // | ||
| // The LLVM Compiler Infrastructure | ||
| // | ||
| // This file is distributed under the University of Illinois Open Source | ||
| // License. See LICENSE.TXT for details. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef liblldb_BreakpointID_h_ | ||
| #define liblldb_BreakpointID_h_ | ||
|
|
||
| // C Includes | ||
| // C++ Includes | ||
| // Other libraries and framework includes | ||
| // Project includes | ||
|
|
||
| #include "lldb/lldb-private.h" | ||
|
|
||
| namespace lldb_private { | ||
|
|
||
| //---------------------------------------------------------------------- | ||
| // class BreakpointID | ||
| //---------------------------------------------------------------------- | ||
|
|
||
| class BreakpointID | ||
| { | ||
| public: | ||
|
|
||
| BreakpointID (lldb::break_id_t bp_id = LLDB_INVALID_BREAK_ID, | ||
| lldb::break_id_t loc_id = LLDB_INVALID_BREAK_ID); | ||
|
|
||
| virtual | ||
| ~BreakpointID (); | ||
|
|
||
| lldb::break_id_t | ||
| GetBreakpointID () | ||
| { | ||
| return m_break_id; | ||
| } | ||
|
|
||
| lldb::break_id_t | ||
| GetLocationID () | ||
| { | ||
| return m_location_id; | ||
| } | ||
|
|
||
| void | ||
| SetID (lldb::break_id_t bp_id, lldb::break_id_t loc_id) | ||
| { | ||
| m_break_id = bp_id; | ||
| m_location_id = loc_id; | ||
| } | ||
|
|
||
| void | ||
| SetBreakpointID (lldb::break_id_t bp_id) | ||
| { | ||
| m_break_id = bp_id; | ||
| } | ||
|
|
||
| void | ||
| SetBreakpointLocationID (lldb::break_id_t loc_id) | ||
| { | ||
| m_location_id = loc_id; | ||
| } | ||
|
|
||
| void | ||
| GetDescription (Stream *s, lldb::DescriptionLevel level); | ||
|
|
||
| static bool | ||
| IsRangeIdentifier (const char *str); | ||
|
|
||
| static bool | ||
| IsValidIDExpression (const char *str); | ||
|
|
||
| static const char *g_range_specifiers[]; | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Takes an input string containing the description of a breakpoint or breakpoint and location | ||
| /// and returns the breakpoint ID and the breakpoint location id. | ||
| /// | ||
| /// @param[in] input | ||
| /// A string containing JUST the breakpoint description. | ||
| /// @param[out] break_id | ||
| /// This is the break id. | ||
| /// @param[out] break_loc_id | ||
| /// This is breakpoint location id, or LLDB_INVALID_BREAK_ID is no location was specified. | ||
| /// @return | ||
| /// \b true if the call was able to extract a breakpoint location from the string. \b false otherwise. | ||
| //------------------------------------------------------------------ | ||
| static bool | ||
| ParseCanonicalReference (const char *input, lldb::break_id_t *break_id, lldb::break_id_t *break_loc_id); | ||
|
|
||
|
|
||
| //------------------------------------------------------------------ | ||
| /// 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 | ||
| /// This is the break 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); | ||
|
|
||
| protected: | ||
| lldb::break_id_t m_break_id; | ||
| lldb::break_id_t m_location_id; | ||
| }; | ||
|
|
||
| } // namespace lldb_private | ||
|
|
||
| #endif // liblldb_BreakpointID_h_ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| //===-- BreakpointIDList.h --------------------------------------*- C++ -*-===// | ||
| // | ||
| // The LLVM Compiler Infrastructure | ||
| // | ||
| // This file is distributed under the University of Illinois Open Source | ||
| // License. See LICENSE.TXT for details. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef liblldb_BreakpointIDList_h_ | ||
| #define liblldb_BreakpointIDList_h_ | ||
|
|
||
| // C Includes | ||
| // C++ Includes | ||
| #include <vector> | ||
|
|
||
| // Other libraries and framework includes | ||
| // Project includes | ||
|
|
||
| #include "lldb/lldb-private.h" | ||
| #include "lldb/Breakpoint/BreakpointID.h" | ||
|
|
||
| namespace lldb_private { | ||
|
|
||
| //---------------------------------------------------------------------- | ||
| // class BreakpointIDList | ||
| //---------------------------------------------------------------------- | ||
|
|
||
|
|
||
| class BreakpointIDList | ||
| { | ||
| public: | ||
| typedef std::vector<BreakpointID> BreakpointIDArray; | ||
|
|
||
| BreakpointIDList (); | ||
|
|
||
| virtual | ||
| ~BreakpointIDList (); | ||
|
|
||
| int | ||
| Size(); | ||
|
|
||
| BreakpointID & | ||
| GetBreakpointIDAtIndex (int index); | ||
|
|
||
| bool | ||
| RemoveBreakpointIDAtIndex (int index); | ||
|
|
||
| void | ||
| Clear(); | ||
|
|
||
| bool | ||
| AddBreakpointID (BreakpointID bp_id); | ||
|
|
||
| bool | ||
| AddBreakpointID (const char *bp_id); | ||
|
|
||
| bool | ||
| FindBreakpointID (BreakpointID &bp_id, int *position); | ||
|
|
||
| bool | ||
| FindBreakpointID (const char *bp_id, int *position); | ||
|
|
||
| void | ||
| InsertStringArray (const char **string_array, int array_size, CommandReturnObject &result); | ||
|
|
||
| static bool | ||
| StringContainsIDRangeExpression (const char *in_string, int *range_start_len, int *range_end_pos); | ||
|
|
||
| static void | ||
| FindAndReplaceIDRanges (Args &old_args, Target *target, CommandReturnObject &result, Args &new_args); | ||
|
|
||
| private: | ||
| BreakpointIDArray m_breakpoint_ids; | ||
| BreakpointID m_invalid_id; | ||
|
|
||
| DISALLOW_COPY_AND_ASSIGN(BreakpointIDList); | ||
| }; | ||
|
|
||
| } // namespace lldb_private | ||
|
|
||
| #endif // liblldb_BreakpointIDList_h_ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,177 @@ | ||
| //===-- BreakpointList.h ----------------------------------------*- C++ -*-===// | ||
| // | ||
| // The LLVM Compiler Infrastructure | ||
| // | ||
| // This file is distributed under the University of Illinois Open Source | ||
| // License. See LICENSE.TXT for details. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef liblldb_BreakpointList_h_ | ||
| #define liblldb_BreakpointList_h_ | ||
|
|
||
| // C Includes | ||
| // C++ Includes | ||
| #include <list> | ||
| // Other libraries and framework includes | ||
| // Project includes | ||
| #include "lldb/Breakpoint/Breakpoint.h" | ||
| #include "lldb/Host/Mutex.h" | ||
|
|
||
| namespace lldb_private { | ||
|
|
||
| //---------------------------------------------------------------------- | ||
| /// @class BreakpointList BreakpointList.h "lldb/Breakpoint/BreakpointList.h" | ||
| /// @brief This class manages a list of breakpoints. | ||
| //---------------------------------------------------------------------- | ||
|
|
||
| //---------------------------------------------------------------------- | ||
| /// General Outline: | ||
| /// Allows adding and removing breakpoints and find by ID and index. | ||
| //---------------------------------------------------------------------- | ||
|
|
||
| class BreakpointList | ||
| { | ||
| public: | ||
| BreakpointList (bool is_internal); | ||
|
|
||
| ~BreakpointList(); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Add the breakpoint \a bp_sp to the list. | ||
| /// | ||
| /// @param[in] bp_sp | ||
| /// Shared pointer to the breakpoint that will get added to the list. | ||
| /// | ||
| /// @result | ||
| /// Returns breakpoint id. | ||
| //------------------------------------------------------------------ | ||
| virtual lldb::break_id_t | ||
| Add (lldb::BreakpointSP& bp_sp); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Standard "Dump" method. At present it does nothing. | ||
| //------------------------------------------------------------------ | ||
| void | ||
| Dump (Stream *s) const; | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Returns a shared pointer to the breakpoint with id \a breakID. | ||
| /// | ||
| /// @param[in] breakID | ||
| /// The breakpoint ID to seek for. | ||
| /// | ||
| /// @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); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Returns a shared pointer to the breakpoint with id \a breakID. Const version. | ||
| /// | ||
| /// @param[in] breakID | ||
| /// The breakpoint ID to seek for. | ||
| /// | ||
| /// @result | ||
| /// A shared pointer to the breakpoint. May contain a NULL pointer if the | ||
| /// breakpoint doesn't exist. | ||
| //------------------------------------------------------------------ | ||
| const lldb::BreakpointSP | ||
| FindBreakpointByID (lldb::break_id_t breakID) const; | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Returns a shared pointer to the breakpoint with index \a i. | ||
| /// | ||
| /// @param[in] i | ||
| /// The breakpoint index to seek for. | ||
| /// | ||
| /// @result | ||
| /// A shared pointer to the breakpoint. May contain a NULL pointer if the | ||
| /// breakpoint doesn't exist. | ||
| //------------------------------------------------------------------ | ||
| lldb::BreakpointSP | ||
| GetBreakpointByIndex (uint32_t i); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Returns a shared pointer to the breakpoint with index \a i, const version | ||
| /// | ||
| /// @param[in] i | ||
| /// The breakpoint index to seek for. | ||
| /// | ||
| /// @result | ||
| /// A shared pointer to the breakpoint. May contain a NULL pointer if the | ||
| /// breakpoint doesn't exist. | ||
| //------------------------------------------------------------------ | ||
| const lldb::BreakpointSP | ||
| GetBreakpointByIndex (uint32_t i) const; | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Returns the number of elements in this breakpoint list. | ||
| /// | ||
| /// @result | ||
| /// The number of elements. | ||
| //------------------------------------------------------------------ | ||
| size_t | ||
| GetSize() const { return m_breakpoints.size(); } | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Removes the breakpoint given by \b breakID from this list. | ||
| /// | ||
| /// @param[in] breakID | ||
| /// The breakpoint index to remove. | ||
| /// | ||
| /// @result | ||
| /// \b true if the breakpoint \a breakID was in the list. | ||
| //------------------------------------------------------------------ | ||
| bool | ||
| Remove (lldb::break_id_t breakID); | ||
|
|
||
| void | ||
| SetEnabledAll (bool enabled); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Removes all the breakpoints from this list. | ||
| //------------------------------------------------------------------ | ||
| void | ||
| RemoveAll (); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// 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 | ||
| /// The module list that has changed. | ||
| /// | ||
| /// @param[in] added | ||
| /// \b true if the modules are loaded, \b false if unloaded. | ||
| //------------------------------------------------------------------ | ||
| void | ||
| UpdateBreakpoints (ModuleList &module_list, bool added); | ||
|
|
||
| void | ||
| ClearAllBreakpointSites (); | ||
|
|
||
| protected: | ||
| typedef std::list<lldb::BreakpointSP> bp_collection; | ||
|
|
||
| bp_collection::iterator | ||
| GetBreakpointIDIterator(lldb::break_id_t breakID); | ||
|
|
||
| bp_collection::const_iterator | ||
| GetBreakpointIDConstIterator(lldb::break_id_t breakID) const; | ||
|
|
||
| mutable Mutex m_mutex; | ||
| bp_collection m_breakpoints; // The breakpoint list, currently a list. | ||
| lldb::break_id_t m_next_break_id; | ||
| bool m_is_internal; | ||
|
|
||
| private: | ||
| DISALLOW_COPY_AND_ASSIGN (BreakpointList); | ||
| }; | ||
|
|
||
| } // namespace lldb_private | ||
|
|
||
| #endif // liblldb_BreakpointList_h_ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,354 @@ | ||
| //===-- BreakpointLocation.h ------------------------------------*- C++ -*-===// | ||
| // | ||
| // The LLVM Compiler Infrastructure | ||
| // | ||
| // This file is distributed under the University of Illinois Open Source | ||
| // License. See LICENSE.TXT for details. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef liblldb_BreakpointLocation_h_ | ||
| #define liblldb_BreakpointLocation_h_ | ||
|
|
||
| // C Includes | ||
|
|
||
| // C++ Includes | ||
| #include <list> | ||
| #include <memory> | ||
|
|
||
| // Other libraries and framework includes | ||
|
|
||
| // Project includes | ||
| #include "lldb/lldb-private.h" | ||
| #include "lldb/Core/UserID.h" | ||
| #include "lldb/Breakpoint/StoppointLocation.h" | ||
| #include "lldb/Core/Address.h" | ||
| #include "lldb/Breakpoint/Breakpoint.h" | ||
| #include "lldb/Breakpoint/BreakpointOptions.h" | ||
| #include "lldb/Target/Process.h" | ||
| #include "lldb/Core/StringList.h" | ||
|
|
||
| namespace lldb_private { | ||
|
|
||
| //---------------------------------------------------------------------- | ||
| /// @class BreakpointLocation BreakpointLocation.h "lldb/Breakpoint/BreakpointLocation.h" | ||
| /// @brief 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 breakpoint location also may have a breakpoint site if its | ||
| /// address has been loaded into the program. | ||
| /// Finally it has a settable options object. | ||
| /// | ||
| /// 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 StoppointLocation | ||
| { | ||
| public: | ||
|
|
||
| ~BreakpointLocation (); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// 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 (); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Gets the Address for this breakpoint location | ||
| /// @return | ||
| /// Returns breakpoint location Address. | ||
| //------------------------------------------------------------------ | ||
| Address & | ||
| GetAddress (); | ||
| //------------------------------------------------------------------ | ||
| /// Gets the Breakpoint that created this breakpoint location | ||
| /// @return | ||
| /// Returns the owning breakpoint. | ||
| //------------------------------------------------------------------ | ||
| Breakpoint & | ||
| GetBreakpoint (); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// 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 | ||
| /// \b true if this breakpoint location thinks we should stop, | ||
| /// \b false otherwise. | ||
| //------------------------------------------------------------------ | ||
| bool | ||
| ShouldStop (StoppointCallbackContext *context); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| // 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 | ||
| /// \b true if the breakpoint is enabled, \b false if disabled. | ||
| //------------------------------------------------------------------ | ||
| bool | ||
| IsEnabled (); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Return the current Ignore Count. | ||
| /// | ||
| /// @return | ||
| /// The number of breakpoint hits to be ignored. | ||
| //------------------------------------------------------------------ | ||
| int32_t | ||
| GetIgnoreCount (); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Set the breakpoint to ignore the next \a count breakpoint hits. | ||
| /// | ||
| /// @param[in] count | ||
| /// The number of breakpoint hits to ignore. | ||
| //------------------------------------------------------------------ | ||
| void | ||
| SetIgnoreCount (int32_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 | ||
| /// The method that will get called when the breakpoint is hit. | ||
| /// | ||
| /// @param[in] callback_baton_sp | ||
| /// A shared pointer to a Baton that provides the void * needed | ||
| /// for the callback. | ||
| /// | ||
| /// @see lldb_private::Baton | ||
| //------------------------------------------------------------------ | ||
| void | ||
| SetCallback (BreakpointHitCallback callback, | ||
| const lldb::BatonSP &callback_baton_sp, | ||
| bool is_synchronous); | ||
|
|
||
| void | ||
| SetCallback (BreakpointHitCallback callback, | ||
| void *baton, | ||
| bool is_synchronous); | ||
|
|
||
| void | ||
| ClearCallback (); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Set the condition expression to be checked when the breakpoint is hit. | ||
| /// | ||
| /// @param[in] expression | ||
| /// The method that will get called when the breakpoint is hit. | ||
| //------------------------------------------------------------------ | ||
| void | ||
| SetCondition (void *condition); | ||
|
|
||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Set the valid thread to be checked when the breakpoint is hit. | ||
| /// | ||
| /// @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 | ||
| /// The thread id for which the breakpoint hit will stop, | ||
| /// LLDB_INVALID_THREAD_ID for all threads. | ||
| //------------------------------------------------------------------ | ||
| lldb::tid_t | ||
| GetThreadID (); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| // The next section deals with this location's breakpoint sites. | ||
| //------------------------------------------------------------------ | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Try to resolve the breakpoint site for this location. | ||
| /// | ||
| /// @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 | ||
| /// \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 | ||
| /// \b true if there was a breakpoint site for this breakpoint | ||
| /// location, \b false otherwise. | ||
| //------------------------------------------------------------------ | ||
| bool | ||
| IsResolved () const; | ||
|
|
||
| //------------------------------------------------------------------ | ||
| // The next section are generic report functions. | ||
| //------------------------------------------------------------------ | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Print a description of this breakpoint location to the stream | ||
| /// \a s. | ||
| /// | ||
| /// @param[in] s | ||
| /// The stream to which to print the description. | ||
| /// | ||
| /// @param[in] level | ||
| /// The description level that indicates the detail level to | ||
| /// provide. | ||
| /// | ||
| /// @see lldb::DescriptionLevel | ||
| //------------------------------------------------------------------ | ||
| void | ||
| GetDescription (Stream *s, lldb::DescriptionLevel level); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Standard "Dump" method. At present it does nothing. | ||
| //------------------------------------------------------------------ | ||
| void | ||
| Dump (Stream *s) const; | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// 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 | ||
| /// A pointer to the breakpoint options. | ||
| //------------------------------------------------------------------ | ||
| BreakpointOptions * | ||
| GetLocationOptions (); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Use this to access location specific breakpoint options. | ||
| /// | ||
| /// @return | ||
| /// A pointer to the containing breakpoint's options if this | ||
| /// location doesn't have its own copy. | ||
| //------------------------------------------------------------------ | ||
| BreakpointOptions * | ||
| GetOptionsNoCopy (); | ||
|
|
||
| protected: | ||
| friend class Breakpoint; | ||
| friend class CommandObjectBreakpointCommandAdd; | ||
| friend class Process; | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Invoke the callback action when the breakpoint is hit. | ||
| /// | ||
| /// Meant to be used by the BreakpointLocation class. | ||
| /// | ||
| /// @param[in] context | ||
| /// Described the breakpoint event. | ||
| /// | ||
| /// @param[in] bp_loc_id | ||
| /// Which breakpoint location hit this breakpoint. | ||
| /// | ||
| /// @return | ||
| /// \b true if the target should stop at this breakpoint and \b | ||
| /// false not. | ||
| //------------------------------------------------------------------ | ||
| bool | ||
| InvokeCallback (StoppointCallbackContext *context); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Set the breakpoint site for this location to \a bp_site_sp. | ||
| /// | ||
| /// @param[in] bp_site_sp | ||
| /// The breakpoint site we are setting for this location. | ||
| /// | ||
| /// @return | ||
| /// \b true if we were successful at setting the breakpoint site, | ||
| /// \b false otherwise. | ||
| //------------------------------------------------------------------ | ||
| bool | ||
| SetBreakpointSite (lldb::BreakpointSiteSP& bp_site_sp); | ||
|
|
||
| private: | ||
|
|
||
| //------------------------------------------------------------------ | ||
| // Constructors and Destructors | ||
| // | ||
| // Only the Breakpoint can make breakpoint locations, and it owns | ||
| // them. | ||
| //------------------------------------------------------------------ | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Constructor. | ||
| /// | ||
| /// @param[in] owner | ||
| /// A back pointer to the breakpoint that owns this location. | ||
| /// | ||
| /// @param[in] addr | ||
| /// The Address defining this location. | ||
| /// | ||
| /// @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 | ||
| /// \b true if a hardware breakpoint is requested. | ||
| //------------------------------------------------------------------ | ||
|
|
||
| BreakpointLocation (lldb::break_id_t bid, | ||
| Breakpoint &owner, | ||
| Address &addr, | ||
| lldb::tid_t tid = LLDB_INVALID_THREAD_ID, | ||
| bool hardware = false); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| // Data members: | ||
| //------------------------------------------------------------------ | ||
| Address m_address; ///< The address defining this location. | ||
| Breakpoint &m_owner; ///< The breakpoint that produced this object. | ||
| std::auto_ptr<BreakpointOptions> m_options_ap; ///< Breakpoint options pointer, NULL 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.) | ||
|
|
||
| DISALLOW_COPY_AND_ASSIGN (BreakpointLocation); | ||
| }; | ||
|
|
||
| } // namespace lldb_private | ||
|
|
||
| #endif // liblldb_BreakpointLocation_h_ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,187 @@ | ||
| //===-- BreakpointLocationCollection.h --------------------------*- C++ -*-===// | ||
| // | ||
| // The LLVM Compiler Infrastructure | ||
| // | ||
| // This file is distributed under the University of Illinois Open Source | ||
| // License. See LICENSE.TXT for details. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef liblldb_BreakpointLocationCollection_h_ | ||
| #define liblldb_BreakpointLocationCollection_h_ | ||
|
|
||
| // C Includes | ||
| // C++ Includes | ||
| #include <vector> | ||
| // Other libraries and framework includes | ||
| // Project includes | ||
| #include "lldb/lldb-private.h" | ||
|
|
||
| namespace lldb_private { | ||
|
|
||
| class BreakpointLocationCollection | ||
| { | ||
| public: | ||
| BreakpointLocationCollection(); | ||
|
|
||
| ~BreakpointLocationCollection(); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Add the breakpoint \a bp_loc_sp to the list. | ||
| /// | ||
| /// @param[in] bp_sp | ||
| /// Shared pointer to the breakpoint location that will get added | ||
| /// to the list. | ||
| /// | ||
| /// @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 | ||
| /// The breakpoint index to remove. | ||
| /// | ||
| /// @param[in] break_loc_id | ||
| /// The breakpoint location index in break_id to remove. | ||
| /// | ||
| /// @result | ||
| /// \b true if the breakpoint was in the list. | ||
| //------------------------------------------------------------------ | ||
| bool | ||
| Remove (lldb::user_id_t break_id, lldb::user_id_t break_loc_id); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Returns a shared pointer to the breakpoint location with id \a | ||
| /// breakID. | ||
| /// | ||
| /// @param[in] break_id | ||
| /// The breakpoint ID to seek for. | ||
| /// | ||
| /// @param[in] break_loc_id | ||
| /// The breakpoint location ID in \a break_id to seek for. | ||
| /// | ||
| /// @result | ||
| /// A shared pointer to the breakpoint. May contain a NULL | ||
| /// pointer if the breakpoint doesn't exist. | ||
| //------------------------------------------------------------------ | ||
| lldb::BreakpointLocationSP | ||
| FindByIDPair (lldb::user_id_t break_id, lldb::user_id_t break_loc_id); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Returns a shared pointer to the breakpoint location with id \a | ||
| /// breakID, const version. | ||
| /// | ||
| /// @param[in] breakID | ||
| /// The breakpoint location ID to seek for. | ||
| /// | ||
| /// @param[in] break_loc_id | ||
| /// The breakpoint location ID in \a break_id to seek for. | ||
| /// | ||
| /// @result | ||
| /// A shared pointer to the breakpoint. May contain a NULL | ||
| /// pointer if the breakpoint doesn't exist. | ||
| //------------------------------------------------------------------ | ||
| const lldb::BreakpointLocationSP | ||
| FindByIDPair (lldb::user_id_t break_id, lldb::user_id_t break_loc_id) const; | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Returns a shared pointer to the breakpoint location with index | ||
| /// \a i. | ||
| /// | ||
| /// @param[in] i | ||
| /// The breakpoint location index to seek for. | ||
| /// | ||
| /// @result | ||
| /// A shared pointer to the breakpoint. May contain a NULL | ||
| /// pointer if the breakpoint doesn't exist. | ||
| //------------------------------------------------------------------ | ||
| lldb::BreakpointLocationSP | ||
| GetByIndex (uint32_t i); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Returns a shared pointer to the breakpoint location with index | ||
| /// \a i, const version. | ||
| /// | ||
| /// @param[in] i | ||
| /// The breakpoint location index to seek for. | ||
| /// | ||
| /// @result | ||
| /// A shared pointer to the breakpoint. May contain a NULL | ||
| /// pointer if the breakpoint doesn't exist. | ||
| //------------------------------------------------------------------ | ||
| const lldb::BreakpointLocationSP | ||
| GetByIndex (uint32_t i) const; | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Returns the number of elements in this breakpoint location list. | ||
| /// | ||
| /// @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 | ||
| /// This contains the information about this stop. | ||
| /// | ||
| /// @param[in] breakID | ||
| /// This break ID that we hit. | ||
| /// | ||
| /// @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 | ||
| /// The stream to which to print the description. | ||
| /// | ||
| /// @param[in] level | ||
| /// The description level that indicates the detail level to | ||
| /// provide. | ||
| /// | ||
| /// @see lldb::DescriptionLevel | ||
| //------------------------------------------------------------------ | ||
| void GetDescription (Stream *s, lldb::DescriptionLevel level); | ||
|
|
||
|
|
||
|
|
||
| protected: | ||
| //------------------------------------------------------------------ | ||
| // Classes that inherit from BreakpointLocationCollection can see | ||
| // and modify these | ||
| //------------------------------------------------------------------ | ||
|
|
||
| private: | ||
| //------------------------------------------------------------------ | ||
| // For BreakpointLocationCollection only | ||
| //------------------------------------------------------------------ | ||
|
|
||
| typedef std::vector<lldb::BreakpointLocationSP> collection; | ||
|
|
||
| collection::iterator | ||
| GetIDPairIterator(lldb::user_id_t break_id, lldb::user_id_t break_loc_id); | ||
|
|
||
| collection::const_iterator | ||
| GetIDPairConstIterator(lldb::user_id_t break_id, lldb::user_id_t break_loc_id) const; | ||
|
|
||
| collection m_break_loc_collection; | ||
|
|
||
| }; | ||
|
|
||
| } // namespace lldb_private | ||
|
|
||
| #endif // liblldb_BreakpointLocationCollection_h_ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,285 @@ | ||
| //===-- BreakpointLocationList.h --------------------------------*- C++ -*-===// | ||
| // | ||
| // The LLVM Compiler Infrastructure | ||
| // | ||
| // This file is distributed under the University of Illinois Open Source | ||
| // License. See LICENSE.TXT for details. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef liblldb_BreakpointLocationList_h_ | ||
| #define liblldb_BreakpointLocationList_h_ | ||
|
|
||
| // C Includes | ||
| // C++ Includes | ||
| #include <vector> | ||
| #include <map> | ||
| // Other libraries and framework includes | ||
| // Project includes | ||
| #include "lldb/lldb-private.h" | ||
| #include "lldb/Core/Address.h" | ||
| #include "lldb/Host/Mutex.h" | ||
|
|
||
| namespace lldb_private { | ||
|
|
||
| //---------------------------------------------------------------------- | ||
| /// @class BreakpointLocationList BreakpointLocationList.h "lldb/Breakpoint/BreakpointLocationList.h" | ||
| /// @brief 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 adding the location | ||
| // to this list sets its ID, and implicitly all the locations have the same breakpoint ID as | ||
| // well. If you need a generic container for breakpoint locations, use BreakpointLocationCollection. | ||
| friend class Breakpoint; | ||
|
|
||
| public: | ||
| ~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 | ||
| /// The address to look for. | ||
| /// | ||
| /// @result | ||
| /// A shared pointer to the breakpoint. May contain a NULL | ||
| /// pointer if the breakpoint doesn't exist. | ||
| //------------------------------------------------------------------ | ||
| const lldb::BreakpointLocationSP | ||
| FindByAddress (Address &addr) const; | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Returns a shared pointer to the breakpoint location with id \a | ||
| /// breakID. | ||
| /// | ||
| /// @param[in] breakID | ||
| /// The breakpoint location ID to seek for. | ||
| /// | ||
| /// @result | ||
| /// A shared pointer to the breakpoint. May contain a NULL | ||
| /// pointer if the breakpoint doesn't exist. | ||
| //------------------------------------------------------------------ | ||
| lldb::BreakpointLocationSP | ||
| FindByID (lldb::user_id_t breakID); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Returns a shared pointer to the breakpoint location with id | ||
| /// \a breakID, const version. | ||
| /// | ||
| /// @param[in] breakID | ||
| /// The breakpoint location ID to seek for. | ||
| /// | ||
| /// @result | ||
| /// A shared pointer to the breakpoint. May contain a NULL | ||
| /// pointer if the breakpoint doesn't exist. | ||
| //------------------------------------------------------------------ | ||
| const lldb::BreakpointLocationSP | ||
| FindByID (lldb::user_id_t breakID) const; | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Returns the breakpoint location id to the breakpoint location | ||
| /// at address \a addr. | ||
| /// | ||
| /// @param[in] addr | ||
| /// The address to match. | ||
| /// | ||
| /// @result | ||
| /// The ID of the breakpoint location, or LLDB_INVALID_BREAK_ID. | ||
| //------------------------------------------------------------------ | ||
| lldb::user_id_t | ||
| FindIDByAddress (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 | ||
| /// The module to seek in. | ||
| /// | ||
| /// @param[in] | ||
| /// A breakpoint collection that gets any breakpoint locations | ||
| /// that match \a module appended to. | ||
| /// | ||
| /// @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 | ||
| /// The breakpoint location index to seek for. | ||
| /// | ||
| /// @result | ||
| /// A shared pointer to the breakpoint. May contain a NULL | ||
| /// pointer if the breakpoint doesn't exist. | ||
| //------------------------------------------------------------------ | ||
| lldb::BreakpointLocationSP | ||
| GetByIndex (uint32_t i); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Returns a shared pointer to the breakpoint location with index | ||
| /// \a i, const version. | ||
| /// | ||
| /// @param[in] i | ||
| /// The breakpoint location index to seek for. | ||
| /// | ||
| /// @result | ||
| /// A shared pointer to the breakpoint. May contain a NULL | ||
| /// pointer if the breakpoint doesn't exist. | ||
| //------------------------------------------------------------------ | ||
| const lldb::BreakpointLocationSP | ||
| GetByIndex (uint32_t i) const; | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Removes all the locations in this list from their breakpoint site | ||
| /// owners list. | ||
| //------------------------------------------------------------------ | ||
| void | ||
| ClearAllBreakpointSites (); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Tells all the breakopint 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 | ||
| /// Number of qualifying breakpoint locations. | ||
| //------------------------------------------------------------------ | ||
| size_t | ||
| GetNumResolvedLocations() const; | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Removes the breakpoint location given by \b breakID from this | ||
| /// list. | ||
| /// | ||
| /// @param[in] breakID | ||
| /// The breakpoint location index to remove. | ||
| /// | ||
| /// @result | ||
| /// \b true if the breakpoint \a breakID was in the list. | ||
| //------------------------------------------------------------------ | ||
| bool | ||
| Remove (lldb::user_id_t breakID); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Enquires of the breakpoint location in this list with ID \a | ||
| /// breakID whether we should stop. | ||
| /// | ||
| /// @param[in] context | ||
| /// This contains the information about this stop. | ||
| /// | ||
| /// @param[in] breakID | ||
| /// This break ID that we hit. | ||
| /// | ||
| /// @return | ||
| /// \b true if we should stop, \b false otherwise. | ||
| //------------------------------------------------------------------ | ||
| bool | ||
| ShouldStop (StoppointCallbackContext *context, | ||
| lldb::user_id_t breakID); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Returns the number of elements in this breakpoint location list. | ||
| /// | ||
| /// @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 | ||
| /// The stream to which to print the description. | ||
| /// | ||
| /// @param[in] level | ||
| /// The description level that indicates the detail level to | ||
| /// provide. | ||
| /// | ||
| /// @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(); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Add the breakpoint \a bp_loc_sp to the list. | ||
| /// | ||
| /// @param[in] bp_sp | ||
| /// Shared pointer to the breakpoint location that will get | ||
| /// added to the list. | ||
| /// | ||
| /// @result | ||
| /// Returns breakpoint location id. | ||
| //------------------------------------------------------------------ | ||
| virtual lldb::user_id_t | ||
| Add (lldb::BreakpointLocationSP& bp_loc_sp); | ||
|
|
||
| typedef std::vector<lldb::BreakpointLocationSP> collection; | ||
| typedef std::map<lldb_private::Address, | ||
| lldb::BreakpointLocationSP, | ||
| Address::ModulePointerAndOffsetLessThanFunctionObject> addr_map; | ||
|
|
||
| // The breakpoint locations are stored in their Parent Breakpoint's location list by an | ||
| // index that is unique to this list, and not across all breakpoint location lists. | ||
| // This is only set in the Breakpoint's AddLocation method. | ||
| // There is another breakpoint location list, the owner's list in the BreakpointSite, | ||
| // but that should not reset the ID. Unfortunately UserID's SetID method is public. | ||
| lldb::break_id_t | ||
| GetNextID(); | ||
|
|
||
| collection::iterator | ||
| GetIDIterator(lldb::user_id_t breakID); | ||
|
|
||
| collection::const_iterator | ||
| GetIDConstIterator(lldb::user_id_t breakID) const; | ||
|
|
||
| collection m_locations; | ||
| addr_map m_address_to_location; | ||
| mutable Mutex m_mutex; | ||
| lldb::break_id_t m_next_id; | ||
| }; | ||
|
|
||
| } // namespace lldb_private | ||
|
|
||
| #endif // liblldb_BreakpointLocationList_h_ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,210 @@ | ||
| //===-- BreakpointOptions.h -------------------------------------*- C++ -*-===// | ||
| // | ||
| // The LLVM Compiler Infrastructure | ||
| // | ||
| // This file is distributed under the University of Illinois Open Source | ||
| // License. See LICENSE.TXT for details. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef liblldb_BreakpointOptions_h_ | ||
| #define liblldb_BreakpointOptions_h_ | ||
|
|
||
| // C Includes | ||
| // C++ Includes | ||
| // Other libraries and framework includes | ||
| // Project includes | ||
| #include "lldb/lldb-private.h" | ||
| #include "lldb/Core/Baton.h" | ||
| #include "lldb/Core/StringList.h" | ||
|
|
||
| namespace lldb_private { | ||
|
|
||
| //---------------------------------------------------------------------- | ||
| /// @class BreakpointOptions BreakpointOptions.h "lldb/Breakpoint/BreakpointOptions.h" | ||
| /// @brief Class that manages the options on a breakpoint or breakpoint location. | ||
| //---------------------------------------------------------------------- | ||
|
|
||
| class BreakpointOptions | ||
| { | ||
| public: | ||
| //------------------------------------------------------------------ | ||
| // Constructors and Destructors | ||
| //------------------------------------------------------------------ | ||
| //------------------------------------------------------------------ | ||
| /// Default constructor. The breakpoint is enabled, and has no condition, | ||
| /// callback, ignore count, etc... | ||
| //------------------------------------------------------------------ | ||
| BreakpointOptions(); | ||
| BreakpointOptions(const BreakpointOptions& rhs); | ||
|
|
||
|
|
||
| //------------------------------------------------------------------ | ||
| /// This constructor allows you to specify all the breakpoint options. | ||
| /// | ||
| /// @param[in] condition | ||
| /// The expression which if it evaluates to \b true if we are to stop | ||
| /// | ||
| /// @param[in] callback | ||
| /// This is the plugin for some code that gets run, returns \b true if we are to stop. | ||
| /// | ||
| /// @param[in] baton | ||
| /// Client data that will get passed to the callback. | ||
| /// | ||
| /// @param[in] enabled | ||
| /// Is this breakpoint enabled. | ||
| /// | ||
| /// @param[in] ignore | ||
| /// How many breakpoint hits we should ignore before stopping. | ||
| /// | ||
| /// @param[in] thread_id | ||
| /// Only stop if \a thread_id hits the breakpoint. | ||
| //------------------------------------------------------------------ | ||
| BreakpointOptions(void *condition, | ||
| BreakpointHitCallback callback, | ||
| void *baton, | ||
| bool enabled = true, | ||
| int32_t ignore = 0, | ||
| lldb::tid_t thread_id = LLDB_INVALID_THREAD_ID); | ||
|
|
||
| virtual ~BreakpointOptions(); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| // Operators | ||
| //------------------------------------------------------------------ | ||
| const BreakpointOptions& | ||
| operator=(const BreakpointOptions& rhs); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| // Callbacks | ||
| //------------------------------------------------------------------ | ||
| void SetCallback (BreakpointHitCallback callback, const lldb::BatonSP &baton_sp, bool synchronous = false); | ||
| bool InvokeCallback (StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id); | ||
| bool IsCallbackSynchronous () { | ||
| return m_callback_is_synchronous; | ||
| }; | ||
| Baton *GetBaton (); | ||
| void ClearCallback (); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| // Enabled/Ignore Count | ||
| //------------------------------------------------------------------ | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Check the Enable/Disable state. | ||
| /// @return | ||
| /// \b true if the breakpoint is enabled, \b false if disabled. | ||
| //------------------------------------------------------------------ | ||
| bool | ||
| IsEnabled () const; | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// If \a enable is \b true, enable the breakpoint, if \b false disable it. | ||
| //------------------------------------------------------------------ | ||
| void | ||
| SetEnabled (bool enabled); | ||
|
|
||
| void | ||
| SetIgnoreCount (int32_t n); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Return the current Ignore Count. | ||
| /// @return | ||
| /// The number of breakpoint hits to be ignored. | ||
| //------------------------------------------------------------------ | ||
| int32_t | ||
| GetIgnoreCount () const; | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Set the breakpoint to ignore the next \a count breakpoint hits. | ||
| /// @param[in] count | ||
| /// The number of breakpoint hits to ignore. | ||
| //------------------------------------------------------------------ | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Return the current stop thread value. | ||
| /// @return | ||
| /// The thread id for which the breakpoint hit will stop, | ||
| /// LLDB_INVALID_THREAD_ID for all threads. | ||
| //------------------------------------------------------------------ | ||
| lldb::tid_t | ||
| GetThreadID () const; | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Set the valid thread to be checked when the breakpoint is hit. | ||
| /// @param[in] thread_id | ||
| /// If this thread hits the breakpoint, we stop, otherwise not. | ||
| //------------------------------------------------------------------ | ||
| void | ||
| SetThreadID (lldb::tid_t thread_id); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// This is the default empty callback. | ||
| /// @return | ||
| /// The thread id for which the breakpoint hit will stop, | ||
| /// LLDB_INVALID_THREAD_ID for all threads. | ||
| //------------------------------------------------------------------ | ||
| static bool | ||
| NullCallback (void *baton, | ||
| StoppointCallbackContext *context, | ||
| lldb::user_id_t break_id, | ||
| lldb::user_id_t break_loc_id); | ||
|
|
||
|
|
||
| struct CommandData | ||
| { | ||
| CommandData () : | ||
| user_source(), | ||
| script_source() | ||
| { | ||
| } | ||
|
|
||
| ~CommandData () | ||
| { | ||
| } | ||
|
|
||
| StringList user_source; | ||
| StringList script_source; | ||
| }; | ||
|
|
||
| class CommandBaton : public Baton | ||
| { | ||
| public: | ||
| CommandBaton (CommandData *data) : | ||
| Baton (data) | ||
| { | ||
| } | ||
|
|
||
| virtual | ||
| ~CommandBaton () | ||
| { | ||
| delete ((CommandData *)m_data); | ||
| m_data = NULL; | ||
| } | ||
|
|
||
| virtual void | ||
| GetDescription (Stream *s, lldb::DescriptionLevel level) const; | ||
|
|
||
| }; | ||
|
|
||
| protected: | ||
| //------------------------------------------------------------------ | ||
| // Classes that inherit from BreakpointOptions can see and modify these | ||
| //------------------------------------------------------------------ | ||
|
|
||
| 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_callback_is_synchronous; | ||
| bool m_enabled; | ||
| int32_t m_ignore_count; // Number of times to ignore this breakpoint | ||
| lldb::tid_t m_thread_id; // Thread for which this breakpoint will take | ||
|
|
||
| }; | ||
|
|
||
| } // namespace lldb_private | ||
|
|
||
| #endif // liblldb_BreakpointOptions_h_ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| //===-- BreakpointResolver.h ------------------------------------*- C++ -*-===// | ||
| // | ||
| // The LLVM Compiler Infrastructure | ||
| // | ||
| // This file is distributed under the University of Illinois Open Source | ||
| // License. See LICENSE.TXT for details. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef liblldb_BreakpointResolver_h_ | ||
| #define liblldb_BreakpointResolver_h_ | ||
|
|
||
| // C Includes | ||
| // C++ Includes | ||
| // Other libraries and framework includes | ||
| // Project includes | ||
| #include "lldb/lldb-private.h" | ||
| #include "lldb/Core/Address.h" | ||
| #include "lldb/Breakpoint/Breakpoint.h" | ||
| #include "lldb/Breakpoint/BreakpointResolver.h" | ||
| #include "lldb/Core/FileSpec.h" | ||
| #include "lldb/Core/RegularExpression.h" | ||
| #include "lldb/Core/SearchFilter.h" | ||
| #include "lldb/Core/ConstString.h" | ||
|
|
||
| namespace lldb_private { | ||
|
|
||
| //---------------------------------------------------------------------- | ||
| /// @class BreakpointResolver BreakpointResolver.h "lldb/Breakpoint/BreakpointResolver.h" | ||
| /// @brief 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 your callback to get called?" of the filter. The resolver | ||
| /// answers this question (in the GetDepth method) and provides the resolution callback. | ||
| /// 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 | ||
| { | ||
| 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 | ||
| /// The breakpoint that owns this resolver. | ||
| /// | ||
| /// @result | ||
| /// Returns breakpoint location id. | ||
| //------------------------------------------------------------------ | ||
| BreakpointResolver (Breakpoint *bkpt); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// The Destructor is virtual, all significant breakpoint resolvers derive | ||
| /// from this class. | ||
| //------------------------------------------------------------------ | ||
| virtual | ||
| ~BreakpointResolver (); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// This sets the breakpoint for this resolver. | ||
| /// | ||
| /// @param[in] bkpt | ||
| /// The breakpoint that owns this resolver. | ||
| //------------------------------------------------------------------ | ||
| void | ||
| SetBreakpoint (Breakpoint *bkpt); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// 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 | ||
| /// 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 | ||
| /// 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 | ||
| /// Stream to which the output is copied. | ||
| //------------------------------------------------------------------ | ||
| virtual void | ||
| GetDescription (Stream *s) = 0; | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Standard "Dump" method. At present it does nothing. | ||
| //------------------------------------------------------------------ | ||
| virtual void | ||
| Dump (Stream *s) const = 0; | ||
|
|
||
| protected: | ||
| Target *m_target; // Every resolver has a target. | ||
| Breakpoint *m_breakpoint; // This is the breakpoint we add locations to. | ||
|
|
||
| private: | ||
| DISALLOW_COPY_AND_ASSIGN(BreakpointResolver); | ||
| }; | ||
|
|
||
| } // namespace lldb_private | ||
|
|
||
| #endif // liblldb_BreakpointResolver_h_ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| //===-- BreakpointResolverAddress.h -----------------------------*- C++ -*-===// | ||
| // | ||
| // The LLVM Compiler Infrastructure | ||
| // | ||
| // This file is distributed under the University of Illinois Open Source | ||
| // License. See LICENSE.TXT for details. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef liblldb_BreakpointResolverAddress_h_ | ||
| #define liblldb_BreakpointResolverAddress_h_ | ||
|
|
||
| // C Includes | ||
| // C++ Includes | ||
| // Other libraries and framework includes | ||
| // Project includes | ||
| #include "lldb/Breakpoint/BreakpointResolver.h" | ||
|
|
||
| namespace lldb_private { | ||
|
|
||
| //---------------------------------------------------------------------- | ||
| /// @class BreakpointResolverAddress BreakpointResolverAddress.h "lldb/Breakpoint/BreakpointResolverAddress.h" | ||
| /// @brief 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: | ||
| BreakpointResolverAddress (Breakpoint *bkpt, | ||
| const Address &addr); | ||
|
|
||
| virtual | ||
| ~BreakpointResolverAddress (); | ||
|
|
||
| virtual void | ||
| ResolveBreakpoint (SearchFilter &filter); | ||
|
|
||
| virtual void | ||
| ResolveBreakpointInModules (SearchFilter &filter, | ||
| ModuleList &modules); | ||
|
|
||
| virtual Searcher::CallbackReturn | ||
| SearchCallback (SearchFilter &filter, | ||
| SymbolContext &context, | ||
| Address *addr, | ||
| bool containing); | ||
|
|
||
| virtual Searcher::Depth | ||
| GetDepth (); | ||
|
|
||
| virtual void | ||
| GetDescription (Stream *s); | ||
|
|
||
| virtual void | ||
| Dump (Stream *s) const; | ||
|
|
||
| protected: | ||
| Address m_addr; | ||
|
|
||
| private: | ||
| DISALLOW_COPY_AND_ASSIGN(BreakpointResolverAddress); | ||
| }; | ||
|
|
||
| } // namespace lldb_private | ||
|
|
||
| #endif // liblldb_BreakpointResolverAddress_h_ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| //===-- BreakpointResolverFileLine.h ----------------------------*- C++ -*-===// | ||
| // | ||
| // The LLVM Compiler Infrastructure | ||
| // | ||
| // This file is distributed under the University of Illinois Open Source | ||
| // License. See LICENSE.TXT for details. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef liblldb_BreakpointResolverFileLine_h_ | ||
| #define liblldb_BreakpointResolverFileLine_h_ | ||
|
|
||
| // C Includes | ||
| // C++ Includes | ||
| // Other libraries and framework includes | ||
| // Project includes | ||
| #include "lldb/Breakpoint/BreakpointResolver.h" | ||
|
|
||
| namespace lldb_private { | ||
|
|
||
| //---------------------------------------------------------------------- | ||
| /// @class BreakpointResolverFileLine BreakpointResolverFileLine.h "lldb/Breakpoint/BreakpointResolverFileLine.h" | ||
| /// @brief 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: | ||
| BreakpointResolverFileLine (Breakpoint *bkpt, | ||
| const FileSpec &resolver, | ||
| uint32_t line_no, | ||
| bool check_inlines); | ||
|
|
||
| virtual | ||
| ~BreakpointResolverFileLine (); | ||
|
|
||
| virtual Searcher::CallbackReturn | ||
| SearchCallback (SearchFilter &filter, | ||
| SymbolContext &context, | ||
| Address *addr, | ||
| bool containing); | ||
|
|
||
| virtual Searcher::Depth | ||
| GetDepth (); | ||
|
|
||
| virtual void | ||
| GetDescription (Stream *s); | ||
|
|
||
| virtual void | ||
| Dump (Stream *s) const; | ||
|
|
||
| protected: | ||
| FileSpec m_file_spec; // This is the file spec we are looking for. | ||
| uint32_t m_line_number; // This is the line number that we are looking for. | ||
| bool m_inlines; // This determines whether the resolver looks for inlined functions or not. | ||
|
|
||
| private: | ||
| DISALLOW_COPY_AND_ASSIGN(BreakpointResolverFileLine); | ||
| }; | ||
|
|
||
| } // namespace lldb_private | ||
|
|
||
| #endif // liblldb_BreakpointResolverFileLine_h_ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| //===-- BreakpointResolverName.h --------------------------------*- C++ -*-===// | ||
| // | ||
| // The LLVM Compiler Infrastructure | ||
| // | ||
| // This file is distributed under the University of Illinois Open Source | ||
| // License. See LICENSE.TXT for details. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef liblldb_BreakpointResolverName_h_ | ||
| #define liblldb_BreakpointResolverName_h_ | ||
|
|
||
| // C Includes | ||
| // C++ Includes | ||
| // Other libraries and framework includes | ||
| // Project includes | ||
| #include "lldb/Breakpoint/BreakpointResolver.h" | ||
|
|
||
| namespace lldb_private { | ||
|
|
||
| //---------------------------------------------------------------------- | ||
| /// @class BreakpointResolverName BreakpointResolverName.h "lldb/Breakpoint/BreakpointResolverName.h" | ||
| /// @brief This class sets breakpoints on a given function name, either by exact match | ||
| /// or by regular expression. | ||
| //---------------------------------------------------------------------- | ||
|
|
||
| class BreakpointResolverName: | ||
| public BreakpointResolver | ||
| { | ||
| public: | ||
|
|
||
| BreakpointResolverName (Breakpoint *bkpt, | ||
| const char *func_name, | ||
| Breakpoint::MatchType type = Breakpoint::Exact); | ||
|
|
||
| // Creates a function breakpoint by regular expression. Takes over control of the lifespan of func_regex. | ||
| BreakpointResolverName (Breakpoint *bkpt, | ||
| RegularExpression &func_regex); | ||
|
|
||
| BreakpointResolverName (Breakpoint *bkpt, | ||
| const char *class_name, | ||
| const char *method, | ||
| Breakpoint::MatchType type); | ||
|
|
||
| virtual | ||
| ~BreakpointResolverName (); | ||
|
|
||
| virtual Searcher::CallbackReturn | ||
| SearchCallback (SearchFilter &filter, | ||
| SymbolContext &context, | ||
| Address *addr, | ||
| bool containing); | ||
|
|
||
| virtual Searcher::Depth | ||
| GetDepth (); | ||
|
|
||
| virtual void | ||
| GetDescription (Stream *s); | ||
|
|
||
| virtual void | ||
| Dump (Stream *s) const; | ||
|
|
||
| protected: | ||
| ConstString m_func_name; | ||
| ConstString m_class_name; // FIXME: Not used yet. The idea would be to stop on methods of this class. | ||
| RegularExpression m_regex; | ||
| Breakpoint::MatchType m_match_type; | ||
|
|
||
| private: | ||
| DISALLOW_COPY_AND_ASSIGN(BreakpointResolverName); | ||
| }; | ||
|
|
||
| } // namespace lldb_private | ||
|
|
||
| #endif // liblldb_BreakpointResolverName_h_ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,258 @@ | ||
| //===-- BreakpointSite.h ----------------------------------------*- C++ -*-===// | ||
| // | ||
| // The LLVM Compiler Infrastructure | ||
| // | ||
| // This file is distributed under the University of Illinois Open Source | ||
| // License. See LICENSE.TXT for details. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef liblldb_BreakpointSite_h_ | ||
| #define liblldb_BreakpointSite_h_ | ||
|
|
||
| // C Includes | ||
|
|
||
| // C++ Includes | ||
| #include <list> | ||
|
|
||
| // Other libraries and framework includes | ||
|
|
||
| // Project includes | ||
| #include "lldb/lldb-private.h" | ||
| #include "lldb/Core/UserID.h" | ||
| #include "lldb/Breakpoint/StoppointLocation.h" | ||
| #include "lldb/Breakpoint/BreakpointLocationCollection.h" | ||
|
|
||
| namespace lldb_private { | ||
|
|
||
| //---------------------------------------------------------------------- | ||
| /// @class BreakpointSite BreakpointSite.h "lldb/Breakpoint/BreakpointSite.h" | ||
| /// @brief Class that manages the actual breakpoint that will be inserted | ||
| /// into the running program. | ||
| /// | ||
| /// The BreakpointSite class handles the physical breakpoint that is | ||
| /// actually inserted in the target program. As such, it is also the | ||
| /// one that gets hit, when the program stops. It keeps a list of all | ||
| /// BreakpointLocations that share this phsyical 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 StoppointLocation | ||
| { | ||
| public: | ||
|
|
||
| enum Type | ||
| { | ||
| eSoftware, // Breakpoint opcode has been written to memory and m_saved_opcode | ||
| // and m_trap_opcode contain the saved and written opcode. | ||
| eHardware, // Breakpoint site is set as a hardware breakpoint | ||
| eExternal // Breakpoint site is managed by an external debug nub or | ||
| // debug interface where memory reads trasparently will not | ||
| // display any breakpoint opcodes. | ||
| }; | ||
|
|
||
| virtual ~BreakpointSite (); | ||
|
|
||
| //---------------------------------------------------------------------- | ||
| // 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, | ||
| size_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 | ||
| /// \b true if the breakoint 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 | ||
| /// This contains the information about this stop. | ||
| /// | ||
| /// @return | ||
| /// \b true if we should stop, \b false otherwise. | ||
| //------------------------------------------------------------------ | ||
| virtual bool | ||
| ShouldStop (StoppointCallbackContext *context); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Standard Dump method | ||
| /// | ||
| /// @param[in] context | ||
| /// The stream to dump this output. | ||
| //------------------------------------------------------------------ | ||
| void | ||
| Dump (Stream *s) const; | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// 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 | ||
| /// \a owner is the Breakpoint Location to add. | ||
| //------------------------------------------------------------------ | ||
| void | ||
| AddOwner (lldb::BreakpointLocationSP &owner); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// This method returns the number of breakpoint locations currently | ||
| /// located at this breakpoint site. | ||
| /// | ||
| /// @return | ||
| /// The number of owners. | ||
| //------------------------------------------------------------------ | ||
| uint32_t | ||
| GetNumberOfOwners (); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// This method returns the 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 | ||
| /// The index in the list of owners for which you wish the owner location. | ||
| /// @return | ||
| /// A shared pointer to the breakpoint location at that index. | ||
| //------------------------------------------------------------------ | ||
| lldb::BreakpointLocationSP | ||
| GetOwnerAtIndex (uint32_t index); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// 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 | ||
| /// The stream to which to print the description. | ||
| /// | ||
| /// @param[in] level | ||
| /// The description level that indicates the detail level to | ||
| /// provide. | ||
| /// | ||
| /// @see lldb::DescriptionLevel | ||
| //------------------------------------------------------------------ | ||
| void | ||
| GetDescription (Stream *s, | ||
| lldb::DescriptionLevel level); | ||
|
|
||
| bool | ||
| IsBreakpointAtThisSite (lldb::break_id_t bp_id); | ||
|
|
||
| BreakpointSite::Type | ||
| GetType () const | ||
| { | ||
| return m_type; | ||
| } | ||
|
|
||
| void | ||
| SetType (BreakpointSite::Type type) | ||
| { | ||
| m_type = type; | ||
| } | ||
|
|
||
| private: | ||
| friend class Process; | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// The method removes the owner at \a break_loc_id from this breakpoint list. | ||
| /// | ||
| /// @param[in] context | ||
| /// \a break_loc_id is the Breakpoint Location to remove. | ||
| //------------------------------------------------------------------ | ||
| uint32_t | ||
| RemoveOwner (lldb::user_id_t break_id, | ||
| lldb::user_id_t break_loc_id); | ||
|
|
||
| BreakpointSite::Type m_type;///< The type of this breakpoint site. | ||
| uint8_t m_saved_opcode[8]; ///< The saved opcode bytes if this breakpoint site uses trap opcodes. | ||
| uint8_t m_trap_opcode[8]; ///< The opcode that was used to create the breakpoint if it is a software breakpoint site. | ||
| bool m_enabled; ///< Boolean indicating if this breakpoint site enabled or not. | ||
|
|
||
| // Consider adding an optimization where if there is only one | ||
| // owner, we don't store a list. The usual case will be only one owner... | ||
| BreakpointLocationCollection m_owners; ///< This has the BreakpointLocations that share this breakpoint site. | ||
|
|
||
| static lldb::break_id_t | ||
| GetNextID(); | ||
|
|
||
| // Only the Process can create breakpoint sites in | ||
| // Process::CreateBreakpointSite (lldb::BreakpointLocationSP &, bool). | ||
| BreakpointSite (BreakpointSiteList *list, | ||
| lldb::BreakpointLocationSP& owner, | ||
| lldb::addr_t m_addr, | ||
| lldb::tid_t tid, | ||
| bool use_hardware); | ||
|
|
||
| DISALLOW_COPY_AND_ASSIGN(BreakpointSite); | ||
| }; | ||
|
|
||
| } // namespace lldb_private | ||
|
|
||
| #endif // liblldb_BreakpointSite_h_ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,217 @@ | ||
| //===-- BreakpointSiteList.h ------------------------------------*- C++ -*-===// | ||
| // | ||
| // The LLVM Compiler Infrastructure | ||
| // | ||
| // This file is distributed under the University of Illinois Open Source | ||
| // License. See LICENSE.TXT for details. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef liblldb_BreakpointSiteList_h_ | ||
| #define liblldb_BreakpointSiteList_h_ | ||
|
|
||
| // C Includes | ||
| // C++ Includes | ||
| #include <map> | ||
| // Other libraries and framework includes | ||
| // Project includes | ||
| #include "lldb/Breakpoint/BreakpointSite.h" | ||
|
|
||
| namespace lldb_private { | ||
|
|
||
| //---------------------------------------------------------------------- | ||
| /// @class BreakpointSiteList BreakpointSiteList.h "lldb/Breakpoint/BreakpointSiteList.h" | ||
| /// @brief 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). | ||
| // FIXME: Find a better interface for this. | ||
| 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 | ||
| /// A shared pointer to a breakpoint site being added to the list. | ||
| /// | ||
| /// @return | ||
| /// The ID of the BreakpointSite in the list. | ||
| //------------------------------------------------------------------ | ||
| lldb::user_id_t | ||
| Add (const lldb::BreakpointSiteSP& bp_site_sp); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// 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 | ||
| /// The address to look for. | ||
| /// | ||
| /// @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 | ||
| /// The breakpoint site ID to seek for. | ||
| /// | ||
| /// @result | ||
| /// A shared pointer to the breakpoint site. May contain a NULL pointer if the | ||
| /// breakpoint doesn't exist. | ||
| //------------------------------------------------------------------ | ||
| lldb::BreakpointSiteSP | ||
| FindByID (lldb::user_id_t breakID); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Returns a shared pointer to the breakpoint site with id \a breakID - const version. | ||
| /// | ||
| /// @param[in] breakID | ||
| /// The breakpoint site ID to seek for. | ||
| /// | ||
| /// @result | ||
| /// A shared pointer to the breakpoint site. May contain a NULL pointer if the | ||
| /// breakpoint doesn't exist. | ||
| //------------------------------------------------------------------ | ||
| const lldb::BreakpointSiteSP | ||
| FindByID (lldb::user_id_t breakID) const; | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Returns the breakpoint site id to the breakpoint site at address \a addr. | ||
| /// | ||
| /// @param[in] addr | ||
| /// The address to match. | ||
| /// | ||
| /// @result | ||
| /// The ID of the breakpoint site, or LLDB_INVALID_BREAK_ID. | ||
| //------------------------------------------------------------------ | ||
| lldb::user_id_t | ||
| FindIDByAddress (lldb::addr_t addr); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Returns a shared pointer to the breakpoint site with index \a i. | ||
| /// | ||
| /// @param[in] i | ||
| /// The breakpoint site index to seek for. | ||
| /// | ||
| /// @result | ||
| /// A shared pointer to the breakpoint site. May contain a NULL pointer if the | ||
| /// breakpoint doesn't exist. | ||
| //------------------------------------------------------------------ | ||
| lldb::BreakpointSiteSP | ||
| GetByIndex (uint32_t i); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Returns a shared pointer to the breakpoint site with index \a i - const version. | ||
| /// | ||
| /// @param[in] i | ||
| /// The breakpoint site index to seek for. | ||
| /// | ||
| /// @result | ||
| /// A shared pointer to the breakpoint site. May contain a NULL pointer if the | ||
| /// breakpoint doesn't exist. | ||
| //------------------------------------------------------------------ | ||
| const lldb::BreakpointSiteSP | ||
| GetByIndex (uint32_t i) const; | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Removes the breakpoint site given by \b breakID from this list. | ||
| /// | ||
| /// @param[in] breakID | ||
| /// The breakpoint site index to remove. | ||
| /// | ||
| /// @result | ||
| /// \b true if the breakpoint site \a breakID was in the list. | ||
| //------------------------------------------------------------------ | ||
| bool | ||
| Remove (lldb::user_id_t breakID); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Removes the breakpoint site at address \a addr from this list. | ||
| /// | ||
| /// @param[in] addr | ||
| /// The address from which to remove a breakpoint site. | ||
| /// | ||
| /// @result | ||
| /// \b true if \a addr had a breakpoint site to remove from the list. | ||
| //------------------------------------------------------------------ | ||
| bool | ||
| RemoveByAddress (lldb::addr_t addr); | ||
|
|
||
| void | ||
| SetEnabledForAll(const bool enable, const lldb::user_id_t except_id = LLDB_INVALID_BREAK_ID); | ||
|
|
||
| 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 | ||
| /// This contains the information about this stop. | ||
| /// | ||
| /// @param[in] breakID | ||
| /// This break ID that we hit. | ||
| /// | ||
| /// @return | ||
| /// \b true if we should stop, \b false otherwise. | ||
| //------------------------------------------------------------------ | ||
| bool | ||
| ShouldStop (StoppointCallbackContext *context, lldb::user_id_t breakID); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| /// Returns the number of elements in the list. | ||
| /// | ||
| /// @result | ||
| /// The number of elements. | ||
| //------------------------------------------------------------------ | ||
| size_t | ||
| GetSize() const { return m_bp_site_list.size(); } | ||
|
|
||
| protected: | ||
| typedef std::map<lldb::addr_t, lldb::BreakpointSiteSP> collection; | ||
|
|
||
| collection::iterator | ||
| GetIDIterator(lldb::user_id_t breakID); | ||
|
|
||
| collection::const_iterator | ||
| GetIDConstIterator(lldb::user_id_t breakID) const; | ||
|
|
||
| // This function exposes the m_bp_site_list. I use the in Process because there | ||
| // are places there where you want to iterate over the list, and it is less efficient | ||
| // to do it by index. FIXME: Find a better way to do this. | ||
|
|
||
| const collection * | ||
| GetMap (); | ||
|
|
||
| collection m_bp_site_list; // The breakpoint site list. | ||
| }; | ||
|
|
||
| } // namespace lldb_private | ||
|
|
||
| #endif // liblldb_BreakpointSiteList_h_ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| //===-- Stoppoint.h ---------------------------------------------*- C++ -*-===// | ||
| // | ||
| // The LLVM Compiler Infrastructure | ||
| // | ||
| // This file is distributed under the University of Illinois Open Source | ||
| // License. See LICENSE.TXT for details. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef liblldb_Stoppoint_h_ | ||
| #define liblldb_Stoppoint_h_ | ||
|
|
||
| // C Includes | ||
| // C++ Includes | ||
| // Other libraries and framework includes | ||
| // Project includes | ||
| #include "lldb/lldb-private.h" | ||
| #include "lldb/Core/UserID.h" | ||
|
|
||
| namespace lldb_private { | ||
|
|
||
| class Stoppoint | ||
| { | ||
| public: | ||
| //------------------------------------------------------------------ | ||
| // Constructors and Destructors | ||
| //------------------------------------------------------------------ | ||
| Stoppoint(); | ||
|
|
||
| virtual | ||
| ~Stoppoint(); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| // Methods | ||
| //------------------------------------------------------------------ | ||
| virtual void | ||
| Dump (Stream *) = 0; | ||
|
|
||
| virtual bool | ||
| IsEnabled () = 0; | ||
|
|
||
| virtual void | ||
| SetEnabled (bool enable) = 0; | ||
|
|
||
| lldb::break_id_t | ||
| GetID () const; | ||
|
|
||
| void | ||
| SetID (lldb::break_id_t bid); | ||
|
|
||
| protected: | ||
| lldb::break_id_t m_bid; | ||
|
|
||
| private: | ||
| //------------------------------------------------------------------ | ||
| // For Stoppoint only | ||
| //------------------------------------------------------------------ | ||
| DISALLOW_COPY_AND_ASSIGN (Stoppoint); | ||
| }; | ||
|
|
||
| } // namespace lldb_private | ||
|
|
||
| #endif // liblldb_Stoppoint_h_ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| //===-- StoppointCallbackContext.h ------------------------------*- C++ -*-===// | ||
| // | ||
| // The LLVM Compiler Infrastructure | ||
| // | ||
| // This file is distributed under the University of Illinois Open Source | ||
| // License. See LICENSE.TXT for details. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef liblldb_StoppointCallbackContext_h_ | ||
| #define liblldb_StoppointCallbackContext_h_ | ||
|
|
||
| #include "lldb/lldb-private.h" | ||
| #include "lldb/Target/ExecutionContext.h" | ||
|
|
||
| namespace lldb_private { | ||
|
|
||
| //---------------------------------------------------------------------- | ||
| /// @class StoppointCallbackContext StoppointCallbackContext.h "lldb/Breakpoint/StoppointCallbackContext.h" | ||
| /// @brief 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: | ||
| StoppointCallbackContext(); | ||
|
|
||
| StoppointCallbackContext(Event *event, Process* process, Thread *thread = NULL, StackFrame * frame = NULL, 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 | ||
| ExecutionContext context; // This tells us where we have stopped, what thread. | ||
| bool is_synchronous; // Is the callback being executed synchronously with the breakpoint, | ||
| // or asynchronously as the event is retrieved? | ||
| }; | ||
|
|
||
| } // namespace lldb_private | ||
|
|
||
| #endif // liblldb_StoppointCallbackContext_h_ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| //===-- StoppointLocation.h -------------------------------------*- C++ -*-===// | ||
| // | ||
| // The LLVM Compiler Infrastructure | ||
| // | ||
| // This file is distributed under the University of Illinois Open Source | ||
| // License. See LICENSE.TXT for details. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef liblldb_StoppointLocation_h_ | ||
| #define liblldb_StoppointLocation_h_ | ||
|
|
||
| // C Includes | ||
| // C++ Includes | ||
| // Other libraries and framework includes | ||
| // Project includes | ||
| #include "lldb/lldb-private.h" | ||
| #include "lldb/Core/UserID.h" | ||
| // #include "lldb/Breakpoint/BreakpointOptions.h" | ||
|
|
||
| namespace lldb_private { | ||
|
|
||
| class StoppointLocation | ||
| { | ||
| public: | ||
| //------------------------------------------------------------------ | ||
| // Constructors and Destructors | ||
| //------------------------------------------------------------------ | ||
| StoppointLocation (lldb::break_id_t bid, | ||
| lldb::addr_t m_addr, | ||
| lldb::tid_t tid, | ||
| bool hardware); | ||
|
|
||
| StoppointLocation (lldb::break_id_t bid, | ||
| lldb::addr_t m_addr, | ||
| lldb::tid_t tid, | ||
| size_t size, | ||
| bool hardware); | ||
|
|
||
| virtual | ||
| ~StoppointLocation (); | ||
|
|
||
| //------------------------------------------------------------------ | ||
| // Operators | ||
| //------------------------------------------------------------------ | ||
|
|
||
| //------------------------------------------------------------------ | ||
| // Methods | ||
| //------------------------------------------------------------------ | ||
| virtual lldb::addr_t | ||
| GetLoadAddress () const; | ||
|
|
||
| size_t | ||
| GetByteSize () const; | ||
|
|
||
| uint32_t | ||
| GetHitCount () const; | ||
|
|
||
| void | ||
| IncrementHitCount (); | ||
|
|
||
| uint32_t | ||
| GetHardwareIndex () const; | ||
|
|
||
| lldb::tid_t | ||
| GetThreadID() const; | ||
|
|
||
| bool | ||
| HardwarePreferred () const; | ||
|
|
||
| bool | ||
| IsHardware () const; | ||
|
|
||
| virtual bool | ||
| ShouldStop (StoppointCallbackContext *context); | ||
|
|
||
| virtual void | ||
| Dump (Stream *stream) const; | ||
|
|
||
| void | ||
| SetHardwareIndex (uint32_t index); | ||
|
|
||
| lldb::break_id_t | ||
| GetID () const; | ||
|
|
||
| protected: | ||
| //------------------------------------------------------------------ | ||
| // Classes that inherit from StoppointLocation can see and modify these | ||
| //------------------------------------------------------------------ | ||
| lldb::break_id_t m_loc_id; // Break ID | ||
| lldb::tid_t m_tid; // The thread ID if this stoppoint location is thread specific, or LLDB_INVALID_THREAD_ID if not thread specific. | ||
| lldb::addr_t m_addr; // The load address of this stop point. The base Stoppoint doesn't | ||
| // store a full Address since that's not needed for the breakpoint sites. | ||
| bool m_hw_preferred; // 1 if this point has been requested to be set using hardware (which may fail due to lack of resources) | ||
| uint32_t m_hw_index; // The hardware resource index for this breakpoint/watchpoint | ||
| uint32_t m_byte_size; // The size in bytes of stop location. e.g. the length of the trap opcode for | ||
| // software breakpoints, or the optional length in bytes for | ||
| // hardware breakpoints, or the length of the watchpoint. | ||
| uint32_t m_hit_count; // Number of times this breakpoint has been hit | ||
|
|
||
| private: | ||
| //------------------------------------------------------------------ | ||
| // For StoppointLocation only | ||
| //------------------------------------------------------------------ | ||
| DISALLOW_COPY_AND_ASSIGN(StoppointLocation); | ||
| StoppointLocation(); // Disallow default constructor | ||
| }; | ||
|
|
||
| } // namespace lldb_private | ||
|
|
||
| #endif // liblldb_StoppointLocation_h_ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| //===-- WatchpointLocation.h ------------------------------------*- C++ -*-===// | ||
| // | ||
| // The LLVM Compiler Infrastructure | ||
| // | ||
| // This file is distributed under the University of Illinois Open Source | ||
| // License. See LICENSE.TXT for details. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef liblldb_WatchpointLocation_h_ | ||
| #define liblldb_WatchpointLocation_h_ | ||
|
|
||
| // C Includes | ||
|
|
||
| // C++ Includes | ||
| #include <list> | ||
|
|
||
| // Other libraries and framework includes | ||
|
|
||
| // Project includes | ||
| #include "lldb/lldb-private.h" | ||
| #include "lldb/Core/UserID.h" | ||
| #include "lldb/Breakpoint/StoppointLocation.h" | ||
|
|
||
| namespace lldb_private { | ||
|
|
||
| class WatchpointLocation : | ||
| public StoppointLocation | ||
| { | ||
| public: | ||
|
|
||
| WatchpointLocation (lldb::addr_t m_addr, lldb::tid_t tid, bool hardware); | ||
|
|
||
| ~WatchpointLocation (); | ||
|
|
||
| bool | ||
| IsEnabled () const; | ||
|
|
||
| void | ||
| SetEnabled (uint32_t enabled); | ||
|
|
||
| bool WatchpointRead () const; | ||
| bool WatchpointWrite () const; | ||
| int32_t GetIgnoreCount () const; | ||
| void SetIgnoreCount (int32_t n); | ||
| void SetWatchpointType (uint32_t type); | ||
| bool BreakpointWasHit (StoppointCallbackContext *context); | ||
| bool SetCallback (WatchpointHitCallback callback, void *callback_baton); | ||
| void Dump (Stream *s) const; | ||
|
|
||
| private: | ||
| bool m_enabled; // Is this breakpoint enabled | ||
| uint32_t m_watch_read:1, // 1 if we stop when the watched data is read from | ||
| m_watch_write:1, // 1 if we stop when the watched data is written to | ||
| m_watch_was_read:1, // Set to 1 when watchpoint is hit for a read access | ||
| m_watch_was_written:1; // Set to 1 when watchpoint is hit for a write access | ||
| int32_t m_ignore_count; // Number of times to ignore this breakpoint | ||
| WatchpointHitCallback m_callback; | ||
| void * m_callback_baton; // Callback user data to pass to callback | ||
|
|
||
| static lldb::break_id_t | ||
| GetNextID(); | ||
|
|
||
| DISALLOW_COPY_AND_ASSIGN (WatchpointLocation); | ||
| }; | ||
|
|
||
| } // namespace lldb_private | ||
|
|
||
| #endif // liblldb_WatchpointLocation_h_ |