From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id qM+THHqvKmCIMwAAWB0awg (envelope-from ) for ; Mon, 15 Feb 2021 12:29:30 -0500 Received: by simark.ca (Postfix, from userid 112) id 7075C1EF78; Mon, 15 Feb 2021 12:29:30 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED, MAILING_LIST_MULTI,T_DKIM_INVALID,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from 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 309D81E54D for ; Mon, 15 Feb 2021 12:29:24 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 885063950411; Mon, 15 Feb 2021 17:29:22 +0000 (GMT) Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by sourceware.org (Postfix) with ESMTPS id C7C58385DC33 for ; Mon, 15 Feb 2021 17:29:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C7C58385DC33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=andrew.burgess@embecosm.com Received: by mail-wm1-x32f.google.com with SMTP id x4so10042733wmi.3 for ; Mon, 15 Feb 2021 09:29:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Xpqp+S4ADn9RhcinbGkiK8sQXgIQTN110kFbC2Z8bZQ=; b=XJkgsaGzq3VU5vcbciApWZ242mLl8MmK1/nPHUojqazYj+bIQrD8UZFK4DN+ZOiqiR 5pr/zPwNCdYoZFEzpNEtnbCshjcWpXxFT+WlGQ0QSnOUUy4kzhWuHGx9moi8CV1lyT+K JuiG0y0w2NjbSGtS9t+d0R579IrBiOr0MPeTxMo8Hu7j6WAKQ3/Q+pk/CbAl5d3mm2XY YoLysuu8k6rxq6cKmL/p2aus4Xr/1N1tDlztmbxsXRrWYSA4m77fDpNXVXLdPhXVZXD1 yhtfxIwprOZ1omg9w0v20Whz0Kev9TI5RTDLekew776z77IHP79PXEndR6q3CcBGL+X8 ps4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Xpqp+S4ADn9RhcinbGkiK8sQXgIQTN110kFbC2Z8bZQ=; b=fGNBp92VXEqRRY7bPUgraLCFiPxNjnMuLBCxiK6H2G2twaQPFI0MIcFF/9bA+uuwiv NnvbuISElcU4hqVYqNFGmEavDhLfew/PRmwulsS7DFqqLpu/1lWhXXdQW2dlzA+JQ4mk UuC9qgg97WIM2WqY1aBnGhLwPdx6lSOtAdd8MzpHsQxJR/wfy4kb8r80KHA/ujJqhxSP zPCuUmloB3WCLc+LQu4XIkekV4SJISR5u1AsFHkLpx2pgvNBLHlp74/innHWB08ybsmQ 4FslEP0zEndwOIt0SSkJbB+uhnsU0wODgoLMyWPqRFgrk9RcsQ0e28YnwX/6sgBI3Mbf dFIg== X-Gm-Message-State: AOAM530gFeuds9yEI9frGSz+ohW/2p1IOaTh40Ekutneosmlev3QfBsK 4q7T1579e3zK922yZeAgVKbYLP7Sfa/XzQ== X-Google-Smtp-Source: ABdhPJxy9Duo0ckSolYIdJEoB8OcZIMOklVYarNeTbwI4RbnH6iHbKVva80LulNsP8FRzDEPgcaShg== X-Received: by 2002:a05:600c:3212:: with SMTP id r18mr14970687wmp.132.1613410156654; Mon, 15 Feb 2021 09:29:16 -0800 (PST) Received: from localhost (host86-186-80-154.range86-186.btcentralplus.com. [86.186.80.154]) by smtp.gmail.com with ESMTPSA id v204sm26695482wmg.38.2021.02.15.09.29.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Feb 2021 09:29:16 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org, binutils@sourceware.org Subject: [PATCHv3 0/9] Bare-metal core dumps for RISC-V Date: Mon, 15 Feb 2021 17:29:03 +0000 Message-Id: X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: , Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" After I pushed patch #1 from the v2 series it was pointed out that this broke any build of GDB for non-ELF targets. I then reverted patch #1. Now I'm back with an updated series. For testing the build I have been using 'x86_64-apple-darwin20.3.0' as a non-ELF target. I haven't done any actual functional testing on this target other than "it builds", but that's more than I did before (for non-ELF targets). Between v2 and v3 then the changes are basically around the idea of not calling ELF specific functions from any generic code. As far as possible I wanted to avoid just blocking code out with #ifdef, though I did use this trick in a limited way in patches #5 and #9, hopefully this is acceptable, though I'm open to suggestions for better ways to structure the code in these patches. Here's a summary of which patches have changed: (1) - Changed, common code from Linux and FreeBSD targets is now split between gcore.c (for non-ELF code) and a new file gcore-elf.c (for ELF specific code). Changes to configure.ac ensure the ELF specific file is only pulled in when needed. This probably needs a new review. (2) - Minor updates to address Jim's review feedback. Reviews are welcome, but I'm considering this patch approved. (3) - Code to add the target description note is moved to gcore-elf.c, and each target must call this code (if the target is creating an ELF based core file). I don't like this as much as the previous code where the target description note was added in one place, but I can't see a good way to do this without adding a #ifdef block to gcore.c. This probably needs a new review. (4) - Minor updates to address Jim's review feedback. Reviews are welcome, but I'm considering this patch approved. (5) - The common bare metal core dump code is now in elf-none-tdep.c. This is then called from the riscv-none-tdep.c code ONLY if we have ELF support. This is the use of '#ifdef HAVE_ELF' which is a little yuck, but I can't see a better solution. This probably needs a new review. (6) - Minor updates to address Jim's review feedback. Reviews are welcome, but I'm considering this patch approved. (7) - No changes. Reviews are welcome, but I'm considering this patch approved. (8) - No changes. Reviews are welcome, but I'm considering this patch approved. (9) - No significant changes. Like patch #5 it now includes a '#ifdef HAVE_ELF' block in order to guard the call from arm-none-tdep.c to elf-none-tdep.c. I'd prefer reviews of this approach be addressed to patch #5, I'll apply any feedback I get there to this patch too. --- Andrew Burgess (9): gdb: unify parts of the Linux and FreeBSD core dumping code bfd/binutils: support for gdb target descriptions in the core file gdb: write target description into core file bfd/riscv: prepare to handle bare metal core dump creation gdb/riscv: introduce bare metal core dump support bfd/binutils: add support for RISC-V CSRs in core files gdb/riscv: make riscv target description names global gdb/riscv: write CSRs into baremetal core dumps gdb/arm: add support for bare-metal core dumps bfd/ChangeLog | 27 ++++++ bfd/elf-bfd.h | 4 + bfd/elf.c | 70 ++++++++++++++ bfd/elfnn-riscv.c | 84 ++++++++++++++++- binutils/ChangeLog | 10 ++ binutils/readelf.c | 4 + gdb/ChangeLog | 88 +++++++++++++++++ gdb/Makefile.in | 8 ++ gdb/arm-none-tdep.c | 213 ++++++++++++++++++++++++++++++++++++++++++ gdb/configure | 3 +- gdb/configure.ac | 3 +- gdb/configure.tgt | 5 +- gdb/corelow.c | 24 +++++ gdb/elf-none-tdep.c | 126 +++++++++++++++++++++++++ gdb/elf-none-tdep.h | 30 ++++++ gdb/fbsd-tdep.c | 137 ++------------------------- gdb/gcore-elf.c | 166 ++++++++++++++++++++++++++++++++ gdb/gcore-elf.h | 47 ++++++++++ gdb/gcore.c | 21 +++++ gdb/gcore.h | 9 ++ gdb/linux-tdep.c | 146 +++-------------------------- gdb/riscv-none-tdep.c | 173 ++++++++++++++++++++++++++++++++++ gdb/riscv-tdep.c | 14 ++- gdb/riscv-tdep.h | 3 + include/ChangeLog | 10 ++ include/elf/common.h | 6 ++ 26 files changed, 1159 insertions(+), 272 deletions(-) create mode 100644 gdb/arm-none-tdep.c create mode 100644 gdb/elf-none-tdep.c create mode 100644 gdb/elf-none-tdep.h create mode 100644 gdb/gcore-elf.c create mode 100644 gdb/gcore-elf.h create mode 100644 gdb/riscv-none-tdep.c -- 2.25.4