Index: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp +++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp @@ -592,7 +592,7 @@ error = ReadHardwareDebugInfo (); if (error.Fail()) - return LLDB_INVALID_INDEX32; + return 0; return m_max_hwp_supported; } Index: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp +++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp @@ -544,7 +544,7 @@ error = ReadHardwareDebugInfo (); if (error.Fail()) - return LLDB_INVALID_INDEX32; + return 0; return m_max_hwp_supported; } Index: lldb/trunk/source/Target/Target.cpp =================================================================== --- lldb/trunk/source/Target/Target.cpp +++ lldb/trunk/source/Target/Target.cpp @@ -709,14 +709,13 @@ { uint32_t num_supported_hardware_watchpoints; Error rc = target->GetProcessSP()->GetWatchpointSupportInfo(num_supported_hardware_watchpoints); - if (rc.Success()) + if (num_supported_hardware_watchpoints == 0) { - uint32_t num_current_watchpoints = target->GetWatchpointList().GetSize(); - if (num_current_watchpoints >= num_supported_hardware_watchpoints) - error.SetErrorStringWithFormat("number of supported hardware watchpoints (%u) has been reached", - num_supported_hardware_watchpoints); + error.SetErrorStringWithFormat ("Target supports (%u) hardware watchpoint slots.\n", + num_supported_hardware_watchpoints); + return false; } - return false; + return true; } // See also Watchpoint::SetWatchpointType(uint32_t type) and @@ -750,6 +749,9 @@ error.SetErrorStringWithFormat ("invalid watchpoint type: %d", kind); } + if (!CheckIfWatchpointsExhausted (this, error)) + return wp_sp; + // Currently we only support one watchpoint per address, with total number // of watchpoints limited by the hardware which the inferior is running on. @@ -798,11 +800,9 @@ // Remove the said watchpoint from the list maintained by the target instance. m_watchpoint_list.Remove (wp_sp->GetID(), true); // See if we could provide more helpful error message. - if (!CheckIfWatchpointsExhausted(this, error)) - { - if (!OptionGroupWatchpoint::IsWatchSizeSupported(size)) - error.SetErrorStringWithFormat("watch size of %" PRIu64 " is not supported", (uint64_t)size); - } + if (!OptionGroupWatchpoint::IsWatchSizeSupported(size)) + error.SetErrorStringWithFormat("watch size of %" PRIu64 " is not supported", (uint64_t)size); + wp_sp.reset(); } else