From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id GIatCRLwD2YqYiQAWB0awg (envelope-from ) for ; Fri, 05 Apr 2024 08:35:30 -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=Y75GE/F+; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 1D5861E0C1; Fri, 5 Apr 2024 08:35:30 -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 01D0E1E0AC for ; Fri, 5 Apr 2024 08:35:28 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B9E193858415 for ; Fri, 5 Apr 2024 12:35:27 +0000 (GMT) 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 38F0A38449C6 for ; Fri, 5 Apr 2024 12:33:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 38F0A38449C6 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 38F0A38449C6 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=1712320428; cv=none; b=p+GSFmUlRw95njyPQIJbAbrBRhHXN8IUbez0cifY8LOlxwAlGolRlOkhLOa3xGfksY+poib3WJTrfSB7T5Qw3klWpe5VK8PidLbryLnHsJhW7bP/H+D0IR8X0/iOAipMol7U4LOM2uZEmrmYEg5pSEoOE+EnRH8Heqiea6kpB0Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712320428; c=relaxed/simple; bh=jwtmJ3AERcM+yZlyq0wC3FPaIBTZ7cKuFY6EcxW3/y8=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=Q8ly/iYL/y6971sCFc/wGUgF03a/uETxjytPSRXRsmRyXXQ+LVulrWvheUmiBYHCCcr7mWWlBTjYKn6LXpNDum001MMppOdZJr0SMoUvu4fzrt0icb9hKAC1fqzXlt4PjskMLhNv/0DrmF20X77d7qUQOqaNYdVbLnDkx2lCERA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712320424; 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=Y75GE/F+Bh6ZgY3gkmwbgKe52kKbizTpKLpkBLBcSHnc8lkxYQuZX67LhgJILVNsMUCfcE JPSJJf9w60sBN1IB84YqVZPTw31DFYiOmn1Bz1nRj802yPD7whCd61dXFpUgcPJgjHUhiL quMBs1SDTxRIWNMEe2iQj2QvDINSd1Q= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-80-ImW-8dpsMU6ipL1C6L9wNA-1; Fri, 05 Apr 2024 08:33:43 -0400 X-MC-Unique: ImW-8dpsMU6ipL1C6L9wNA-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-a51a6691238so44562266b.1 for ; Fri, 05 Apr 2024 05:33:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712320422; x=1712925222; 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=eH33PIDLR3A4RvdWH+LVpmNroY7geWqdwLo/jaZ7SEa/UDDO+iTx5w5A5t7VYM2MiH q69N4No9UYQeOz8RcTx9Mcs+m0XgYWqEEoRIAlPBMb3m1ZjbVcnkTr1Bulidt1IkFlWC 7O5y3A+GtxLOruwOI1xosXRDu6l/yKuvsjZo+QoLcY5WcNEA5xpgWQW5soqyl196j99g 4U2NIzkGUMTRlc7wSVZeT/poB9EdRomWkwdsRZ9v/sVSKdcVO1Qx58cbJQWEFssUxjdV KJ9dFLrNnN3XiREx+eweBPNwsbSqqAMQVKYwo/3jKLxxkaIdjFhcbljQMQfTEQdfUdLI XL9A== X-Gm-Message-State: AOJu0YzvEkSPZgKEgdpafHfwgEVl9xyy39Lg2l39SxPpxMwxqfeveFyO r+if+H/baBY0QofM/RDNLVdUR/uEcltBp/HAn6166oblwEnGsA5x9AEiyhmP/z2Ogivp/t02TsG fp+Z7uysTWSgk4IY3kiirEIvdVU6kWtRVkWkkkuhNhsRILS4SUKeSQmmLkDmpL/ItT80XZqtokG FECBX7pUr3DddnIaoOv9rdh/Ck75w1ZELK57F6UEf9z6w= X-Received: by 2002:a17:906:aed8:b0:a4e:96fa:e1b2 with SMTP id me24-20020a170906aed800b00a4e96fae1b2mr1066561ejb.53.1712320421714; Fri, 05 Apr 2024 05:33:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGo3fOjlH2P7UIpFUg5nb04bRDsCUg4Jhn6UJJxg5WLaans321MnNLttaX9MO+OXn1HI9VA4g== X-Received: by 2002:a17:906:aed8:b0:a4e:96fa:e1b2 with SMTP id me24-20020a170906aed800b00a4e96fae1b2mr1066535ejb.53.1712320421076; Fri, 05 Apr 2024 05:33:41 -0700 (PDT) Received: from localhost (185.223.159.143.dyn.plus.net. [143.159.223.185]) by smtp.gmail.com with ESMTPSA id gu13-20020a170906f28d00b00a46a71c5324sm795098ejb.34.2024.04.05.05.33.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 05:33:40 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv4 09/10] gdb: move xcr0 == 0 check into i386_linux_core_read_description Date: Fri, 5 Apr 2024 13:33:19 +0100 Message-Id: <418bcac0b42795fe871d92d9d03b9e7dd9d30138.1712245988.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=-11.9 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