From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 6DD41384AB63 for ; Wed, 8 May 2024 16:46:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6DD41384AB63 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 6DD41384AB63 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=1715186821; cv=none; b=dIsdfFgmXz5YA5596CMYQUIRam4rgorN+708lV6yVak5ofsqXAczTttjqwojKsTSdAXy9wWRDfXnMaFbew1GzYOdNzwyhIjj4kOp/obll8D8X9Y/kB75nuBCZYUqyiThHIzS2q7XecKovwb/Aj2ubxqQuP81R/l8mhfnXCFsDl0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715186821; c=relaxed/simple; bh=ETkbBlaj1w9W1Anc108RQLOnCCo0Rww+Xx/8mgadGyo=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=NR2pLphZdC3UEXcYyfRlogib2N+tN2UnHpURrXf0atZ5YABo49t0gnSkXP2wC6rVzQVhZI+tfl8pjze6/CRuSgz+ZSNcTLF2IXS58OJPJiH6TbzoW/BKg7FB0clCExpftPHLhVAswRDaD9y3e7dJPsUJzNcdjyDFKCpnuziAaNY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715186818; 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=cqElmtZbv7aSTtDT5mJGICUe0+iVjYJmDgq6nHCvAyU=; b=T5J9ahivlrn5EN4aYUxC2ZGAL5hw+lUZhjHrNZWiUXc2FYchwISNp0pWD5uoz0chWogK04 1qDeaA/ORdjJ1Y6YblVlTSGtU/VlNTcLk+FMvoqREYkvxh1+Wczg4SJi8x2ktVlrwkPYqs E8T6Q1zs3bQyy7YZboPbl/pY4ySZQbI= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-374-EH26NWk2MAKqNGI9cKT8tQ-1; Wed, 08 May 2024 12:46:56 -0400 X-MC-Unique: EH26NWk2MAKqNGI9cKT8tQ-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-41ec1528d83so27378665e9.1 for ; Wed, 08 May 2024 09:46:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715186815; x=1715791615; 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=cqElmtZbv7aSTtDT5mJGICUe0+iVjYJmDgq6nHCvAyU=; b=a4DuInHamouELPPQVAR7puuNypSIb9/bIEW1XNdIP3dUIyx6z9N3DsHpbsgRiMy+5Y 5cWA2aQUs0Lvgjg6DUAKfHp1tStutxi/sZChSGlpuIQVjn6EAcGxBWFBUR7JmCvILmdD nDMeQiZiwCNGEHOgEpRSxUav5degXLHQtVAixr5aKPzd+lElLN+Q2Qk+MdD0mYYJ8OZl kglISJTGhUTCzC2miXoTC6Dzj558nJwBks2sekQLkWAvUrYtUyHmt/ceGiCge8qtOrbn ydhCTQX2IcSWWSOC0HODxO6dgkgFJUZgnmGV17sB0b+Ebclu0koTWHmqPENDFMOXcXrJ DKjQ== X-Gm-Message-State: AOJu0YymYV7cP6J1Q1Rw0OwlKpMfjACPNBCXLkP2JlUTr9Z4LhOih/AH J0sWXrPPVh1e+Mo23Z0Gs69rTZphN7JYiIFjsp+LVX0jg/i6k8IDQ+UpSgTpVjQURAlV81OYpZ+ Fq1kottuwOAwjQMTb2TbkW8QatbLyG+XPgiiaZXWfPck42Bv9woTUY7x+F9tBSUngQIxLeuBRBP q7m8Ib0vxMMbDV2WllFz/1MK+1zFxiwF0l7O34Og6+pbY= X-Received: by 2002:a05:600c:314a:b0:41b:eaf2:f7e6 with SMTP id 5b1f17b1804b1-41f71302e3emr34091215e9.2.1715186814760; Wed, 08 May 2024 09:46:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHP14hr9lGdosembSX1i7UMVHFzfEUiY2QZ2XYsL4826th9vqelzrwDnE3cjwNPpUKITYXTHA== X-Received: by 2002:a05:600c:314a:b0:41b:eaf2:f7e6 with SMTP id 5b1f17b1804b1-41f71302e3emr34090925e9.2.1715186814342; Wed, 08 May 2024 09:46:54 -0700 (PDT) Received: from localhost ([31.111.84.240]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41f87b265dasm29459505e9.3.2024.05.08.09.46.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 09:46:54 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess , felix.willgerodt@intel.com, jhb@FreeBSD.org Subject: [PATCHv6 6/9] gdb: move xcr0 == 0 check into i386_linux_core_read_description Date: Wed, 8 May 2024 17:46:42 +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=-12.1 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 List-Id: 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. Approved-By: Felix Willgerodt --- 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 a78f03fac8d..511e43f3b6f 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