From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id QGvVC0nCK2Zj5TwAWB0awg (envelope-from ) for ; Fri, 26 Apr 2024 11:03:37 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Ubwhwdww; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 2AB971E0CE; Fri, 26 Apr 2024 11:03:37 -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 06B531E0C0 for ; Fri, 26 Apr 2024 11:03:35 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 736473849AC6 for ; Fri, 26 Apr 2024 15:03:34 +0000 (GMT) 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 AA0323858C42 for ; Fri, 26 Apr 2024 15:02:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AA0323858C42 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 AA0323858C42 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=1714143733; cv=none; b=pbBmaA/0IjRh+oOyMgRo5Av8DofJwTGoMwW9zIyX/kGe7gW+O4z8xddBPmsYhQXg+MYOYzU6eO4w4RtvQjWknuGOe34ppTi6I5j7oJa1uUQcjhJHA9bgTXlNXfsafOIb/s0JMu4mr25svs0wLOax/L+kDrN3uIwCoycW7kGw/5o= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714143733; c=relaxed/simple; bh=2BteOoOPw78JwySm8Kp8LwmjFRSoSOaZRidlFXMCyAo=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=saPE7tQwvrSPEk+wSKaAdCuAmoX42CPCP31a62/yUoGA0nZSPXZpAOefjrzhiYPm9Y9N9KTBnZ7UuPJ0NVZJEO03TyHgL+nM+DV34kZeDjsEh8CaqyWsak9hO4nubAxdtA+mYJtsgzxHIdT4oW0BOyzTHHpHiPnGyB5A7JM24yE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714143722; 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=+XSxKu3tDk8f9Hhkvs88AQZgPucLujVNb+3CfpCPZpM=; b=Ubwhwdww26AGo30cAleGNpVCVOEJREWFsEmp3JNNGUgZlP2b0anda1aZ9fx3/OtuJEXge/ cbhiWvyX840gZtE0MIHoiFAVieVyjoMN93AYCdfAyiwcHb1Wvv80hJIFNvlOakk444XRyF kKP/jtggLOQnfx77YrC9c+HIpq9tXvE= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-315-qouNxo4xPey46zK530tHww-1; Fri, 26 Apr 2024 11:02:00 -0400 X-MC-Unique: qouNxo4xPey46zK530tHww-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-417bf71efb4so12102265e9.0 for ; Fri, 26 Apr 2024 08:01:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714143718; x=1714748518; 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=+XSxKu3tDk8f9Hhkvs88AQZgPucLujVNb+3CfpCPZpM=; b=oIxLxFzqdjUlporqZLcCZDuDEDRBqc6BcTNxkmznsdlv8MV3eJc5yHujdKMAp3Clcj Kxp/W+igUqArCwbFH65HDK+w1kUFEQDByo8y71fCyNQ3S4ilFnc+acofRYaypW1bkbjY oyhdDJ66nKFqrDflVh2lVkkkPlzOoqTGxeT1PsnN2XvUofur5KmtrdwpCWmLvbYy4CrA xPTWTYEkbsrOalIjJqkjXR1R9NLi4NeQYeQHaQ2/h5mxk8RK5R4DLENMSQuvEPVe/aLD vrVCdMDx+ndUImHZ3zlfSrR100+A1vuuG3aCxNNrAI8qPJpIn1bGSbeHYVPzTZ2U5PPR MzGg== X-Gm-Message-State: AOJu0YzKjpw1MlRxq15c3G0DulQMM1/qMvdTPB2vnoNvJpw/wQi5F6wh ApiZmX++zlbaB1q93DQzRV995p3He5IXF/L18GQLVK623iAdBjIpDRQDvK0GhnX7wQb6L/0uxTK y7R14snNRF/N80kizdg+u1XzxqnU9b37qB/t+jQQJSdU90QgPbYwGzhyEN60eJTayXPA4mj4+sv InJSEbJPMDzK4seIxRthlvF4MimdMl2aUpp0Hkgk1pP24= X-Received: by 2002:a05:600c:3151:b0:41b:4caa:554c with SMTP id h17-20020a05600c315100b0041b4caa554cmr3098212wmo.2.1714143718351; Fri, 26 Apr 2024 08:01:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEvFqBFvvlE3XTYhfWsIEOSnE0R2/bfBJqFrXKwDDskRp1cdeuDLF35pFfgu7YkoApysRFyaw== X-Received: by 2002:a05:600c:3151:b0:41b:4caa:554c with SMTP id h17-20020a05600c315100b0041b4caa554cmr3098145wmo.2.1714143717581; Fri, 26 Apr 2024 08:01:57 -0700 (PDT) Received: from localhost (185.223.159.143.dyn.plus.net. [143.159.223.185]) by smtp.gmail.com with ESMTPSA id fm18-20020a05600c0c1200b0041b5500e438sm5520668wmb.23.2024.04.26.08.01.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 08:01:56 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess , felix.willgerodt@intel.com, John Baldwin Subject: [PATCHv5 00/11] x86/Linux Target Description Changes Date: Fri, 26 Apr 2024 16:01:44 +0100 Message-Id: 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=-6.2 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org In v5: - Felix pointed out that building gdbserver with the '-m32' flag on an x86-64 host would fail. This is fixed in V5 with the addition of patch #4. This patch moves the have_ptrace_getfpxregs global into the gdb/nat/ directory and fixes the includes so that the the declaration is seen where needed, - I've rebased onto a slightly later commit. In v4: - I tried merging V3, but it turned out I broke pretty much everything that wasn't x86 based when configured with --enable-targets=all, - The problem was a failure to correctly split the shared code between the gdb/arch/ and gdb/nat/ directories, as a consequence, code which is needed on a non x86 based host to support x86 based targets wasn't available to the compilation, and the build failed, - In V4 I've gone through every patch and resplit the code in a way which I now believe is correct, I've done the following tests: + On a non x86 host I've built GDB to support only the current host as a target, to support all targets, and to support x86-64 and i386 linux targets, + On an i386 virtual machine I built GDB only for the host as a target, and for all targets. I regression tested the all targets build for unix, native-gdbserver, and native-extended-gdbserver, + On an x86-64 machine I've built GDB for only the current host as a target, and for all targets. I regression tested the all targets build for unix, native-gdbserver, and native-extended-gdbserver. - Only patches 6, 8, and 10 require significant review. All of the other patches are pretty trivial (though reviews always welcome). - I think there's more improvements that can be made to the x86 target description creation/lookup/caching. This series only changes the Linux lookup, and we still cache i386/amd64/x32 separately. In the future I think we can merge all x86 target description caching into a single data structure, this would be for all OS variants and all ABI variants. Though making that "grand unification" will certainly require some of the code in this series to change, I think the bulk of it will remain, and trying to do everything in one series is just going to result in an even larger series. I'd prefer to get these first patches merged, then come back to build on this work once this is merged and we know there's no problems with it. 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 (11): gdbserver/ipa/x86: remove unneeded declarations gdbserver: convert have_ptrace_getregset to a tribool gdb/x86: move reading of cs and ds state into gdb/nat directory gdb/x86: move have_ptrace_getfpxregs global 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: move xcr0 == 0 check into i386_linux_core_read_description gdb/gdbserver: share x86/linux tdesc caching gdb/Makefile.in | 9 +- gdb/amd64-linux-tdep.c | 32 +-- gdb/amd64-linux-tdep.h | 6 - gdb/arch/amd64-linux-tdesc.c | 61 +++++ gdb/arch/amd64-linux-tdesc.h | 30 +++ gdb/arch/amd64.c | 8 +- gdb/arch/i386-linux-tdesc.c | 51 ++++ .../i386-linux-tdesc.h} | 17 +- gdb/arch/x86-linux-tdesc-features.c | 247 ++++++++++++++++++ gdb/arch/x86-linux-tdesc-features.h | 62 +++++ gdb/arch/x86-linux-tdesc.h | 37 +++ gdb/configure.nat | 8 +- gdb/configure.tgt | 11 +- gdb/i386-linux-nat.c | 18 +- gdb/i386-linux-tdep.c | 42 +-- gdb/i386-linux-tdep.h | 23 -- gdb/nat/x86-linux-tdesc.c | 124 +++++++++ gdb/nat/x86-linux-tdesc.h | 60 +++++ gdb/nat/x86-linux.c | 56 ++++ gdb/nat/x86-linux.h | 44 ++++ gdb/x86-linux-nat.c | 126 +-------- gdbserver/configure.srv | 11 + gdbserver/linux-amd64-ipa.cc | 50 +--- gdbserver/linux-arm-low.cc | 6 +- gdbserver/linux-i386-ipa.cc | 26 +- gdbserver/linux-low.cc | 2 +- gdbserver/linux-low.h | 2 +- gdbserver/linux-x86-low.cc | 201 +++++--------- gdbserver/linux-x86-tdesc.cc | 142 +--------- gdbserver/linux-x86-tdesc.h | 56 ---- gdbsupport/x86-xstate.h | 20 ++ 31 files changed, 959 insertions(+), 629 deletions(-) create mode 100644 gdb/arch/amd64-linux-tdesc.c create mode 100644 gdb/arch/amd64-linux-tdesc.h create mode 100644 gdb/arch/i386-linux-tdesc.c rename gdb/{i386-linux-nat.h => arch/i386-linux-tdesc.h} (64%) create mode 100644 gdb/arch/x86-linux-tdesc-features.c create mode 100644 gdb/arch/x86-linux-tdesc-features.h create mode 100644 gdb/arch/x86-linux-tdesc.h 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: 39f0ac383169d7ef8b3169e483ae95dd185e41bd -- 2.25.4