[PATCHv5,04/11] gdb/x86: move have_ptrace_getfpxregs global into gdb/nat directory
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
success
|
Testing passed
|
Commit Message
The have_ptrace_getfpxregs global tracks whether GDB or gdbserver is
running on a kernel that supports the GETFPXREGS ptrace request.
Currently this global is declared twice (once in GDB and once in
gdbserver), but it makes sense to move this global into the nat/
directory, and have a single declaration and definition.
This is a refactor, there should be no user visible changes after this
commit.
---
gdb/Makefile.in | 1 -
gdb/i386-linux-nat.c | 18 +-----------------
gdb/i386-linux-nat.h | 26 --------------------------
gdb/nat/x86-linux.c | 9 +++++++++
gdb/nat/x86-linux.h | 16 ++++++++++++++++
gdb/x86-linux-nat.c | 3 ---
gdbserver/linux-x86-low.cc | 11 -----------
7 files changed, 26 insertions(+), 58 deletions(-)
delete mode 100644 gdb/i386-linux-nat.h
Comments
> -----Original Message-----
> From: Andrew Burgess <aburgess@redhat.com>
> Sent: Freitag, 26. April 2024 17:02
> To: gdb-patches@sourceware.org
> Cc: Andrew Burgess <aburgess@redhat.com>; Willgerodt, Felix
> <felix.willgerodt@intel.com>; John Baldwin <jhb@FreeBSD.org>
> Subject: [PATCHv5 04/11] gdb/x86: move have_ptrace_getfpxregs global into
> gdb/nat directory
>
> The have_ptrace_getfpxregs global tracks whether GDB or gdbserver is
> running on a kernel that supports the GETFPXREGS ptrace request.
>
> Currently this global is declared twice (once in GDB and once in
> gdbserver), but it makes sense to move this global into the nat/
> directory, and have a single declaration and definition.
>
> This is a refactor, there should be no user visible changes after this
> commit.
> ---
> gdb/Makefile.in | 1 -
> gdb/i386-linux-nat.c | 18 +-----------------
> gdb/i386-linux-nat.h | 26 --------------------------
> gdb/nat/x86-linux.c | 9 +++++++++
> gdb/nat/x86-linux.h | 16 ++++++++++++++++
> gdb/x86-linux-nat.c | 3 ---
> gdbserver/linux-x86-low.cc | 11 -----------
> 7 files changed, 26 insertions(+), 58 deletions(-)
> delete mode 100644 gdb/i386-linux-nat.h
This fixes my m32 gdbserver build and lgtm in general.
But since we are already touching it, can't we make this a tribool as well?
Thanks,
Felix
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
@@ -1396,7 +1396,6 @@ HFILES_NO_SRCDIR = \
hppa-tdep.h \
i386-bsd-nat.h \
i386-darwin-tdep.h \
- i386-linux-nat.h \
i386-linux-tdep.h \
i386-tdep.h \
i387-tdep.h \
@@ -26,7 +26,7 @@
#include "gregset.h"
#include "gdb_proc_service.h"
-#include "i386-linux-nat.h"
+#include "nat/x86-linux.h"
#include "i387-tdep.h"
#include "i386-tdep.h"
#include "i386-linux-tdep.h"
@@ -80,22 +80,6 @@ int have_ptrace_getregs =
0
#endif
;
-
-/* Does the current host support the GETFPXREGS request? The header
- file may or may not define it, and even if it is defined, the
- kernel will return EIO if it's running on a pre-SSE processor.
-
- My instinct is to attach this to some architecture- or
- target-specific data structure, but really, a particular GDB
- process can only run on top of one kernel at a time. So it's okay
- for this to be a simple variable. */
-int have_ptrace_getfpxregs =
-#ifdef HAVE_PTRACE_GETFPXREGS
- -1
-#else
- 0
-#endif
-;
/* Accessing registers through the U area, one at a time. */
deleted file mode 100644
@@ -1,26 +0,0 @@
-/* Native-dependent code for GNU/Linux i386.
-
- Copyright (C) 1999-2024 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef I386_LINUX_NAT_H
-#define I386_LINUX_NAT_H 1
-
-/* Does the current host support the GETFPXREGS request? */
-extern int have_ptrace_getfpxregs;
-
-#endif
@@ -22,6 +22,15 @@
#include "nat/gdb_ptrace.h"
#include <sys/user.h>
+/* See nat/x86-linux.h. */
+int have_ptrace_getfpxregs =
+#ifdef HAVE_PTRACE_GETFPXREGS
+ -1
+#else
+ 0
+#endif
+;
+
/* Per-thread arch-specific data we want to keep. */
struct arch_lwp_info
@@ -22,6 +22,22 @@
#include "nat/linux-nat.h"
+/* Does the current host support the GETFPXREGS request? The system header
+ file may or may not define it, but even if it is defined, the kernel
+ will return EIO if it's running on a pre-SSE processor.
+
+ A value of -1 indicates that we don't know yet, we've not yet tried the
+ ptrace call; a value of 0 indicates we've previously tried the ptrace
+ call and it failed, indicating this request is not supported; and a
+ value of 1 indicates that we've previously tried the ptrace call and it
+ has been successful.
+
+ My instinct is to attach this to some architecture- or target-specific
+ data structure, but really, a particular GDB process can only run on top
+ of one kernel at a time. So it's okay - for this to be a global
+ variable. */
+extern int have_ptrace_getfpxregs;
+
/* 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. */
@@ -26,9 +26,6 @@
#include <sys/uio.h>
#include "x86-nat.h"
-#ifndef __x86_64__
-#include "i386-linux-nat.h"
-#endif
#include "x86-linux-nat.h"
#include "i386-linux-tdep.h"
#ifdef __x86_64__
@@ -852,17 +852,6 @@ static int use_xml;
the process/thread is in. */
#define I386_LINUX_XSAVE_XCR0_OFFSET 464
-/* Does the current host support the GETFPXREGS request? The header
- file may or may not define it, and even if it is defined, the
- kernel will return EIO if it's running on a pre-SSE processor. */
-int have_ptrace_getfpxregs =
-#ifdef HAVE_PTRACE_GETFPXREGS
- -1
-#else
- 0
-#endif
-;
-
/* Get Linux/x86 target description from running target. */
static const struct target_desc *