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