Skip to content
Open
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
41 changes: 32 additions & 9 deletions lldb/include/lldb/Breakpoint/Watchpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,31 @@ class Watchpoint : public std::enable_shared_from_this<Watchpoint>,

bool ShouldStop(StoppointCallbackContext *context) override;

bool WatchpointRead() const;
bool WatchpointWrite() const;
bool WatchpointModify() const;
bool WatchpointRead() const { return m_watch_type & LLDB_WATCH_TYPE_READ; }
bool WatchpointWrite() const { return m_watch_type & LLDB_WATCH_TYPE_WRITE; }
bool WatchpointModify() const {
return m_watch_type & LLDB_WATCH_TYPE_MODIFY;
}

uint32_t GetIgnoreCount() const;
void SetIgnoreCount(uint32_t n);
void SetWatchpointType(uint32_t type, bool notify = true);
void SetDeclInfo(const std::string &str);
std::string GetWatchSpec();
std::string GetWatchSpec() const;
void SetWatchSpec(const std::string &str);
bool WatchedValueReportable(const ExecutionContext &exe_ctx);

// This function determines whether we should report a watchpoint value
// change. Specifically, it checks the watchpoint condition (if present),
// ignore count and so on.
//
// \param[in] exe_ctx This should represent the current execution context
// where execution stopped. It's used only for watchpoint condition
// evaluation.
//
// \return Returns true if we should report a watchpoint hit.
bool ShouldReport(StoppointCallbackContext &context);

// Snapshot management interface.
bool IsWatchVariable() const;
void SetWatchVariable(bool val);
Expand Down Expand Up @@ -124,7 +138,7 @@ class Watchpoint : public std::enable_shared_from_this<Watchpoint>,
void *baton, lldb_private::StoppointCallbackContext *context,
lldb::user_id_t break_id, lldb::user_id_t break_loc_id);

void GetDescription(Stream *s, lldb::DescriptionLevel level);
void GetDescription(Stream *s, lldb::DescriptionLevel level) const;
void Dump(Stream *s) const override;
bool DumpSnapshots(Stream *s, const char *prefix = nullptr) const;
void DumpWithLevel(Stream *s, lldb::DescriptionLevel description_level) const;
Expand Down Expand Up @@ -193,6 +207,17 @@ class Watchpoint : public std::enable_shared_from_this<Watchpoint>,
friend class WatchpointList;
friend class StopInfoWatchpoint; // This needs to call UndoHitCount()

lldb::ValueObjectSP CalculateWatchedValue() const;

void UpdateWatchedValue(lldb::ValueObjectSP new_value_sp) {
m_old_value_sp = m_new_value_sp;
m_new_value_sp = new_value_sp;
}

bool CheckWatchpointCondition(const ExecutionContext &exe_ctx) const;

bool EvaluateWatchpointCallback(StoppointCallbackContext &context);

void ResetHistoricValues() {
m_old_value_sp.reset();
m_new_value_sp.reset();
Expand All @@ -213,15 +238,13 @@ class Watchpoint : public std::enable_shared_from_this<Watchpoint>,
// At the end of the ephemeral mode when the watchpoint is to be enabled
// again, we check the count, if it is more than 1, it means the user-
// supplied actions actually want the watchpoint to be disabled!
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_modify : 1; // 1 if we stop when the watched data is changed
uint32_t m_watch_type;
uint32_t m_ignore_count; // Number of times to ignore this watchpoint
CompilerType m_type;
std::string m_decl_str; // Declaration information, if any.
std::string m_watch_spec_str; // Spec for the watchpoint.
lldb::ValueObjectSP m_old_value_sp;
lldb::ValueObjectSP m_new_value_sp;
CompilerType m_type;
Status m_error; // An error object describing errors associated with this
// watchpoint.
WatchpointOptions m_options; // Settable watchpoint options, which is a
Expand Down
Loading
Loading