From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id AE1oGkYyw2RjLjEAWB0awg (envelope-from ) for ; Thu, 27 Jul 2023 23:13:10 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=dpBRIWVS; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 5E92F1E0C0; Thu, 27 Jul 2023 23:13:10 -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 RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 4B0601E00F for ; Thu, 27 Jul 2023 23:13:08 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AC0FF385AF8A for ; Fri, 28 Jul 2023 03:13:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AC0FF385AF8A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1690513987; bh=QEFIEAtPDdf+94B2oEMSF1JDp/kXJys9YwbNSwqH2bs=; h=References:To:Cc:Subject:In-reply-to:Date:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=dpBRIWVSOVjSoT13gKPDn9gAKGJw7oWyuwH4OjWebKVvGUcr31LZSjejhkikkXCd2 3TmAWmuByb8o0fwmq9gB3ejUBHmo0eiTl4w7hk26SWY/Q7ph1lsxwNzcf+o/1i5+ut yO6w8CptrJxdYg3nlFRyLNdDsY7beCDJ4KdMAjW0= Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) by sourceware.org (Postfix) with ESMTPS id 1D27E3858D1E for ; Fri, 28 Jul 2023 03:12:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1D27E3858D1E Received: by mail-ot1-x32d.google.com with SMTP id 46e09a7af769-6b9b89627c3so1395259a34.1 for ; Thu, 27 Jul 2023 20:12:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690513957; x=1691118757; h=content-transfer-encoding:mime-version:message-id:date:in-reply-to :subject:cc:to:from:user-agent:references:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=QEFIEAtPDdf+94B2oEMSF1JDp/kXJys9YwbNSwqH2bs=; b=U7ed9nOUgavpKf0dMQ1nU97kF1GY8r74mt5RVJq5Q5qhvhvi6yIZE60511D6XDRaul dPf1Qer7fOGK3TJ3LD/jtgkgr6X+bl4hPN4duEW5dsSifCoW6yTEY/gmBCi9gsWod2ad DjpWPPEcrl9vSRvhfLpMTRZa827FdCw7XEHyCtEfxJM10mELTHtvcP7+mCJup6ZLeM8m Oos90L3yrRej80sF+zcnRWnnTN6HTehXLlzKgAfaRVQ6VPXV9DxEAOa6+as/puHj3i99 YHEwkeXL1l30qO6WFDZB2nSgI0SrL46y+1cl7UKyeD6xCi/YotBOLm5bfUJ/MFz5Lxm0 C6ww== X-Gm-Message-State: ABy/qLbQE+mmj5yZsHuRhZE9VCP7EXnkYevS/7lXtYmPqTU4YlKgP+QS F/eLRQ7/4mHKlvvGcs8Wbs8cuQ== X-Google-Smtp-Source: APBJJlG59qmPFgz5sQ/UuwigklnerlUnT3cY8j6NoeIR0zgaJLFVZML6U/ai4dEMqVNSRU6/INH9/w== X-Received: by 2002:a05:6808:1793:b0:3a3:f45b:aa48 with SMTP id bg19-20020a056808179300b003a3f45baa48mr1857340oib.6.1690513956561; Thu, 27 Jul 2023 20:12:36 -0700 (PDT) Received: from localhost ([2804:14d:7e39:8470:b6b2:cb77:8e91:bbbd]) by smtp.gmail.com with ESMTPSA id k23-20020a544417000000b003a3860b375esm1271748oiw.34.2023.07.27.20.12.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 20:12:36 -0700 (PDT) References: <20230630134616.1238105-1-luis.machado@arm.com> <20230630134616.1238105-14-luis.machado@arm.com> User-agent: mu4e 1.10.5; emacs 28.2 To: Luis Machado Cc: gdb-patches@sourceware.org, Andrew Burgess Subject: Re: [PATCH v3 13/16] [gdb/generic] corefile/bug: Fixup (gcore) core file target description reading order In-reply-to: <20230630134616.1238105-14-luis.machado@arm.com> Date: Fri, 28 Jul 2023 00:12:33 -0300 Message-ID: <878rb07mqm.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Thiago Jung Bauermann via Gdb-patches Reply-To: Thiago Jung Bauermann Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Luis Machado via Gdb-patches writes: > Due to the nature of the AArch64 SVE/SME extensions in GDB, each thread > can potentially have distinct target descriptions/gdbarches. > > When loading a gcore-generated core file, at the moment GDB gives priority > to the target description dumped to NT_GDB_TDESC. Though technically cor= rect > for most target, it doesn't work correctly for AArch64 with SVE or SME > support. > > The correct approach for AArch64/Linux is to rely on the > gdbarch_core_read_description hook, so it can figure out the proper target > description for a given thread based on the various available register no= tes. > > I think this should work for other architectures as well. If not, we may > need to adjust things so all architectures get the information that they > need for discovering the target description of the core file. The code to load the target description from the core file was added in commit 95ce627aeb9d "gdb: write target description into core file", by Andrew Burgess. My understanding of that commit message is that it was added before the gdbarch hook on purpose, and my reading of: =E2=80=9CMy primary motivation for adding this feature is that, in a future commit, I will be adding support for bare metal core dumps on some targets. For RISC-V specifically, I want to be able to dump all the available control status registers. As different targets will present different sets of register in their target description, including registers that are possibly not otherwise known to GDB I wanted a way to capture these registers in the core dump.=E2=80=9D is that it doesn't work if reading from the target description comes last, though I'm not sure about that. I copied him in this email to see if he would like to chime in. --=20 Thiago