From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id eBLEAUHCK2Zj5TwAWB0awg (envelope-from ) for ; Fri, 26 Apr 2024 11:03:29 -0400 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ElGJ86zY; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 011B41E0CE; Fri, 26 Apr 2024 11:03:28 -0400 (EDT) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id E2C061E0C0 for ; Fri, 26 Apr 2024 11:03:26 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 98C20384AB6C for ; Fri, 26 Apr 2024 15:03:26 +0000 (GMT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 88245384AB4B for ; Fri, 26 Apr 2024 15:02:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 88245384AB4B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 88245384AB4B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714143741; cv=none; b=l2HtinJhOTrbfZkPop67BFzU167EIAroTWbeveWBS9JNLsqgPWyQwppmyyXtbHKoy/gF430lNgrjQC2aYQGw2abAM5RkTcsrC9ZE4Tg3WnXRK0+IwjRLIGAtRwsLEaTH8CN7Ka528/75Y5YbOQbP9Tf8Uz5stmu7oYVRZhnY54I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714143741; c=relaxed/simple; bh=q4P6zsVLJ0PTV0jDURQhdEbzYILUH+SioqRFNla5N5s=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=LNsa7mUSW3GhLuI0OUZj0O7pS+004aEh1Ftk2D8xaGIIdxmIKbvKyXD9OOlbbCAnvPBXS3iHr1D6evyqiCCFhJSi4M3rCD6Qs+uGwNA4gTqQjwiXX9XJv/l7Lr9PeH7NEL+W7OJ6G2sKyuL69XAfHgu+FlVyfT8wIPofkJBVjhU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714143736; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M5iPh0br2HkeeIdnUp1zGxY4aLRMDWvA76ff/nXphpQ=; b=ElGJ86zYK0Sb4twZNa1HcYjKovlKj6T3F8wvYY3+L1b28/hxSFeOpHqKabXT+fHH+v9aLB 6W+E5tHs3wpiUjZx7uvcIkBw7ygguP0v2dZCUVn1+8PaQT5VuTVzr6idpFZzQQzaTc3QXm lOnbqHUxmBLCDgrqzqNjQ7h0CJ7Uqbk= Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-544-SWBZPgfWNXWEie0QVtiw5A-1; Fri, 26 Apr 2024 11:02:14 -0400 X-MC-Unique: SWBZPgfWNXWEie0QVtiw5A-1 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2d87ba1f5e0so19293111fa.2 for ; Fri, 26 Apr 2024 08:02:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714143733; x=1714748533; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HVwTUs3Nsy2pK5Xr1iOeFpmo+0r8XPAAd/XPf/xUVSI=; b=B19Bm5C8gl0FnE9uKH+8szNtowx/EzQWOBZpNOnLCYG0PWxk7KTSDqvn+LPK3cXN/o D2uwmnoIwIKOUEuXWZ9hddZiNtm8GJTZ0mJmRcc44koBPLii4q4RKpu/aPbsoJCqzROA bzDHfOw+hZKlSQW4CTDuSY7kXGo/CXFV9uAhgqLrd0J6MGPumkcteJ28E2KkNLTkQKZH fym39gO3/lEvrA5A8/0j5tAgkElSh4967xIOyf0DJ85oCLfCDySWj2yief1FCW7z1vTm yEay2rAtFO8c7DZlC/TT8V7MJ8vgTVqPFPpO+O+LHKU8032PVh/ymooIz0jWUoBBDhKx xXTA== X-Gm-Message-State: AOJu0YwGp/kqzGVSjPelaKw0LP+sxu0hPEHaLS59UFu6wLs0zh08Gyh7 ajXX6S9c7XDYqyThmPFAwu7w/IFgSO8bdTOLungVPkOBEk8MRbqkY+kgyfiyEZAv6UUl3KIQ+Q8 POqgmjDp9boy41XFi8+3MdYbvsy61lw4fVbhUxssHHjKiAJ/07ZhoZq8u7gW8K/fohEVf0uk9BI 9PlV4kVxQl7+NK7MDlyFgxuWKb9/TWu4Yf0FTzkcoIcO8= X-Received: by 2002:a05:651c:781:b0:2d2:869a:55af with SMTP id g1-20020a05651c078100b002d2869a55afmr1534157lje.17.1714143731317; Fri, 26 Apr 2024 08:02:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHB1wJKMhQao8I2CHVEVlkJKepB01Nqtv8XS7of8F5wC5AJlKRaMvBVrkzUogwIJCebA1IoUQ== X-Received: by 2002:a05:651c:781:b0:2d2:869a:55af with SMTP id g1-20020a05651c078100b002d2869a55afmr1534121lje.17.1714143730428; Fri, 26 Apr 2024 08:02:10 -0700 (PDT) Received: from localhost (185.223.159.143.dyn.plus.net. [143.159.223.185]) by smtp.gmail.com with ESMTPSA id c7-20020a05600c0a4700b0041b434e5869sm6150930wmq.43.2024.04.26.08.02.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 08:02:08 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess , felix.willgerodt@intel.com, John Baldwin Subject: [PATCHv5 04/11] gdb/x86: move have_ptrace_getfpxregs global into gdb/nat directory Date: Fri, 26 Apr 2024 16:01:48 +0100 Message-Id: <507f550b0c19075e7a7f90f1df82d3b9c211199c.1714143669.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_INVALID, DKIM_SIGNED, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org 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 diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 23894ea4a4d..353e45b3cec 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -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 \ diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c index 7278dd91ff0..32d9d998beb 100644 --- a/gdb/i386-linux-nat.c +++ b/gdb/i386-linux-nat.c @@ -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. */ diff --git a/gdb/i386-linux-nat.h b/gdb/i386-linux-nat.h deleted file mode 100644 index c3d32aff1be..00000000000 --- a/gdb/i386-linux-nat.h +++ /dev/null @@ -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 . */ - -#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 diff --git a/gdb/nat/x86-linux.c b/gdb/nat/x86-linux.c index ad3ed3c2289..35a3e960946 100644 --- a/gdb/nat/x86-linux.c +++ b/gdb/nat/x86-linux.c @@ -22,6 +22,15 @@ #include "nat/gdb_ptrace.h" #include +/* 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 diff --git a/gdb/nat/x86-linux.h b/gdb/nat/x86-linux.h index 15153ea277e..061b3c2e394 100644 --- a/gdb/nat/x86-linux.h +++ b/gdb/nat/x86-linux.h @@ -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. */ diff --git a/gdb/x86-linux-nat.c b/gdb/x86-linux-nat.c index f91db492d05..12965c7a21b 100644 --- a/gdb/x86-linux-nat.c +++ b/gdb/x86-linux-nat.c @@ -26,9 +26,6 @@ #include #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__ diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc index 2603fb2ac5d..8199b0ccc09 100644 --- a/gdbserver/linux-x86-low.cc +++ b/gdbserver/linux-x86-low.cc @@ -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 * -- 2.25.4