From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 6C4wHfV+YWYlUygAWB0awg (envelope-from ) for ; Thu, 06 Jun 2024 05:18:45 -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=Xh/wSdK/; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 72FB51E0C0; Thu, 6 Jun 2024 05:18:45 -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 606D11E092 for ; Thu, 6 Jun 2024 05:18:43 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C9AE938FC307 for ; Thu, 6 Jun 2024 09:18:42 +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 DEB7D38F980C for ; Thu, 6 Jun 2024 09:16:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DEB7D38F980C 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 DEB7D38F980C 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=1717665388; cv=none; b=N0OAsco4Yhvs2KuqKU1RrrBxPZL0MMngd7W+UZyxWhiztvnGY6aSYL3GrR7A+RP+C0Vth5Ckpl9Z5RSsnRqBX0gh+RQ1hxqOAMV9rKus7q2uWDo8cjQ31BWWLAjJCpAdlhzhGuc33TM45J83/vFtgQKBmdF3OmdI0yX9KcrUd64= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717665388; c=relaxed/simple; bh=9Diia1TGB7M9tr/V9zOJ29zUoGLo682cMaasu8gp76s=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=iHi2IaxQ+f3+TRs1cI1CjTHLOh911ucuYaT9JKi5/2GggaZ2uoq6yf3ceM9RvwThN6OJTIfDFsWTziMl0Rejbd+NTM2TzSc0/sJEp62p6Ez1GX8H2ZfjUT89Q/I0/js95Mxsu3PgxdVyid+ZMo6Ti+CKhhGxFdHQTpwZhh4dYro= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717665386; 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=Kdi8zyO660x2jbUvey0z6P24eCeNTfLaEBp/iQZW12c=; b=Xh/wSdK/vV/B8fssgmXbQURPu5WgrzpjRH575QPt1p8NM/MIjnLhY6IzbWNRlgh9PbBumv oSCGNh03soc2uvGAn8wREMEZLRtgnx1CU2gZs35fi+932Lz4EYjuV0wWNTJGoyNkoFhOQc UyWvAlCUnRydRQa8AYsTIWpn7jMSCLw= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-642-unqZmP9mNLCCYqFvO_dm9A-1; Thu, 06 Jun 2024 05:16:25 -0400 X-MC-Unique: unqZmP9mNLCCYqFvO_dm9A-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4215a38713eso6452405e9.3 for ; Thu, 06 Jun 2024 02:16:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717665383; x=1718270183; 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=Kdi8zyO660x2jbUvey0z6P24eCeNTfLaEBp/iQZW12c=; b=NIXEFKWqTyocMm93AqPBUZHpWcVDTTQ2IwhlcEhTZUlDO0bpPeluaQ2CEiEttBGSQq nXluUZl2+sl0MQBvAuKLFu0MAS6nqFOxSdGXSwL3RdlRzOfNg3sfKuk8rVg12edrwNYQ BLiSnbZ06x4p77+xRRCaM6CSwI3tz/eIIEArfe9xITtW0valBJOyatOyksCm0kRcOkAA jM7YkX7cGApI1ftZpc8QtSiAwmSvWB2dnOyKKwlYBMr52/rXaBfF8A38TxtxRuqGzEhA fn5roLJjxJrXnvpWGciwqE7k8CYj5YkMkiTq5xVX2DDvtypggTHcGWVZT2Q04V/lHkSR jQ4Q== X-Gm-Message-State: AOJu0YzeqrCGWQMQrbgqOwOODnbY4DV0JS5D75X8W44yniUFRnfwnr2Z L6ySAbf6AvqQJjRmw8PYzZKxp94GrofTWWw+2b/WKtJ5YE8QL2cfBj7+Sa2DhhtRmLPth0tlbFG 3mzdo+HI/t1kV4Jxwf7T5KCwIUF6W39EVk+mWAC4HhGSQC8Vl7Fnyd9L7AlsZ6iKy9JvPKUXMbD cCKjLcBrpgFNTjDoHEa8zJVgJsAlZC9pr1tc+4iJzq3pA= X-Received: by 2002:a05:600c:4455:b0:420:1a3:dd04 with SMTP id 5b1f17b1804b1-421562dd431mr38139775e9.24.1717665383317; Thu, 06 Jun 2024 02:16:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHvtOoFChCdnymuc+GXSI0mFIUgk/ulDYmZFZ7mcUSoc8+5r5aDZ1bq0IjgOAS15nnDmqKWAQ== X-Received: by 2002:a05:600c:4455:b0:420:1a3:dd04 with SMTP id 5b1f17b1804b1-421562dd431mr38139425e9.24.1717665382820; Thu, 06 Jun 2024 02:16:22 -0700 (PDT) Received: from localhost ([31.111.84.186]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4215c1aad97sm14798435e9.20.2024.06.06.02.16.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 02:16:21 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess , felix.willgerodt@intel.com, John Baldwin Subject: [PATCHv8 6/9] gdb: move xcr0 == 0 check into i386_linux_core_read_description Date: Thu, 6 Jun 2024 10:16:02 +0100 Message-Id: <04fbe19c9c2bae542cff2efdb2eea13022b3b18f.1717664371.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.8 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, T_SCC_BODY_TEXT_LINE 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. Approved-By: Felix Willgerodt Approved-By: John Baldwin --- 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