Work with a gdb-remote target that doesn't handle the
qWatchpointSupportInfo packet correctly.
In GDBRemoteCommunicationClient::GetWatchpointSupportInfo,
if the response to qWatchpointSupportInfo does not
include the 'num' field, then we did not get an answer
we understood, mark this target as not supporting that
packet.
In Target.cpp, rename the very confusingly named
CheckIfWatchpointsExhausted to CheckIfWatchpointsSupported,
and check the error status returned by
Process::GetWatchpointSupportInfo. If we cannot determine
what the number of supported watchpoints are, assume that
they will work. We'll handle the failure
later when we try to create/enable the watchpoint if the
Z2 packet isn't supported.
Add a gdb_remote_client test case.
<rdar://problem/42621432>
llvm-svn: 346561
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 5e175d6..203355f 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -772,10 +772,16 @@
return (m_process_sp && m_process_sp->IsAlive());
}
-static bool CheckIfWatchpointsExhausted(Target *target, Status &error) {
+static bool CheckIfWatchpointsSupported(Target *target, Status &error) {
uint32_t num_supported_hardware_watchpoints;
Status rc = target->GetProcessSP()->GetWatchpointSupportInfo(
num_supported_hardware_watchpoints);
+
+ // If unable to determine the # of watchpoints available,
+ // assume they are supported.
+ if (rc.Fail())
+ return true;
+
if (num_supported_hardware_watchpoints == 0) {
error.SetErrorStringWithFormat(
"Target supports (%u) hardware watchpoint slots.\n",
@@ -814,7 +820,7 @@
error.SetErrorStringWithFormat("invalid watchpoint type: %d", kind);
}
- if (!CheckIfWatchpointsExhausted(this, error))
+ if (!CheckIfWatchpointsSupported(this, error))
return wp_sp;
// Currently we only support one watchpoint per address, with total number of