public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] Revert "gdbserver: convert have_ptrace_getregset to a tribool"
Date: Tue, 26 Mar 2024 18:59:34 +0000 (GMT)	[thread overview]
Message-ID: <20240326185934.DEBD53858413@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=56f703d39d6f4793ba73b2364a4ea052e8ad755d

commit 56f703d39d6f4793ba73b2364a4ea052e8ad755d
Author: Andrew Burgess <aburgess@redhat.com>
Date:   Tue Mar 26 18:53:31 2024 +0000

    Revert "gdbserver: convert have_ptrace_getregset to a tribool"
    
    This reverts commit 5920765d7513aaae9241a1850d62d73e0477f81c.

Diff:
---
 gdbserver/linux-arm-low.cc |  6 +++---
 gdbserver/linux-low.cc     |  2 +-
 gdbserver/linux-low.h      |  2 +-
 gdbserver/linux-x86-low.cc | 10 +++++-----
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/gdbserver/linux-arm-low.cc b/gdbserver/linux-arm-low.cc
index b4f0e071c92..396ec88081b 100644
--- a/gdbserver/linux-arm-low.cc
+++ b/gdbserver/linux-arm-low.cc
@@ -1007,9 +1007,9 @@ arm_target::low_arch_setup ()
 
   /* Check if PTRACE_GETREGSET works.  */
   if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, &iov) == 0)
-    have_ptrace_getregset = TRIBOOL_TRUE;
+    have_ptrace_getregset = 1;
   else
-    have_ptrace_getregset = TRIBOOL_FALSE;
+    have_ptrace_getregset = 0;
 }
 
 bool
@@ -1122,7 +1122,7 @@ arm_target::get_regs_info ()
 {
   const struct target_desc *tdesc = current_process ()->tdesc;
 
-  if (have_ptrace_getregset == TRIBOOL_TRUE
+  if (have_ptrace_getregset == 1
       && (is_aarch32_linux_description (tdesc)
 	  || arm_linux_get_tdesc_fp_type (tdesc) == ARM_FP_TYPE_VFPV3))
     return &regs_info_aarch32;
diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
index dfa26d451b0..9d5a6242803 100644
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -135,7 +135,7 @@ typedef struct
 #endif
 
 /* Does the current host support PTRACE_GETREGSET?  */
-enum tribool have_ptrace_getregset = TRIBOOL_UNKNOWN;
+int have_ptrace_getregset = -1;
 
 /* Return TRUE if THREAD is the leader thread of the process.  */
 
diff --git a/gdbserver/linux-low.h b/gdbserver/linux-low.h
index eaf87527338..d34d2738238 100644
--- a/gdbserver/linux-low.h
+++ b/gdbserver/linux-low.h
@@ -951,7 +951,7 @@ void thread_db_notice_clone (struct thread_info *parent_thr, ptid_t child_ptid);
 
 bool thread_db_thread_handle (ptid_t ptid, gdb_byte **handle, int *handle_len);
 
-extern enum tribool have_ptrace_getregset;
+extern int have_ptrace_getregset;
 
 /* Search for the value with type MATCH in the auxv vector, with entries of
    length WORDSIZE bytes, of process with pid PID.  If found, store the
diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc
index 04202e355bb..933d1fb012a 100644
--- a/gdbserver/linux-x86-low.cc
+++ b/gdbserver/linux-x86-low.cc
@@ -899,7 +899,7 @@ x86_linux_read_description (void)
       if (ptrace (PTRACE_GETFPXREGS, tid, 0, (long) &fpxregs) < 0)
 	{
 	  have_ptrace_getfpxregs = 0;
-	  have_ptrace_getregset = TRIBOOL_FALSE;
+	  have_ptrace_getregset = 0;
 	  return i386_linux_read_description (X86_XSTATE_X87);
 	}
       else
@@ -918,7 +918,7 @@ x86_linux_read_description (void)
 	return tdesc_i386_linux_no_xml.get ();
     }
 
-  if (have_ptrace_getregset == TRIBOOL_UNKNOWN)
+  if (have_ptrace_getregset == -1)
     {
       uint64_t xstateregs[(X86_XSTATE_SSE_SIZE / sizeof (uint64_t))];
       struct iovec iov;
@@ -929,10 +929,10 @@ x86_linux_read_description (void)
       /* Check if PTRACE_GETREGSET works.  */
       if (ptrace (PTRACE_GETREGSET, tid,
 		  (unsigned int) NT_X86_XSTATE, (long) &iov) < 0)
-	have_ptrace_getregset = TRIBOOL_FALSE;
+	have_ptrace_getregset = 0;
       else
 	{
-	  have_ptrace_getregset = TRIBOOL_TRUE;
+	  have_ptrace_getregset = 1;
 
 	  /* Get XCR0 from XSAVE extended state.  */
 	  xcr0 = xstateregs[(I386_LINUX_XSAVE_XCR0_OFFSET
@@ -955,7 +955,7 @@ x86_linux_read_description (void)
     }
 
   /* Check the native XCR0 only if PTRACE_GETREGSET is available.  */
-  xcr0_features = (have_ptrace_getregset == TRIBOOL_TRUE
+  xcr0_features = (have_ptrace_getregset
 		   && (xcr0 & X86_XSTATE_ALL_MASK));
 
   if (xcr0_features)

                 reply	other threads:[~2024-03-26 18:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240326185934.DEBD53858413@sourceware.org \
    --to=aburgess@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).