Message ID | cover.1711211528.git.aburgess@redhat.com |
---|---|
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8849C3858412 for <patchwork@sourceware.org>; Sat, 23 Mar 2024 16:36:05 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 046D93858D33 for <gdb-patches@sourceware.org>; Sat, 23 Mar 2024 16:35:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 046D93858D33 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 046D93858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711211737; cv=none; b=QWzYDZPX9PR4Eyg4phih4QXMbRexMU6rs1JGVZRnSyq784iOHK1pJbWGxCFwhluJu81EZxF0vI35+SrGow7Yvd9fDjiLPInQgaUIQ2wpv1ErK2qF1b7OA7ug3TIAf5XN/9HbYlL3RtIhI3CSC9nUI8xp4W4t3q67efv+I3xLB7o= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711211737; c=relaxed/simple; bh=ewl8oG+4I5Ksyqh9Jq1NiXJyKri9VaZLSk7So1BzFww=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=PtxzDdP53HskAsR+m9P2N8PIAz3iwTedksy+XeVOxCrt2WNtP7JenlVuwv7BqnauZP1Wzer12NvVlSjK3cniAz5D0BqG+wAEcYvpt+eEfRJVS6s3aIIISnA/Yqd4pkKq1tlUGbAM60qTK8zaa3zhtvXkVUSCZ5NlXFgoKAz06UE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711211734; 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=gHKG/VxkvP9727MZjn2CDofNlrzwZniO90357aLdD0g=; b=UJBz7gPLh4vxf/88OZpgnGN2gOTolBBSwcGCfqWapcNbcSWbhwO/Y73XoeT20zaLxx1njF SQxDRcg5bH3wTHog02WyZXek3ZF+6FuzY3zKfZYT7KqocdMXuH/LvRN/xg9PYekVitqb9L DowiYy2zllDPJNT6+crPr5LLAbmQdmY= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-111-1inYPMADNoOzE9ypmNtw7w-1; Sat, 23 Mar 2024 12:35:33 -0400 X-MC-Unique: 1inYPMADNoOzE9ypmNtw7w-1 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-a4747f29e19so8101766b.1 for <gdb-patches@sourceware.org>; Sat, 23 Mar 2024 09:35:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711211731; x=1711816531; 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=gHKG/VxkvP9727MZjn2CDofNlrzwZniO90357aLdD0g=; b=DzEel3laWzdpKXTLRGZ3DGU1oRV7XDtMPGzak/L7hzGWaoFYnHf4yXh00Xf2lpDIWV RL6umfDuvXiG7fWSerqxpDO8GmbWMAnUIDbbOoqtec/m+tvGx+3hhRnjlUWcnc+SX8um iFf/zR65WXgMr0Dr7pBnIFryU2z0OtJa62OMUu6xPyuyO69/Updq37fhNbYuApianXW+ dx2Kip8wefSEQdFBoVg1LaLY6BZWT9fh+mrbjGoxTdwsW7Mn0LNYaxBtDr4X0VN+Tyky 97DHXrt+kIa6ZV7hDUa2I+h+mlmFVJ+uagEvXUqQu+yK1cNXEcVffNWUvJRiPLpZaGIw HuzQ== X-Gm-Message-State: AOJu0YzOiYZ0ZpkzN2JxzyuBxl9/FQ+lxVJeiBEKVRqKoTu8F8NGX9K8 sIt5Q1r0Nze61VwBNW2dp7zrzh9MzlARZOFDHKTZmPkql4S9P/VHlKRi2M0eNL52t9+o95uxgo7 xONwdhAkOeqx4V5T/tSmZOMjVzz+HIBYwkqibMZC8MH8YOpRQBXLkPuRUVmLa7DOIqBfmtz9k7c VKKLa4N9lF8RBcKAePj9CEvs1rKZH3z5GJIPM9GzKcAkc= X-Received: by 2002:a17:907:970e:b0:a47:4ba1:5955 with SMTP id jg14-20020a170907970e00b00a474ba15955mr569121ejc.20.1711211730964; Sat, 23 Mar 2024 09:35:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEgIG+jnf300vqyoCcIXLmYVDkX4/EuNy2Q+2jKN0HBZNoZw4c0mIsmeHs4fx43EAoUL2V9sQ== X-Received: by 2002:a17:907:970e:b0:a47:4ba1:5955 with SMTP id jg14-20020a170907970e00b00a474ba15955mr569107ejc.20.1711211730490; Sat, 23 Mar 2024 09:35:30 -0700 (PDT) Received: from localhost (185.223.159.143.dyn.plus.net. [143.159.223.185]) by smtp.gmail.com with ESMTPSA id i15-20020a170906090f00b00a46d9966ff8sm1076645ejd.147.2024.03.23.09.35.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Mar 2024 09:35:30 -0700 (PDT) From: Andrew Burgess <aburgess@redhat.com> To: gdb-patches@sourceware.org Cc: Andrew Burgess <aburgess@redhat.com>, hjl.tools@gmail.com Subject: [PATCHv3 0/8] x86/Linux Target Description Changes Date: Sat, 23 Mar 2024 16:35:18 +0000 Message-Id: <cover.1711211528.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <cover.1709657954.git.aburgess@redhat.com> References: <cover.1709657954.git.aburgess@redhat.com> 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=-6.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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 <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org |
Series |
x86/Linux Target Description Changes
|
|
Message
Andrew Burgess
March 23, 2024, 4:35 p.m. UTC
In v3: - Rebased. Nasty merge conflict with 4bb20a6244b7091 which I think I've resolved, but am unable to test. Reposting so the author of that other commit can validate. - Initial testing looks good. Full tests are still running. In v2: - Rebase to current upstream/master, no merge conflicts, - Retested. --- Andrew Burgess (8): gdbserver: convert have_ptrace_getregset to a tribool gdb/x86: move reading of cs and ds state into gdb/nat directory gdbserver/x86: move no-xml code earlier in x86_linux_read_description gdb/gdbserver: share I386_LINUX_XSAVE_XCR0_OFFSET definition gdb/gdbserver: share some code relating to target description creation gdb/arch: assert that X86_XSTATE_MPX is not set for x32 gdbserver: update target description creation for x86/linux gdb/gdbserver: share x86/linux tdesc caching gdb/Makefile.in | 1 + gdb/amd64-linux-tdep.c | 33 +-- gdb/amd64-linux-tdep.h | 6 - gdb/arch/amd64.c | 8 +- gdb/configure.nat | 4 +- gdb/i386-linux-tdep.c | 32 +-- gdb/i386-linux-tdep.h | 23 -- gdb/nat/x86-linux-tdesc.c | 411 +++++++++++++++++++++++++++++++++++ gdb/nat/x86-linux-tdesc.h | 115 ++++++++++ gdb/nat/x86-linux.c | 47 ++++ gdb/nat/x86-linux.h | 48 ++++ gdb/x86-linux-nat.c | 123 ++--------- gdbserver/Makefile.in | 4 + gdbserver/configure.srv | 4 + gdbserver/linux-amd64-ipa.cc | 45 +--- gdbserver/linux-arm-low.cc | 6 +- gdbserver/linux-i386-ipa.cc | 25 +-- gdbserver/linux-low.cc | 2 +- gdbserver/linux-low.h | 2 +- gdbserver/linux-x86-low.cc | 189 +++++----------- gdbserver/linux-x86-tdesc.cc | 141 +----------- gdbserver/linux-x86-tdesc.h | 56 ----- 22 files changed, 749 insertions(+), 576 deletions(-) create mode 100644 gdb/nat/x86-linux-tdesc.c create mode 100644 gdb/nat/x86-linux-tdesc.h delete mode 100644 gdbserver/linux-x86-tdesc.h base-commit: e9315f148d56b3f4c7cfeef469633e85933d412c
Comments
Andrew Burgess <aburgess@redhat.com> writes: > In v3: > > - Rebased. Nasty merge conflict with 4bb20a6244b7091 which I think > I've resolved, but am unable to test. Reposting so the author of > that other commit can validate. > > - Initial testing looks good. Full tests are still running. Testing completed with no issues. H.J. Lu confirmed that this versions didn't break the x32 behaviour. I've gone ahead and pushed these patches. If anything crops up then do let me know. Thanks, Andrew
On 3/25/24 13:20, Andrew Burgess wrote: > Andrew Burgess <aburgess@redhat.com> writes: > >> In v3: >> >> - Rebased. Nasty merge conflict with 4bb20a6244b7091 which I think >> I've resolved, but am unable to test. Reposting so the author of >> that other commit can validate. >> >> - Initial testing looks good. Full tests are still running. > > Testing completed with no issues. H.J. Lu confirmed that this versions > didn't break the x32 behaviour. I've gone ahead and pushed these > patches. > > If anything crops up then do let me know. > > Thanks, > Andrew > Hi Andrew, I think your series introduces some build failures with Clang. One is easy, it's a missing `-x c++` in gdbserver/Makefile.in. The other is: CXX nat/x86-linux-tdesc-ipa.o /home/smarchi/src/binutils-gdb/gdbserver/../gdb/nat/x86-linux-tdesc.c:167:1: error: unused function 'x86_linux_i386_tdesc_feature_mask' [-Werror,-Wunused-function] 167 | x86_linux_i386_tdesc_feature_mask () | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ It's possible that this function just needs to be moved in the same "#ifdef" as where it's used, but since I didn't follow your work closely, I prefer to let you fix it, in case I'm missing something. Thanks, Simon
Simon Marchi <simark@simark.ca> writes: > On 3/25/24 13:20, Andrew Burgess wrote: >> Andrew Burgess <aburgess@redhat.com> writes: >> >>> In v3: >>> >>> - Rebased. Nasty merge conflict with 4bb20a6244b7091 which I think >>> I've resolved, but am unable to test. Reposting so the author of >>> that other commit can validate. >>> >>> - Initial testing looks good. Full tests are still running. >> >> Testing completed with no issues. H.J. Lu confirmed that this versions >> didn't break the x32 behaviour. I've gone ahead and pushed these >> patches. >> >> If anything crops up then do let me know. >> >> Thanks, >> Andrew >> > > Hi Andrew, > > I think your series introduces some build failures with Clang. One is > easy, it's a missing `-x c++` in gdbserver/Makefile.in. Thanks for fixing this one. > > The other is: > > CXX nat/x86-linux-tdesc-ipa.o > /home/smarchi/src/binutils-gdb/gdbserver/../gdb/nat/x86-linux-tdesc.c:167:1: error: unused function 'x86_linux_i386_tdesc_feature_mask' [-Werror,-Wunused-function] > 167 | x86_linux_i386_tdesc_feature_mask () > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > It's possible that this function just needs to be moved in the same > "#ifdef" as where it's used, but since I didn't follow your work > closely, I prefer to let you fix it, in case I'm missing something. Sorry for the breakage. I pushed the patch below to resolve this issue. Thanks, Andrew -- commit f4c19f89ef43dbce8065532c808e1aeb05d08994 Author: Andrew Burgess <aburgess@redhat.com> Date: Tue Mar 26 12:09:27 2024 +0000 gdb/gdbserver: fix some defined but unused function warnings This commit: commit 198ff6ff819c240545f9fc68b39636fd376d4ba9 Date: Tue Jan 30 15:37:23 2024 +0000 gdb/gdbserver: share x86/linux tdesc caching added some functions which are always defined, but their use is guarded within various #ifdef blocks. As a result we were seeing errors about defined, but unused, functions. I've fixed this problem in this commit by wrapping the function definitions within #ifdef blocks. I'm a little worried that there might be too many #ifdef blocks within this file, however, I'm going to commit this fix for now as this will fix the build, then I'll think about if there's a better way to split this file so we might avoid some of these #ifdef blocks. diff --git a/gdb/nat/x86-linux-tdesc.c b/gdb/nat/x86-linux-tdesc.c index c438dfae84f..8a02f77fa6a 100644 --- a/gdb/nat/x86-linux-tdesc.c +++ b/gdb/nat/x86-linux-tdesc.c @@ -160,6 +160,8 @@ static constexpr x86_tdesc_feature x86_linux_all_tdesc_features[] = { { X86_XSTATE_X87, true, false, false } }; +#if defined __i386__ || !defined IN_PROCESS_AGENT + /* Return a compile time constant which is a mask of all the cpu features that are checked for when building an i386 target description. */ @@ -175,6 +177,10 @@ x86_linux_i386_tdesc_feature_mask () return mask; } +#endif /* __i386__ || !IN_PROCESS_AGENT */ + +#ifdef __x86_64__ + /* Return a compile time constant which is a mask of all the cpu features that are checked for when building an amd64 target description. */ @@ -205,6 +211,8 @@ x86_linux_x32_tdesc_feature_mask () return mask; } +#endif /* __x86_64__ */ + /* Return a compile time constant which is a count of the number of cpu features that are checked for when building an i386 target description. */ @@ -222,6 +230,8 @@ x86_linux_i386_tdesc_count () return (1 << count); } +#if defined __x86_64__ || defined IN_PROCESS_AGENT + /* Return a compile time constant which is a count of the number of cpu features that are checked for when building an amd64 target description. */ @@ -256,6 +266,8 @@ x86_linux_x32_tdesc_count () return (1 << count); } +#endif /* __x86_64__ || IN_PROCESS_AGENT */ + #ifdef IN_PROCESS_AGENT /* See linux-x86-tdesc.h. */
On Tue, Mar 26, 2024 at 5:16 AM Andrew Burgess <aburgess@redhat.com> wrote: > > Simon Marchi <simark@simark.ca> writes: > > > On 3/25/24 13:20, Andrew Burgess wrote: > >> Andrew Burgess <aburgess@redhat.com> writes: > >> > >>> In v3: > >>> > >>> - Rebased. Nasty merge conflict with 4bb20a6244b7091 which I think > >>> I've resolved, but am unable to test. Reposting so the author of > >>> that other commit can validate. > >>> > >>> - Initial testing looks good. Full tests are still running. > >> > >> Testing completed with no issues. H.J. Lu confirmed that this versions > >> didn't break the x32 behaviour. I've gone ahead and pushed these > >> patches. > >> > >> If anything crops up then do let me know. > >> > >> Thanks, > >> Andrew > >> > > > > Hi Andrew, > > > > I think your series introduces some build failures with Clang. One is > > easy, it's a missing `-x c++` in gdbserver/Makefile.in. > > Thanks for fixing this one. > > > > > The other is: > > > > CXX nat/x86-linux-tdesc-ipa.o > > /home/smarchi/src/binutils-gdb/gdbserver/../gdb/nat/x86-linux-tdesc.c:167:1: error: unused function 'x86_linux_i386_tdesc_feature_mask' [-Werror,-Wunused-function] > > 167 | x86_linux_i386_tdesc_feature_mask () > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > It's possible that this function just needs to be moved in the same > > "#ifdef" as where it's used, but since I didn't follow your work > > closely, I prefer to let you fix it, in case I'm missing something. > > Sorry for the breakage. > > I pushed the patch below to resolve this issue. > gdbserver from your old patch: https://patchwork.sourceware.org/project/gdb/list/?series=32189 works on x32. But the current master gives me: /export/gnu/import/git/sources/gdb/gdbserver/regcache.cc:273: A problem internal to GDBserver has been detected. Unknown register bnd0raw requested again.
On Tue, Mar 26, 2024 at 6:51 AM H.J. Lu <hjl.tools@gmail.com> wrote: > > On Tue, Mar 26, 2024 at 5:16 AM Andrew Burgess <aburgess@redhat.com> wrote: > > > > Simon Marchi <simark@simark.ca> writes: > > > > > On 3/25/24 13:20, Andrew Burgess wrote: > > >> Andrew Burgess <aburgess@redhat.com> writes: > > >> > > >>> In v3: > > >>> > > >>> - Rebased. Nasty merge conflict with 4bb20a6244b7091 which I think > > >>> I've resolved, but am unable to test. Reposting so the author of > > >>> that other commit can validate. > > >>> > > >>> - Initial testing looks good. Full tests are still running. > > >> > > >> Testing completed with no issues. H.J. Lu confirmed that this versions > > >> didn't break the x32 behaviour. I've gone ahead and pushed these > > >> patches. > > >> > > >> If anything crops up then do let me know. > > >> > > >> Thanks, > > >> Andrew > > >> > > > > > > Hi Andrew, > > > > > > I think your series introduces some build failures with Clang. One is > > > easy, it's a missing `-x c++` in gdbserver/Makefile.in. > > > > Thanks for fixing this one. > > > > > > > > The other is: > > > > > > CXX nat/x86-linux-tdesc-ipa.o > > > /home/smarchi/src/binutils-gdb/gdbserver/../gdb/nat/x86-linux-tdesc.c:167:1: error: unused function 'x86_linux_i386_tdesc_feature_mask' [-Werror,-Wunused-function] > > > 167 | x86_linux_i386_tdesc_feature_mask () > > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > > > It's possible that this function just needs to be moved in the same > > > "#ifdef" as where it's used, but since I didn't follow your work > > > closely, I prefer to let you fix it, in case I'm missing something. > > > > Sorry for the breakage. > > > > I pushed the patch below to resolve this issue. > > > > gdbserver from your old patch: > > https://patchwork.sourceware.org/project/gdb/list/?series=32189 > > works on x32. But the current master gives me: > > /export/gnu/import/git/sources/gdb/gdbserver/regcache.cc:273: A > problem internal to GDBserver has been detected. > Unknown register bnd0raw requested > > again. Never mind. I was using the wrong source. x32 works.
Andrew Burgess <aburgess@redhat.com> writes: > Andrew Burgess <aburgess@redhat.com> writes: > >> In v3: >> >> - Rebased. Nasty merge conflict with 4bb20a6244b7091 which I think >> I've resolved, but am unable to test. Reposting so the author of >> that other commit can validate. >> >> - Initial testing looks good. Full tests are still running. > > Testing completed with no issues. H.J. Lu confirmed that this versions > didn't break the x32 behaviour. I've gone ahead and pushed these > patches. > > If anything crops up then do let me know. I'm aware that this series broke pretty much anything that was not x86 based when configured with --enable-targets=all. The problem is that, as part of this commit, I moved generic tdep (arch specific) code into the nat/ directory as part of an effort to share the code between GDB and gdbserver. This was incorrect. I'm open to reverting this series, however, I'm currently working on a fix, splitting the nat/ code between nat/ and arch/. I'm hoping to have a fix today. If that doesn't look possible then I'll likely revert this series before the end of my day. Apologies for the (serious) breakage. Thanks, Andrew
Andrew Burgess <aburgess@redhat.com> writes: > Andrew Burgess <aburgess@redhat.com> writes: > >> Andrew Burgess <aburgess@redhat.com> writes: >> >>> In v3: >>> >>> - Rebased. Nasty merge conflict with 4bb20a6244b7091 which I think >>> I've resolved, but am unable to test. Reposting so the author of >>> that other commit can validate. >>> >>> - Initial testing looks good. Full tests are still running. >> >> Testing completed with no issues. H.J. Lu confirmed that this versions >> didn't break the x32 behaviour. I've gone ahead and pushed these >> patches. >> >> If anything crops up then do let me know. > > I'm aware that this series broke pretty much anything that was not x86 > based when configured with --enable-targets=all. > > The problem is that, as part of this commit, I moved generic tdep (arch > specific) code into the nat/ directory as part of an effort to share the > code between GDB and gdbserver. This was incorrect. > > I'm open to reverting this series, however, I'm currently working on a > fix, splitting the nat/ code between nat/ and arch/. I'm hoping to have > a fix today. If that doesn't look possible then I'll likely revert this > series before the end of my day. > > Apologies for the (serious) breakage. I have now reverted all of the commits from this series, as well as the small fixes which I pushed earlier today. I've also reverts the fix which Simon pushed that was for code from this series. Splitting the code between nat/ and arch/ mostly worked, but I was still running into some edge cases which I couldn't get working, so I could either: + push a partial fix, which still left some things broken, or + revert everything, take a step back and re-work the series. I think reverting and coming at this fresh tomorrow is the better choice. I apologise for all the churn. The post-revert branch seemed to build fine, so hopefully I've not left anything in a broken state. Let me know if I've left anything broken, I'll check back in a couple of hours to see if there is more fixing needed. Thanks, Andrew