diff options
author | Pedro Franco de Carvalho <pedromfc@linux.ibm.com> | 2020-08-14 15:41:13 -0300 |
---|---|---|
committer | Pedro Franco de Carvalho <pedromfc@linux.ibm.com> | 2020-08-14 15:41:13 -0300 |
commit | 6e562fa3ba95b5415b269410137c0ca3e620a08d (patch) | |
tree | 199507168df2d5215aab75def94fa900e1e86add | |
parent | d369b608a1fc84813762e71a40a6cafb3ab828fe (diff) | |
download | gdb-6e562fa3ba95b5415b269410137c0ca3e620a08d.zip gdb-6e562fa3ba95b5415b269410137c0ca3e620a08d.tar.gz gdb-6e562fa3ba95b5415b269410137c0ca3e620a08d.tar.bz2 |
[PowerPC] Use < 0 and >= 0 for watchpoint ptrace calls
In commit 227c0bf4b3dd0cf65dceb58e729e9da81b38b5a7, which fixed some
watchpoint bugs, I compared the return value of some ptrace calls with ==
-1 and != -1. Althought this should be correct, since the rest of the
file uses < 0 and >= 0, I have modified this for consistency.
gdb/ChangeLog:
* ppc-linux-nat.c (ppc_linux_dreg_interface::detect)
(ppc_linux_nat_target::low_prepare_to_resume): Use ptrace () < 0
and >= to check return value instead of == -1 and != -1.
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/ppc-linux-nat.c | 8 |
2 files changed, 10 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 63d1bab..5fbc887 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2020-08-14 Pedro Franco de Carvalho <pedromfc@linux.ibm.com> + + * ppc-linux-nat.c (ppc_linux_dreg_interface::detect) + (ppc_linux_nat_target::low_prepare_to_resume): Use ptrace () < 0 + and >= to check return value instead of == -1 and != -1. + 2020-08-14 Simon Marchi <simon.marchi@polymtl.ca> * utils.h (class gdb_argv) <as_array_view>: New method. diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index 6be8f02..89efdae 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -379,7 +379,7 @@ public: bool no_features = false; if (ptrace (PPC_PTRACE_GETHWDBGINFO, ptid.lwp (), 0, &m_hwdebug_info) - != -1) + >= 0) { /* If there are no advertised features, we don't use the HWDEBUG interface and try the DEBUGREG interface instead. @@ -425,7 +425,7 @@ public: { unsigned long wp; - if (ptrace (PTRACE_GET_DEBUGREG, ptid.lwp (), 0, &wp) != -1) + if (ptrace (PTRACE_GET_DEBUGREG, ptid.lwp (), 0, &wp) >= 0) { m_interface.emplace (DEBUGREG); return; @@ -2867,7 +2867,7 @@ ppc_linux_nat_target::low_prepare_to_resume (struct lwp_info *lp) the debug register state when fork and clone events are detected. */ if (ptrace (PPC_PTRACE_DELHWDEBUG, lp->ptid.lwp (), 0, - bp_it->first) == -1) + bp_it->first) < 0) if (errno != ENOENT) perror_with_name (_("Error deleting hardware " "breakpoint or watchpoint")); @@ -2921,7 +2921,7 @@ ppc_linux_nat_target::low_prepare_to_resume (struct lwp_info *lp) long ret = ptrace (PTRACE_SET_DEBUGREG, lp->ptid.lwp (), 0, wp); - if (ret == -1) + if (ret < 0) perror_with_name (_("Error setting hardware watchpoint")); } |