[PATCHv6 4/9] gdb/x86: move have_ptrace_getregset global into gdb/nat directory

Andrew Burgess aburgess@redhat.com
Wed May 8 16:46:40 GMT 2024


Just like the previous commit, this commit moves have_ptrace_getregset
into the nat/ directory.  This global is currently declared and
defined in both GDB and gdbserver, but this can be merged and shared.

There should be no user visible changes after this commit.
---
 gdb/linux-nat.c        | 3 ---
 gdb/linux-nat.h        | 3 ---
 gdb/nat/x86-linux.c    | 3 +++
 gdb/nat/x86-linux.h    | 3 +++
 gdbserver/linux-low.cc | 3 ---
 gdbserver/linux-low.h  | 2 --
 6 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 48ecd3627ca..38d3af56f39 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -243,9 +243,6 @@ PTRACE_PEEKTEXT/PTRACE_POKETEXT or process_vm_readv/process_vm_writev:
 
 struct linux_nat_target *linux_target;
 
-/* Does the current host support PTRACE_GETREGSET?  */
-enum tribool have_ptrace_getregset = TRIBOOL_UNKNOWN;
-
 /* When true, print debug messages relating to the linux native target.  */
 
 static bool debug_linux_nat;
diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h
index 4dcbe9e170a..fd393df5020 100644
--- a/gdb/linux-nat.h
+++ b/gdb/linux-nat.h
@@ -299,9 +299,6 @@ lwp_info_range all_lwps ();
 
 lwp_info_safe_range all_lwps_safe ();
 
-/* Does the current host support PTRACE_GETREGSET?  */
-extern enum tribool have_ptrace_getregset;
-
 /* Called from the LWP layer to inform the thread_db layer that PARENT
    spawned CHILD.  Both LWPs are currently stopped.  This function
    does whatever is required to have the child LWP under the
diff --git a/gdb/nat/x86-linux.c b/gdb/nat/x86-linux.c
index f394dc5d5e1..ed1d06bd623 100644
--- a/gdb/nat/x86-linux.c
+++ b/gdb/nat/x86-linux.c
@@ -29,6 +29,9 @@ tribool have_ptrace_getfpxregs =
 #endif
 ;
 
+/* See nat/x86-linux.h.  */
+tribool have_ptrace_getregset = TRIBOOL_UNKNOWN;
+
 /* Per-thread arch-specific data we want to keep.  */
 
 struct arch_lwp_info
diff --git a/gdb/nat/x86-linux.h b/gdb/nat/x86-linux.h
index 936e20154a0..cb5f44f4b49 100644
--- a/gdb/nat/x86-linux.h
+++ b/gdb/nat/x86-linux.h
@@ -36,6 +36,9 @@
    variable.  */
 extern tribool have_ptrace_getfpxregs;
 
+/* Does the current host support PTRACE_GETREGSET?  */
+extern tribool have_ptrace_getregset;
+
 /* Set whether our local mirror of LWP's debug registers has been
    changed since the values were last written to the thread.  Nonzero
    indicates that a change has been made, zero indicates no change.  */
diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
index ac7f9807ecc..4ba56cd34ff 100644
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -133,9 +133,6 @@ typedef struct
 } Elf64_auxv_t;
 #endif
 
-/* Does the current host support PTRACE_GETREGSET?  */
-enum tribool have_ptrace_getregset = TRIBOOL_UNKNOWN;
-
 /* Return TRUE if THREAD is the leader thread of the process.  */
 
 static bool
diff --git a/gdbserver/linux-low.h b/gdbserver/linux-low.h
index eaf87527338..273c04626b8 100644
--- a/gdbserver/linux-low.h
+++ b/gdbserver/linux-low.h
@@ -951,8 +951,6 @@ 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;
-
 /* 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
    value in *VALP and return 1.  If not found or if there is an error,
-- 
2.25.4



More information about the Gdb-patches mailing list