From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ot1-x32d.google.com with SMTP id 46e09a7af769-6b9b89627c3so1395259a34.1 for ; Thu, 27 Jul 2023 20:12:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690513957; x=1691118757; h=content-transfer-encoding:mime-version:message-id:date:in-reply-to :subject:cc:to:from:user-agent:references:from:to:cc:subject:date :message-id:reply-to; bh=QEFIEAtPDdf+94B2oEMSF1JDp/kXJys9YwbNSwqH2bs=; b=IpTHT5y5LvrptVc7B+1zp76i3lMDgx2UJaNZf+VJvQ0shUv6eDeG4v0sIiHZHuWgCN phs19A+XzMAvMOwJbZcpit+vxi+JUvZoHOH/EEd5nQ0xwUGN/iS9Np+1+3uiZOlkMXe+ lkfeg+LbZQt6sMI5AFoqJc8yJAFbqj7oourDt2x2Wlfy75kAgoz2pCRbW+FoiCXAbUfZ cbVBL5B5018cMduzoZYHW35Aimo45NFfnYemxoN12bYmmyBGwsrDTasxL6Wg4oUmUq9U 6vLL31sLWYZ7Ckn/ATsj/vAFSn6M4g0tD45FdwSM3aAeq6iTqJjpDV/UphS5QRWt/mpW DmCQ== 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 From: Thiago Jung Bauermann 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 List-Id: 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