diff options
author | Johnny Chen <johnny.chen@apple.com> | 2011-09-06 22:38:36 +0000 |
---|---|---|
committer | Johnny Chen <johnny.chen@apple.com> | 2011-09-06 22:38:36 +0000 |
commit | 11309a39ea91114d6020c1085d77b16cfbfa394e (patch) | |
tree | 1fceae26179271fcb2365c0f7cbb9cee0cc1130e /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | |
parent | cf57ebfd4ca5308dc7f44cc0cacea8d24e9af202 (diff) | |
download | bcm5719-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
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | 50 |
1 files changed, 46 insertions, 4 deletions
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 } |