From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id wFT7HDIS5mm5JiwAWB0awg (envelope-from ) for ; Mon, 20 Apr 2026 07:46:58 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=phoenix-rtos.com header.i=@phoenix-rtos.com header.a=rsa-sha256 header.s=google header.b=iz7Cpb1n; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 693881E067; Mon, 20 Apr 2026 07:46:58 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (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 370B51E067 for ; Mon, 20 Apr 2026 07:46:57 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 364E34BA2E04 for ; Mon, 20 Apr 2026 11:46:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 364E34BA2E04 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=phoenix-rtos.com header.i=@phoenix-rtos.com header.a=rsa-sha256 header.s=google header.b=iz7Cpb1n Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by sourceware.org (Postfix) with ESMTPS id D8EF44A9933E for ; Mon, 20 Apr 2026 11:46:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D8EF44A9933E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=phoenix-rtos.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=phoenix-rtos.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D8EF44A9933E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::133 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776685591; cv=none; b=gtdNrSjJs3z2MgRt0Y75maCQnCuPER2YE4WYZcOUElnPmq7hBlZcr7J6OPhGQNxNzdkN6roS69N27H5JNyk7unq24XXDYujiZsY/mR5LebiSMN/y4/2bTJZ8hovWvOt6Th0fPPmm5n5JsP9zQV3fTVbJyBziEppozZSOQG5CPAQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776685591; c=relaxed/simple; bh=0fZlAA4Gy/Io6ANOZPSNk7MmYYgD7IRZp6TCFJLybVU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=YwhGJeZsh9eY0/noD0F0zVPH2LovSuqtI6OUcKVqURmeCyEJW0LGxqsxF4yiR/8IWpqgQfl+bOVmagSJeKMFMOB/deL3F51bx2l3ajaQEgnJmDjVY76oLgaBOwEU+CsJGcfxkvs4KKtQteGqEeZBTU8ayPCXxpO/sAyG/XGVCpw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D8EF44A9933E Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-5a402b2d102so3423497e87.3 for ; Mon, 20 Apr 2026 04:46:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=phoenix-rtos.com; s=google; t=1776685588; x=1777290388; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=hh5/cY8D2+1+CFkyM+cUGQ0QL6f5lWqfDR7gALPUKE8=; b=iz7Cpb1nmg/2igDsaRSe2TTOzMmuVRHnywrX0nISo6ME0MQwPbysYwAwagmQIwnJZ/ 7yoV51QP4jcLJ310k/tMpfM0iGslVowSIfK1sFRdzLWdjCl1mq//nAHNQLHiXvtCQBgd 4YldyvipulhAYgr8Vf5KNyXfg91F68l34CfzWdsrMJ7kyBSWh6z7zHRy1FU9ebGE7ac/ v86B9tThhdvCYgzL/FfJu2OJWLux2siDPV/eVjS6n/f07oDHxIZo8yT0aleznNFc0TdI 6GH3OALOphSEZUQunKqoZCo3O+Eb/B7JVTu05K+Jyaut7a8kppkzpDf3pocf1GmtsFx4 Y3LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776685588; x=1777290388; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=hh5/cY8D2+1+CFkyM+cUGQ0QL6f5lWqfDR7gALPUKE8=; b=ZR12D6LX/v7b0MsK/kV6WtZSeTjQuIaQtJIZzAzQebWwhj3oqg5WzexxQUWJoeIfvs xMQBSZ+gyMkPsBcF4isWbTSn4qlzOiETV29FuIzTVkl81MUGQ0elrNPZMxFZEFWBxS21 RRIJhHPelew40uzM1ZZ2l8vFwDmNOUEIon2WC6i2bhGTkir7Gn6M9AFstEnXlD/tsT3h Gp7ttykWP1ELf86L0lJ4ddSc+/DT3yoc5/ScL4cXlfJUSQ/P8yD2BgOfDRZIM35chfpE ujpHbWuHWF5z9Bky5k/iJqM7Eh0f/kYEZXkjFUBFrYDdUCeHYQUeVw4OSktkjn3EEpBL 3YOA== X-Gm-Message-State: AOJu0YxKcQzYa5ODxk+NjJbWSQM29MS3Rh02cKCWXmjFKYM+WYZ//1Vi b43zllovF1BpmY57qZCfge/dLc+D604b0dpMPCOMduGPYgdfJjVmKZvqZp9Z3l5Rdw6/IzzJHfk V8rv6 X-Gm-Gg: AeBDiess9OyRi0NYfDKbM5w97QaKF9PQYtEdQdy1VuHYiOyPNskQ8iuUDcB8MS8vwV+ i6WRAu/cIAQH0ol36LJvplk19LcZecYNZSCwen7B1RXP3uAOE4jMx7wkWSDY0MUe25MshGgnj1Y vsmy9Mde68y2JMT+UXRVV0eNnON+lpX5jqVZIHwJBlHZDlZuv0gYRIdl4Y0cPzEsJOqVSOgoZAC iurSncETfxy09ggMLYrVmYCVvbTJhS6KYaPmhprklM7/ag4D5nElBVTh7D7daBnOXAv7FBNS3oQ YvO1Aca4hT6Rb4jioG0p4Xh4vpPCWRGV7vkNpFuIFseKtRgzJz9+wR9Gs+CTThUp9i7O7wZ5gzV 4Ms2QUgYCItj9gMgI2f7EfFlIjsTe+DKK4xxJMOLXmakyD/VU5GYKIULIeS0ErkpOrewwqDuEbB FqvyIY91zQ5TEfCEg6SCEQAw1PO8f8qJc5M5WGaiLe3a5XS695PBo5 X-Received: by 2002:a05:6512:3ca4:b0:5a3:ff6b:cb5d with SMTP id 2adb3069b0e04-5a4172cfc7cmr4402610e87.19.1776685588092; Mon, 20 Apr 2026 04:46:28 -0700 (PDT) Received: from hedwig.phoesys.com ([45.11.199.59]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5a4187e1116sm2928888e87.54.2026.04.20.04.46.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Apr 2026 04:46:27 -0700 (PDT) From: Michal Lach To: gdb-patches@sourceware.org Cc: jakub.klimek@phoenix-rtos.com, michal.lach@phoenix-rtos.com, daniel.sawka@phoenix-rtos.com Subject: [PATCH] gdb/sparc: implement PRSTATUS elf32-sparc handler Date: Mon, 20 Apr 2026 13:46:02 +0200 Message-ID: <20260420114608.597157-1-michal.lach@phoenix-rtos.com> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 From: Jakub Klimek Some SPARC ELF32 coredumps emit a PRSTATUS note which is left unparsed without a handler in GDB, leading to incorrectly viewed coredumps. --- bfd/elf32-sparc.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c index a5f5d058196..837b2e16fff 100644 --- a/bfd/elf32-sparc.c +++ b/bfd/elf32-sparc.c @@ -31,6 +31,34 @@ /* Support for core dump NOTE sections. */ +static bool +elf32_sparc_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) +{ + int offset; + size_t size; + + switch (note->descsz) + { + default: + return false; + case 228: + /* pr_cursig */ + elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12); + + /* pr_pid */ + elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 24); + + /* pr_reg */ + offset = 72; + size = 152; + + break; + } + + /* Make a ".reg/999" section. */ + return _bfd_elfcore_make_pseudosection (abfd, ".reg", size, note->descpos + offset); +} + static bool elf32_sparc_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) { @@ -230,6 +258,7 @@ elf32_sparc_reloc_type_class (const struct bfd_link_info *info, elf32_sparc_merge_private_bfd_data #define elf_backend_final_write_processing \ elf32_sparc_final_write_processing +#define elf_backend_grok_prstatus elf32_sparc_grok_prstatus #define elf_backend_grok_psinfo elf32_sparc_grok_psinfo #define elf_backend_reloc_type_class elf32_sparc_reloc_type_class -- 2.53.0