Blame SOURCES/gdb-rhbz1854784-powerpc-remove-region-limit-dawr-5of7.patch

a909d0
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
a909d0
From: Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
a909d0
Date: Wed, 7 Jul 2021 19:03:16 -0400
a909d0
Subject: gdb-rhbz1854784-powerpc-remove-region-limit-dawr-5of7.patch
a909d0
a909d0
;; Backport "[PowerPC] Use < 0 and >= 0 for watchpoint ptrace calls"
a909d0
;; (Pedro Franco de Carvalho, RH BZ 1854784)
a909d0
a909d0
In commit 227c0bf4b3dd0cf65dceb58e729e9da81b38b5a7, which fixed some
a909d0
watchpoint bugs, I compared the return value of some ptrace calls with ==
a909d0
-1 and != -1.  Althought this should be correct, since the rest of the
a909d0
file uses < 0 and >= 0, I have modified this for consistency.
a909d0
a909d0
gdb/ChangeLog:
a909d0
a909d0
	* ppc-linux-nat.c (ppc_linux_dreg_interface::detect)
a909d0
	(ppc_linux_nat_target::low_prepare_to_resume): Use ptrace () < 0
a909d0
	and >= to check return value instead of == -1 and != -1.
a909d0
a909d0
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
a909d0
--- a/gdb/ppc-linux-nat.c
a909d0
+++ b/gdb/ppc-linux-nat.c
a909d0
@@ -385,7 +385,7 @@ public:
a909d0
     bool no_features = false;
a909d0
 
a909d0
     if (ptrace (PPC_PTRACE_GETHWDBGINFO, ptid.lwp (), 0, &m_hwdebug_info)
a909d0
-	!= -1)
a909d0
+	>= 0)
a909d0
       {
a909d0
 	/* If there are no advertised features, we don't use the
a909d0
 	   HWDEBUG interface and try the DEBUGREG interface instead.
a909d0
@@ -431,7 +431,7 @@ public:
a909d0
       {
a909d0
 	unsigned long wp;
a909d0
 
a909d0
-	if (ptrace (PTRACE_GET_DEBUGREG, ptid.lwp (), 0, &wp) != -1)
a909d0
+	if (ptrace (PTRACE_GET_DEBUGREG, ptid.lwp (), 0, &wp) >= 0)
a909d0
 	  {
a909d0
 	    m_interface.emplace (DEBUGREG);
a909d0
 	    return;
a909d0
@@ -2880,7 +2880,7 @@ ppc_linux_nat_target::low_prepare_to_resume (struct lwp_info *lp)
a909d0
 		 the debug register state when fork and clone events are
a909d0
 		 detected.  */
a909d0
 	      if (ptrace (PPC_PTRACE_DELHWDEBUG, lp->ptid.lwp (), 0,
a909d0
-			  bp_it->first) == -1)
a909d0
+			  bp_it->first) < 0)
a909d0
 		if (errno != ENOENT)
a909d0
 		  perror_with_name (_("Error deleting hardware "
a909d0
 				      "breakpoint or watchpoint"));
a909d0
@@ -2934,7 +2934,7 @@ ppc_linux_nat_target::low_prepare_to_resume (struct lwp_info *lp)
a909d0
       long ret = ptrace (PTRACE_SET_DEBUGREG, lp->ptid.lwp (),
a909d0
 			 0, wp);
a909d0
 
a909d0
-      if (ret == -1)
a909d0
+      if (ret < 0)
a909d0
 	perror_with_name (_("Error setting hardware watchpoint"));
a909d0
     }
a909d0