Fix test failures in TestWatchpointIter.py due to http://llvm.org/viewvc/llvm-project?rev=162322&view=rev.

llvm-svn: 162328
This commit is contained in:
Johnny Chen 2012-08-21 23:17:04 +00:00
parent bbdd467895
commit 4fe2302ae2
3 changed files with 34 additions and 1 deletions

View File

@ -150,6 +150,12 @@ public:
//------------------------------------------------------------------ //------------------------------------------------------------------
const char *GetConditionText () const; const char *GetConditionText () const;
void
TurnOnEphemeralMode();
void
TurnOffEphemeralMode();
private: private:
friend class Target; friend class Target;
friend class WatchpointList; friend class WatchpointList;
@ -161,6 +167,9 @@ private:
bool m_enabled; // Is this watchpoint enabled bool m_enabled; // Is this watchpoint enabled
bool m_is_hardware; // Is this a hardware watchpoint bool m_is_hardware; // Is this a hardware watchpoint
bool m_is_watch_variable; // True if set via 'watchpoint set variable'. bool m_is_watch_variable; // True if set via 'watchpoint set variable'.
bool m_is_ephemeral; // True if the watchpoint is in the ephemeral mode, meaning that it is
// undergoing a pair of temporary disable/enable actions to avoid recursively
// triggering further watchpoint events.
uint32_t m_watch_read:1, // 1 if we stop when the watched data is read from 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_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_read:1, // Set to 1 when watchpoint is hit for a read access

View File

@ -29,6 +29,7 @@ Watchpoint::Watchpoint (lldb::addr_t addr, size_t size, bool hardware) :
m_enabled(false), m_enabled(false),
m_is_hardware(hardware), m_is_hardware(hardware),
m_is_watch_variable(false), m_is_watch_variable(false),
m_is_ephemeral(false),
m_watch_read(0), m_watch_read(0),
m_watch_write(0), m_watch_write(0),
m_watch_was_read(0), m_watch_was_read(0),
@ -307,11 +308,28 @@ Watchpoint::IsEnabled() const
return m_enabled; return m_enabled;
} }
// Within StopInfo.cpp, we purposely turn on the ephemeral mode right before temporarily disable the watchpoint
// in order to perform possible watchpoint actions without triggering further watchpoint events.
// After the temporary disabled watchpoint is enabled, we then turn off the ephemeral mode.
void
Watchpoint::TurnOnEphemeralMode()
{
m_is_ephemeral = true;
}
void
Watchpoint::TurnOffEphemeralMode()
{
m_is_ephemeral = false;
}
void void
Watchpoint::SetEnabled(bool enabled) Watchpoint::SetEnabled(bool enabled)
{ {
if (!enabled) if (!enabled)
{ {
if (!m_is_ephemeral)
SetHardwareIndex(LLDB_INVALID_INDEX32); SetHardwareIndex(LLDB_INVALID_INDEX32);
// Don't clear the snapshots for now. // Don't clear the snapshots for now.
// Within StopInfo.cpp, we purposely do disable/enable watchpoint while performing watchpoint actions. // Within StopInfo.cpp, we purposely do disable/enable watchpoint while performing watchpoint actions.

View File

@ -454,12 +454,18 @@ public:
watchpoint(w) watchpoint(w)
{ {
if (process && watchpoint) if (process && watchpoint)
{
watchpoint->TurnOnEphemeralMode();
process->DisableWatchpoint(watchpoint); process->DisableWatchpoint(watchpoint);
} }
}
~WatchpointSentry() ~WatchpointSentry()
{ {
if (process && watchpoint) if (process && watchpoint)
{
process->EnableWatchpoint(watchpoint); process->EnableWatchpoint(watchpoint);
watchpoint->TurnOffEphemeralMode();
}
} }
private: private:
Process *process; Process *process;