From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2610:1c1:1:606c::19:2]) by sourceware.org (Postfix) with ESMTPS id 137593858C50 for ; Wed, 8 May 2024 22:52:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 137593858C50 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=FreeBSD.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 137593858C50 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2610:1c1:1:606c::19:2 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1715208751; cv=pass; b=PqlX87VU5aUvm58S3hhIsWNm66XWAtHzkkWnV2zLITU3zRULeD811x3jfwDdsySfwxeHIQ2f/A9SVukwFeBEf05FYZWkKfnVm1+cfybSOdMAamBQu76kZ9j09pjvIGaBdWJQxeGzDoHEevL2LJtP4Z2QPaq/96PM7R2GIB9S7zI= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1715208751; c=relaxed/simple; bh=JUM+4yY0lZDhvy3hf88AajYhguvYeNp77MacKOGo/CM=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=Ft6i7joCa/9W094kEsM6Vnu9IcRYoWUlxzeL4TTy5CemO73dcxTyRPoa4LaxHoM1pYa/sy6Ok6LyMF5Sdc4DsWnwhQR9pXr5b6UA4LfaFWm+lExG39qfnMCWBJGRINy89VoUGR6jVyheCRNPcGXocH6EMKnU+oUYNBX7QirMOCg= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "mx1.freebsd.org", Issuer "R3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id 4VZVlZ0z7sz43VW; Wed, 8 May 2024 22:52:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VZVlZ04XNz4bql; Wed, 8 May 2024 22:52:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715208746; 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=YjYOMAOZq7TqY2AmJPSgfvDBsQkEgyfe4PoEckkCi+I=; b=RhWx+Wodhhmro9T5z7nXdHIjYeJ3kclG0RPNintN9OgZzUI2b2VRbI6b/qpeQBMiAhkeWg 7ZEp+6PcdGDPO14FBfAUxh1Eako9zyJ/1fhysv2T5g2yy6JEA8hZR9hsF2OH/072mqjSzt HajBxYt1IlBwhMlrBuSGRjrT9rj6FWegWDu64HcX1qlEeMlxJKCpAp9L3lMzi2s3xpSakY Rh66WxzHSfXvAe5BiAe8FH5jvWP3WEJ1gRc1BheTmYL8hm2LCkJJ4QWFCBi5/t8/O0ZEtW 0X9KN542dm7xpp6saTBLspvJXhjkfepEmneKkPJMB5YgBqRCaF7M+G6cdQVaqw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715208746; a=rsa-sha256; cv=none; b=bo1p7gQgKJwdu7QQH9EZYt49ioDrTJEMPpPWd/Dpy8BM1SJuMCcg9FwPaVlSSwCvHqpXjK cMgXOZep98EcF4/cmLjZfabZ84Skf9S/lqPP32cKqgTPQ1bhNzbWI9yREp87ftZMB3/keU iM35KIcn+lGwiAyZjwcrkIpbEa2W16+1iySAJuI5bKLAUTfdqspVGC2FoCkP9rnWLvZvQi JBIuDZfxnSmslAJOGslaMPdyoi3t85QBqA9Vo9HPl5ryqDxXo6bcHgLbXGrWa5IyzM+4wI bTklQJBtycmmrkFJLi2dkih+zSjSfIrkdK7n31URwA5WsUF/0KOzBTUxS6mBDw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715208746; 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=YjYOMAOZq7TqY2AmJPSgfvDBsQkEgyfe4PoEckkCi+I=; b=pD0iYpChmIxZnjvdZYSHDWWIbIdEp4YpQXYn6e5h0RCc88TwIcXXouPgY5OUSO4KU6M3gA kcbvcSeLv8kge4QiQuSdiVDAZTLnbe5UkqV9maXoQT7XVpNawgropuknGSBbGoqoxnzy0c vplzHftoz/D8ID0acqdqEEpugHrWQ2jguPtkwas3C3SgtBfbrJlNJaYsV6cQSqrVbkWURr 3uaW8FR/Es6UY0dJyCUYtqc5cGpAyutSKRjTtLVM7vAZQgUGh4tfKK5bLuF4oYF+e+pjMb 9fXg5nQfqRCkadwfPTKSuwMfLrtPKKShFf9cslhlmqBlXTzDgsWfJwz91Adv4g== Received: from [IPV6:2601:644:937f:4c50:495d:378a:79e0:455] (unknown [IPv6:2601:644:937f:4c50:495d:378a:79e0:455]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4VZVlY4MNLz1QcB; Wed, 8 May 2024 22:52:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <84302904-5294-4009-b6e8-f74fb107f92e@FreeBSD.org> Date: Wed, 8 May 2024 15:52:23 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCHv6 3/9] gdb/x86: move have_ptrace_getfpxregs global into gdb/nat directory Content-Language: en-US To: Andrew Burgess , gdb-patches@sourceware.org Cc: felix.willgerodt@intel.com References: <9efce46803ede508ac0fd0cf3f9d1497117e3aae.1715185683.git.aburgess@redhat.com> From: John Baldwin In-Reply-To: <9efce46803ede508ac0fd0cf3f9d1497117e3aae.1715185683.git.aburgess@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,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 List-Id: On 5/8/24 9:46 AM, Andrew Burgess wrote: > 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. > > While moving this variable I have converted it to a tribool, as that > was what it really was, if even used the same numbering as the tribool > enum (-1, 0, 1). Where have_ptrace_getfpxregs was used I have updated > in the obvious way. > > However, while making this change I noticed what I think is a bug in > x86_linux_nat_target::read_description and x86_linux_read_description, > both of these functions can be called multiple times, but in both > cases we only end up calling i386_linux_read_description the first > time through in the event that PTRACE_GETFPXREGS is not supported. > This is because initially have_ptrace_getfpxregs will be > TRIBOOL_UNKNOWN, but after the ptrace call fails we set > have_ptrace_getfpxregs to TRIBOOL_FALSE. The next time we attempt to > read the target description we'll skip the ptrace call, and so skip > the call to i386_linux_read_description. > > I've not tried to address this preexisting bug in this commit, this is > purely a refactor, there should be no user visible changes after this > commit. In later commits I'll merge the gdbserver and GDB code > together into the nat/ directory, and after that I'll try to address > this bug. > > Reviewed-By: Felix Willgerodt > --- > gdb/Makefile.in | 1 - > gdb/i386-linux-nat.c | 26 +++++--------------------- > gdb/i386-linux-nat.h | 26 -------------------------- > gdb/nat/x86-linux.c | 9 +++++++++ > gdb/nat/x86-linux.h | 14 ++++++++++++++ > gdb/x86-linux-nat.c | 7 ++----- > gdbserver/linux-x86-low.cc | 17 +++-------------- > 7 files changed, 33 insertions(+), 67 deletions(-) > delete mode 100644 gdb/i386-linux-nat.h > > diff --git a/gdb/nat/x86-linux.c b/gdb/nat/x86-linux.c > index 7a21c8f2c26..f394dc5d5e1 100644 > --- a/gdb/nat/x86-linux.c > +++ b/gdb/nat/x86-linux.c > @@ -20,6 +20,15 @@ > #include "x86-linux.h" > #include "x86-linux-dregs.h" > > +/* See nat/x86-linux.h. */ > +tribool have_ptrace_getfpxregs = > +#ifdef HAVE_PTRACE_GETFPXREGS > + TRIBOOL_UNKNOWN > +#else > + TRIBOOL_FALSE > +#endif > +; > + Should this be under #ifdef __i386__ or the like? My understanding is that this request isn't supported for Linux x86-64, just for i386? -- John Baldwin