From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id +JMnAYTCK2Zj5TwAWB0awg (envelope-from ) for ; Fri, 26 Apr 2024 11:04:36 -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=SkmH9y+j; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id F33A31E0CE; Fri, 26 Apr 2024 11:04:35 -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 E0B2D1E0C0 for ; Fri, 26 Apr 2024 11:04:33 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 98B253849AE2 for ; Fri, 26 Apr 2024 15:04:33 +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 B7FF33849AD0 for ; Fri, 26 Apr 2024 15:02:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B7FF33849AD0 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 B7FF33849AD0 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=1714143756; cv=none; b=BuImyggHMSdxLpsh7lHxPs8+jWL+/n7HL1skbGMPIc2xuLILVi2G0YrV1aP+VX6yEOHrsbtpFcl51T/MuvYfDu3DJg0VQjxJGvIYy57t1Q7rx9bghJNFLcxfWWzxfteWK1qROqwexbVv92jYUP3Ys3AWTy2Qg0E2Z2Dy3Z7lvlM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714143756; c=relaxed/simple; bh=jwtmJ3AERcM+yZlyq0wC3FPaIBTZ7cKuFY6EcxW3/y8=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=YiddN/APgflrG87Ed+TORhPE+t5zzafuOWwVRTZrqnOVeNNaP+wAa9PhtvQolFCehyqPsq7gBnFOuE7CCk8umWEdoMoc9KVqnuRsZzYMcVTWsHnqwDD5mP/AEzcMiKrGt/m5d7BUK5udfawNRHa/gmCDtT+4631ek8Kja3nBITQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714143754; 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=VvXjm+PoO7xR+CXDNQC+A+vEIkpYKgcRLR719kSMIpo=; b=SkmH9y+jyzWY3z40mQYB6HC5iNSeaebnHMrc76BTGTjbDVFpWIm9zwbYpAm6+KwFSaVuZZ xWbzYzu0H3U3jXx5HMBAGQACPhn71cxqCDAvc+oo4YqT7nACb0Oz5/6p0ZkW1ZfeRWo/FP 4Q783O4DprxB1zwLVCiYaAEJNIaGtaU= 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-679-evhV_PmUM6O3jIuUVJooHg-1; Fri, 26 Apr 2024 11:02:32 -0400 X-MC-Unique: evhV_PmUM6O3jIuUVJooHg-1 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2d87dad1640so20491031fa.3 for ; Fri, 26 Apr 2024 08:02:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714143749; x=1714748549; 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=VvXjm+PoO7xR+CXDNQC+A+vEIkpYKgcRLR719kSMIpo=; b=idKb3NHxWaTssGa36xd/gpGp/dtuVcqC1jvBuiVa1AHjfO8Dy8XAHFsElAdaAVey21 w1aXylNggPeNMd7jnKV3mnygngtBBOWC6cOEOJdKmEn7xzv1U6X1hZyec0nxe5D0mt5y FtmWPBO79vy1WJZR84PJnr1GC3b/o2PXFEifaaP5hoOSLP2WFAzp32IgpbFuE/QwwQ4z tE43ixVYAm80rQidxqFLnZ+JfQo63b4h8qKilS4llxda0+7p0QyqYam6/wHjd8S6PXhI QiImhUJa3LMnvb8g9bc9OyrZF2dy5cacLPyLw8iv8CJ2h5A6//TrI/p/I4uIG4lxvzdm vGew== X-Gm-Message-State: AOJu0Yzhv4gsegVbzG5eLjEDVSB/xJYON97GuUxfLQwGXS6GUY/MM7Ym Kj/ZUUIhVIdK5lvdmaubuG5oo4xj0HHKVX5G2zjNFDM17iElYFB/2HP7CVFlUmzlr4kgsRFlzG4 0EC4JnQHOgyhpZQIYc0xKdCwSNBS+fN3feENoDZnefeEwvKt9Yo8kF3YBAHdnHe5de5dKG0mIS0 tXg//0tn+4JIWiqCRfGBbU58oOnpydljl09caIbvG9ifI= X-Received: by 2002:a2e:a783:0:b0:2de:be5c:5196 with SMTP id c3-20020a2ea783000000b002debe5c5196mr2234152ljf.41.1714143748721; Fri, 26 Apr 2024 08:02:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEKcMURKgy5YU5Fo0+QzGY8K/r/5PPZHH4CeBXNQm7dftF3uVGRP9RJo/SnKP7z+r7fn9HImg== X-Received: by 2002:a2e:a783:0:b0:2de:be5c:5196 with SMTP id c3-20020a2ea783000000b002debe5c5196mr2234127ljf.41.1714143748205; Fri, 26 Apr 2024 08:02:28 -0700 (PDT) Received: from localhost (185.223.159.143.dyn.plus.net. [143.159.223.185]) by smtp.gmail.com with ESMTPSA id t15-20020a1c770f000000b0041902ebc85bsm1310742wmi.1.2024.04.26.08.02.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 08:02:26 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess , felix.willgerodt@intel.com, John Baldwin Subject: [PATCHv5 10/11] gdb: move xcr0 == 0 check into i386_linux_core_read_description Date: Fri, 26 Apr 2024 16:01:54 +0100 Message-Id: <4c91c9b8910c57ee5f81c76b06f059373dd49c50.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=-12.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 Currently, in i386_linux_core_read_description, if GDB fails to extract an xcr0 value from the core file, then we will have a default zero value for the xcr0 variable, we still call the i386_linux_read_description function, which checks for this zero value and returns nullptr. Back in i386_linux_core_read_description we spot the nullptr return value from i386_linux_read_description and call i386_linux_read_description again, but this time passing a default value for xcr0. In the next commit I plan to rework i386_linux_read_description, and in so doing I will remove the check for xcr0 == 0, this is inline with how the amd64 code is written. However, this means that the 'xcr0 == 0' check needs to move up the stack to i386_linux_core_read_description, again, this brings the i386 code into line with the amd64 code. This is just a refactor in preparation for the next commit, there should be no user visible changes after this commit. --- gdb/i386-linux-tdep.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index 78ebc99d3df..c796f87780b 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -714,15 +714,16 @@ i386_linux_core_read_description (struct gdbarch *gdbarch, /* Linux/i386. */ x86_xsave_layout layout; uint64_t xcr0 = i386_linux_core_read_xsave_info (abfd, layout); - const struct target_desc *tdesc = i386_linux_read_description (xcr0); - if (tdesc != NULL) - return tdesc; + if (xcr0 == 0) + { + if (bfd_get_section_by_name (abfd, ".reg-xfp") != nullptr) + xcr0 = X86_XSTATE_SSE_MASK; + else + xcr0 = X86_XSTATE_X87_MASK; + } - if (bfd_get_section_by_name (abfd, ".reg-xfp") != NULL) - return i386_linux_read_description (X86_XSTATE_SSE_MASK); - else - return i386_linux_read_description (X86_XSTATE_X87_MASK); + return i386_linux_read_description (xcr0); } /* Similar to i386_supply_fpregset, but use XSAVE extended state. */ -- 2.25.4