summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2011-09-06 22:38:36 +0000
committerJohnny Chen <johnny.chen@apple.com>2011-09-06 22:38:36 +0000
commit11309a39ea91114d6020c1085d77b16cfbfa394e (patch)
tree1fceae26179271fcb2365c0f7cbb9cee0cc1130e
parentcf57ebfd4ca5308dc7f44cc0cacea8d24e9af202 (diff)
downloadbcm5719-llvm-11309a39ea91114d6020c1085d77b16cfbfa394e.tar.gz
bcm5719-llvm-11309a39ea91114d6020c1085d77b16cfbfa394e.zip
Fill out implementation of Enable/DisableWatchpoint() for ProcessGDBRemote class (Not Tested Yet).
Also update the signature of WatchpointLocation::SetEnable() to take a bool as input arg. llvm-svn: 139198
-rw-r--r--lldb/include/lldb/Breakpoint/WatchpointLocation.h2
-rw-r--r--lldb/source/Breakpoint/WatchpointLocation.cpp2
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp50
3 files changed, 48 insertions, 6 deletions
diff --git a/lldb/include/lldb/Breakpoint/WatchpointLocation.h b/lldb/include/lldb/Breakpoint/WatchpointLocation.h
index 12dbb4573b2..77c0ba20bae 100644
--- a/lldb/include/lldb/Breakpoint/WatchpointLocation.h
+++ b/lldb/include/lldb/Breakpoint/WatchpointLocation.h
@@ -37,7 +37,7 @@ public:
IsEnabled () const;
void
- SetEnabled (uint32_t enabled);
+ SetEnabled (bool enabled);
bool WatchpointRead () const;
bool WatchpointWrite () const;
diff --git a/lldb/source/Breakpoint/WatchpointLocation.cpp b/lldb/source/Breakpoint/WatchpointLocation.cpp
index 1b72d758c14..3387e483605 100644
--- a/lldb/source/Breakpoint/WatchpointLocation.cpp
+++ b/lldb/source/Breakpoint/WatchpointLocation.cpp
@@ -99,7 +99,7 @@ WatchpointLocation::IsEnabled() const
}
void
-WatchpointLocation::SetEnabled(uint32_t enabled)
+WatchpointLocation::SetEnabled(bool enabled)
{
if (!enabled)
SetHardwareIndex(LLDB_INVALID_INDEX32);
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 0c02ff6073f..5c04c36e41e 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -1882,6 +1882,24 @@ ProcessGDBRemote::DisableBreakpoint (BreakpointSite *bp_site)
return error;
}
+// Pre-requisite: wp != NULL.
+static GDBStoppointType
+GetGDBStoppointType (WatchpointLocation *wp)
+{
+ assert(wp);
+ bool watch_read = wp->WatchpointRead();
+ bool watch_write = wp->WatchpointWrite();
+
+ // watch_read and watch_write cannot both be false.
+ assert(watch_read || watch_write);
+ if (watch_read && watch_write)
+ return eWatchpointReadWrite;
+ if (watch_read)
+ return eWatchpointRead;
+ if (watch_write)
+ return eWatchpointWrite;
+}
+
Error
ProcessGDBRemote::EnableWatchpoint (WatchpointLocation *wp)
{
@@ -1899,11 +1917,21 @@ ProcessGDBRemote::EnableWatchpoint (WatchpointLocation *wp)
log->Printf("ProcessGDBRemote::EnableWatchpoint(watchID = %d) addr = 0x%8.8llx: watchpoint already enabled.", watchID, (uint64_t)addr);
return error;
}
- else
+
+ GDBStoppointType type = GetGDBStoppointType(wp);
+ // Pass down an appropriate z/Z packet...
+ if (m_gdb_comm.SupportsGDBStoppointPacket (type))
{
- // Pass down an appropriate z/Z packet...
- error.SetErrorString("watchpoints not supported");
+ if (m_gdb_comm.SendGDBStoppointTypePacket(type, true, addr, wp->GetByteSize()) == 0)
+ {
+ wp->SetEnabled(true);
+ return error;
+ }
+ else
+ error.SetErrorString("sending gdb watchpoint packet failed");
}
+ else
+ error.SetErrorString("watchpoints not supported");
}
else
{
@@ -1928,10 +1956,24 @@ ProcessGDBRemote::DisableWatchpoint (WatchpointLocation *wp)
if (log)
log->Printf ("ProcessGDBRemote::DisableWatchpoint (watchID = %d) addr = 0x%8.8llx", watchID, (uint64_t)addr);
+ if (!wp->IsEnabled())
+ {
+ if (log)
+ log->Printf ("ProcessGDBRemote::DisableWatchpoint (watchID = %d) addr = 0x%8.8llx -- SUCCESS (already disabled)", watchID, (uint64_t)addr);
+ return error;
+ }
+
if (wp->IsHardware())
{
+ GDBStoppointType type = GetGDBStoppointType(wp);
// Pass down an appropriate z/Z packet...
- error.SetErrorString("watchpoints not supported");
+ if (m_gdb_comm.SendGDBStoppointTypePacket(type, false, addr, wp->GetByteSize()) == 0)
+ {
+ wp->SetEnabled(false);
+ return error;
+ }
+ else
+ error.SetErrorString("sending gdb watchpoint packet failed");
}
// TODO: clear software watchpoints if we implement them
}
OpenPOWER on IntegriCloud