Skip to content

Commit 421b4ee

Browse files
committed
Revert "Fix redundant condition in Target.cpp"
This reverts commit 9b41609. The CheckIfWatchpointsSupported function is refactored to maintain the intended behavior as described below: 1. If we can't detect hardware watchpoints, assume they are supported. 2. If we can detect hardware watchpoints and there are more than 0, return true. 3. If we can detect hardware watchpoints but there are 0 of them, set an error message and return false. fix #87244
1 parent 9b41609 commit 421b4ee

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

lldb/source/Target/Target.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -841,14 +841,12 @@ static bool CheckIfWatchpointsSupported(Target *target, Status &error) {
841841
if (!num_supported_hardware_watchpoints)
842842
return true;
843843

844-
// If num_supported_hardware_watchpoints is zero, set an
845-
//error message and return false.
846-
847-
error.SetErrorStringWithFormat(
848-
"Target supports (%u) hardware watchpoint slots.\n",
849-
*num_supported_hardware_watchpoints);
850-
return false;
851-
844+
if (*num_supported_hardware_watchpoints == 0) {
845+
error.SetErrorStringWithFormat(
846+
"Target supports (%u) hardware watchpoint slots.\n",
847+
*num_supported_hardware_watchpoints);
848+
return false;
849+
}
852850
return true;
853851
}
854852

0 commit comments

Comments
 (0)