================ @@ -841,12 +841,14 @@ static bool CheckIfWatchpointsSupported(Target *target, Status &error) { if (!num_supported_hardware_watchpoints) return true; - if (num_supported_hardware_watchpoints == 0) { - error.SetErrorStringWithFormat( - "Target supports (%u) hardware watchpoint slots.\n", - *num_supported_hardware_watchpoints); - return false; - } + // If num_supported_hardware_watchpoints is zero, set an + //error message and return false. ---------------- DavidSpickett wrote:
I think this function can go one of three ways: * We can't detect h/w watch, so we assume they are supported. * We can detect them and there are > 0, return true. * We can detect them but there are 0 of them, set error message and return false. The code as you've got it here will set the error message if either of the final 2 are true. What you could do to keep the intended behaviour is simply change the if to: ``` if (*num_supported_hardware_watchpoints == 0) ``` Then there is no redundant conditon, the first if checks whether the optional is valid, the second one checks the value contained in it. https://github.com/llvm/llvm-project/pull/91882 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits