Skip to content

[lldb] [mostly NFC] Large WP foundation: WatchpointResources #68845

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 37 additions & 31 deletions lldb/include/lldb/Breakpoint/BreakpointSite.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ class BreakpointSite : public std::enable_shared_from_this<BreakpointSite>,
// display any breakpoint opcodes.
};

typedef lldb::break_id_t SiteID;
typedef lldb::break_id_t ConstituentID;

~BreakpointSite() override;

// This section manages the breakpoint traps
Expand Down Expand Up @@ -77,8 +80,8 @@ class BreakpointSite : public std::enable_shared_from_this<BreakpointSite>,
/// 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 site has no enabled constituents, 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;

Expand All @@ -101,44 +104,46 @@ class BreakpointSite : public std::enable_shared_from_this<BreakpointSite>,
/// Standard Dump method
void Dump(Stream *s) const override;

/// The "Owners" are the breakpoint locations that share this breakpoint
/// site. The method adds the \a owner to this breakpoint site's owner list.
/// The "Constituents" are the breakpoint locations that share this breakpoint
/// site. The method adds the \a constituent to this breakpoint site's
/// constituent list.
///
/// \param[in] owner
/// \a owner is the Breakpoint Location to add.
void AddOwner(const lldb::BreakpointLocationSP &owner);
/// \param[in] constituent
/// \a constituent is the Breakpoint Location to add.
void AddConstituent(const lldb::BreakpointLocationSP &constituent);

/// This method returns the number of breakpoint locations currently located
/// at this breakpoint site.
///
/// \return
/// The number of owners.
size_t GetNumberOfOwners();
/// The number of constituents.
size_t GetNumberOfConstituents();

/// This method returns the breakpoint location at index \a index located at
/// this breakpoint site. The owners are listed ordinally from 0 to
/// GetNumberOfOwners() - 1 so you can use this method to iterate over the
/// owners
/// this breakpoint site. The constituents are listed ordinally from 0 to
/// GetNumberOfConstituents() - 1 so you can use this method to iterate over
/// the constituents
///
/// \param[in] idx
/// The index in the list of owners for which you wish the owner location.
/// The index in the list of constituents for which you wish the
/// constituent location.
///
/// \return
/// A shared pointer to the breakpoint location at that index.
lldb::BreakpointLocationSP GetOwnerAtIndex(size_t idx);
lldb::BreakpointLocationSP GetConstituentAtIndex(size_t idx);

/// This method copies the breakpoint site's owners into a new collection.
/// It does this while the owners mutex is locked.
/// This method copies the breakpoint site's constituents into a new
/// collection. It does this while the constituents mutex is locked.
///
/// \param[out] out_collection
/// The BreakpointLocationCollection into which to put the owners
/// The BreakpointLocationCollection into which to put the constituents
/// of this breakpoint site.
///
/// \return
/// The number of elements copied into out_collection.
size_t CopyOwnersList(BreakpointLocationCollection &out_collection);
size_t CopyConstituentsList(BreakpointLocationCollection &out_collection);

/// Check whether the owners of this breakpoint site have any thread
/// Check whether the constituents of this breakpoint site have any thread
/// specifiers, and if yes, is \a thread contained in any of these
/// specifiers.
///
Expand All @@ -151,7 +156,7 @@ class BreakpointSite : public std::enable_shared_from_this<BreakpointSite>,
bool ValidForThisThread(Thread &thread);

/// Print a description of this breakpoint site to the stream \a s.
/// GetDescription tells you about the breakpoint site's owners. Use
/// GetDescription tells you about the breakpoint site's constituents. Use
/// BreakpointSite::Dump(Stream *) to get information about the breakpoint
/// site itself.
///
Expand Down Expand Up @@ -203,9 +208,10 @@ class BreakpointSite : public std::enable_shared_from_this<BreakpointSite>,

void BumpHitCounts();

/// The method removes the owner at \a break_loc_id from this breakpoint
/// The method removes the constituent at \a break_loc_id from this breakpoint
/// list.
size_t RemoveOwner(lldb::break_id_t break_id, lldb::break_id_t break_loc_id);
size_t RemoveConstituent(lldb::break_id_t break_id,
lldb::break_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
Expand All @@ -215,20 +221,20 @@ class BreakpointSite : public std::enable_shared_from_this<BreakpointSite>,
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.
std::recursive_mutex
m_owners_mutex; ///< This mutex protects the owners collection.
// Consider adding an optimization where if there is only one constituent, we
// don't store a list. The usual case will be only one constituent...
BreakpointLocationCollection
m_constituents; ///< This has the BreakpointLocations
/// that share this breakpoint site.
std::recursive_mutex m_constituents_mutex; ///< This mutex protects the
///< constituents collection.

static lldb::break_id_t GetNextID();

// Only the Process can create breakpoint sites in
// Process::CreateBreakpointSite (lldb::BreakpointLocationSP &, bool).
BreakpointSite(BreakpointSiteList *list,
const lldb::BreakpointLocationSP &owner, lldb::addr_t m_addr,
bool use_hardware);
BreakpointSite(const lldb::BreakpointLocationSP &constituent,
lldb::addr_t m_addr, bool use_hardware);

BreakpointSite(const BreakpointSite &) = delete;
const BreakpointSite &operator=(const BreakpointSite &) = delete;
Expand Down
173 changes: 0 additions & 173 deletions lldb/include/lldb/Breakpoint/BreakpointSiteList.h

This file was deleted.

Loading