From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id jbjbDecjHmqwvC4AWB0awg (envelope-from ) for ; Mon, 01 Jun 2026 20:29:27 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=eagerm.com header.i=@eagerm.com header.a=rsa-sha256 header.s=dreamhost header.b=yU6X5cF0; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 1CD4B1E024; Mon, 01 Jun 2026 20:29:27 -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 465971E024 for ; Mon, 01 Jun 2026 20:29:25 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3BBC54BA2E2E for ; Tue, 2 Jun 2026 00:29:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3BBC54BA2E2E Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=eagerm.com header.i=@eagerm.com header.a=rsa-sha256 header.s=dreamhost header.b=yU6X5cF0 Received: from duck.ash.relay.mailchannels.net (duck.ash.relay.mailchannels.net [23.83.222.52]) by sourceware.org (Postfix) with ESMTPS id 82EC64BA2E0D; Tue, 2 Jun 2026 00:28:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 82EC64BA2E0D Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=eagerm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=eagerm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 82EC64BA2E0D Authentication-Results: sourceware.org; arc=none smtp.remote-ip=23.83.222.52 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780360103; cv=none; b=gfYzrLJaxhxXMlOaZ67gGFvQkRd6kFS/tDYE7h8jeX4CnFZYtlaKlHaL4x8Bc2zwYHvAYON/S7jWuXaRagIjckJzkNPAMMzvwairTYYKiOzdOXauCdGvXWuUMcvvgwscQ4pumqUDJud/Wlz27XU1vd62vB2Op4HsGYJnZjM7SAo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780360103; c=relaxed/simple; bh=p62ia0x4coOTnOjfwX2S+5AklvuIV9nJUEKZ1es/zOw=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=P/oHVZIIBrgcLAjiZRU276UDQXVGe6KdK0bXWwk0obnf21Z9I0cyQsyxV8GiO+fd1PzwLJ0W0gMSTkUwBzZh3iWZm/3evY9SXDFlTk6n9KCUSP4/0bSLUcc5L3FXNf9IE/AATES7l204Z7wnULIF+S2YK9NLqKgmTeveN2bT8wI= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=eagerm.com header.i=@eagerm.com header.a=rsa-sha256 header.s=dreamhost header.b=yU6X5cF0 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 82EC64BA2E0D X-Sender-Id: dreamhost|x-authsender|eager@eagerm.com Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 3489E614B5; Tue, 02 Jun 2026 00:28:21 +0000 (UTC) Received: from pdx1-sub0-mail-a208.dreamhost.com (100-101-154-94.trex-nlb.outbound.svc.cluster.local [100.101.154.94]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id D6CEF6187D; Tue, 02 Jun 2026 00:28:20 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|eager@eagerm.com X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|eager@eagerm.com X-MailChannels-Auth-Id: dreamhost X-Vacuous-Continue: 3238b10f0eb1a6cb_1780360101114_583026019 X-MC-Loop-Signature: 1780360101114:2094979031 X-MC-Ingress-Time: 1780360101114 Received: from pdx1-sub0-mail-a208.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.101.154.94 (trex/7.1.5); Tue, 02 Jun 2026 00:28:21 +0000 Received: from [192.168.20.10] (99-119-193-198.lightspeed.sntcca.sbcglobal.net [99.119.193.198]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) (Authenticated sender: eager@eagerm.com) by pdx1-sub0-mail-a208.dreamhost.com (Postfix) with ESMTPSA id 4gTsBD43nDz3R; Mon, 1 Jun 2026 17:28:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eagerm.com; s=dreamhost; t=1780360100; bh=ZWB27456Uzheq6vovk1TzYZLgnnO5UFg0snJwZUhNn0=; h=Date:Subject:To:Cc:From:Content-Type:Content-Transfer-Encoding; b=yU6X5cF0MpTG/9xU1LCom/dD5wl4u3OhyQLm12P+9LbkIM9yZ67GKbvP0e+ljUXlb tHRTvGUygy9dkOUr6qW5Wx2gwonYwROPbpPUJqXVBZCwnsT+Tr44tehQTdJunSG4ct HknpMBrD6FxqRe8tOWMxiRyZbHWSrBHWwUGnIL6d5TgL/olNPiEOzhtlLkaTkAKmWK QjKxAQS58ti+bF8noDUhe9Yvv7l1xHQ3f/wzj+MfTwoxUEMiVFU23pF743cp95fQ00 jvFa/+6iB/GlkMSWBKH/YNzv+eBGipsB30szBM5SD1hVMtOZsK5oPg2weFyZMC5cb+ Gw3tDTQm+5jcw== Message-ID: Date: Mon, 1 Jun 2026 17:28:19 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] gdb/MicroBlaze: Add support for native linux gdb To: Gopi Kumar Bulusu , Tom Tromey Cc: binutils@sourceware.org, gdb-patches@sourceware.org References: <874ijq5knu.fsf@tromey.com> Content-Language: en-US From: Michael Eager In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed 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 Please post an updated patch for review. On 5/31/26 11:38 PM, Gopi Kumar Bulusu wrote: > On Fri, May 29, 2026 at 8:26 PM Tom Tromey wrote: >> >>>>>>> Gopi Kumar Bulusu writes: >> >>> Attached is a patch to add native linux support for gdb including >>> cache target support. >> >> Thanks for the patch. >> >> I read through it and have some nits. There's nothing very serious >> except this: >> >>> The original sources for the patch come from Xilinx/AMD Yocto git >>> repository (2025.2) >> >> Who wrote them and are they covered by the copyright assignment? >> >> This is the most important consideration, the patch can't land without >> this being clear. > > This work is being performed under a contract with Xilinx/AMD as > confirmed in a different response to > Simon and therefore covered by the copyright assignment. > > I will make the changes as described below and retest. > > Approved for commit ? > > dhanyavaadaaha > gopi > >> >>> From a3328b4cdfc58783b5f290f22255b36e26a6fb14 Mon Sep 17 00:00:00 2001 >>> From: Gopi Kumar Bulusu >>> Date: Thu, 7 May 2026 17:47:40 +0530 >>> Subject: [PATCH] gdb/MicroBlaze: Add support for native linux gdb >> >> It's best to just git send-email rather than using an attachment. >> >>> bfd/ChangeLog: >> >>> * elf32-microblaze.c (microblaze_elf_grok_prstatus): New function. >>> (microblaze_elf_grok_psinfo): Likewise. >> >>> gdb/ChangeLog: >> >>> * Makefile.in (HFILES_NO_SRCDIR): Add microblaze-linux-tdep.h >>> ALLDEPFILES: Add microblaze-linux-nat.c >> >> gdb doesn't use ChangeLogs any more and this text should all be removed. >> >>> +#define MICROBLAZE_TARGET_HAS_GETREGS 0 >>> +#define MICROBLAZE_TARGET_HAS_SETREGS 0 >> >> This seems weird: >> >>> +/* Wrapper function around ptrace. */ >>> + >>> +static void >>> +fetch_target_gp_regs (int tid, elf_gregset_t *gregs) >>> +{ >>> + elf_greg_t *gregp = *gregs; >>> + >>> +#if MICROBLAZE_TARGET_HAS_GETREGS >>> + if (ptrace (PTRACE_GETREGS, tid, 0, (long) gregp) < 0) >>> + { >>> + perror_with_name (_("Couldn't get registers")); >>> + return; >>> + } >>> +#error "this configuration did not work during testing" >> >> Normally we don't put new dead code into gdb. >> >> I think this and the defines could just be replaced with a comment >> explaining that PTRACE_GETREGS doesn't work on this platform. >> >>> +++ b/gdb/microblaze-linux-tdep.h >>> @@ -0,0 +1,24 @@ >>> +/* Target-dependent code for GNU/Linux on MicroBlaze. >>> + >>> + Copyright (C) 2021-2026 Free Software Foundation, Inc. >>> + >>> + This file is part of GDB. >>> + >>> + This program is free software; you can redistribute it and/or modify >>> + it under the terms of the GNU General Public License as published by >>> + the Free Software Foundation; either version 3 of the License, or >>> + (at your option) any later version. >>> + >>> + This program is distributed in the hope that it will be useful, >>> + but WITHOUT ANY WARRANTY; without even the implied warranty of >>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >>> + GNU General Public License for more details. >>> + >>> + You should have received a copy of the GNU General Public License >>> + along with this program. If not, see . */ >>> +#ifndef MICROBLAZE_LINUX_TDEP_H >>> +#define MICROBLAZE_LINUX_TDEP_H >>> + /* Target descriptions. */ >>> + extern struct target_desc *tdesc_microblaze_linux; >> >> Blank line between the #define and the comment. >> >> Also this define should have a slightly different name, see >> check-include-guards.py. >> >>> non_stack_instruction_found = 0; >>> + cache->register_offsets[rd] = -imm; >>> continue; >> >> Indentation looks wrong, probably not using tabs. >> >>> @@ -399,8 +400,7 @@ microblaze_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc) >>> { >>> sal = find_sal_for_pc (func_start, 0); >> >>> - if (sal.end < func_end >>> - && start_pc <= sal.end) >>> + if (sal.line != 0 && sal.end <= func_end && start_pc <= sal.end) >>> start_pc = sal.end; >> >> No objection from me but this seems somewhat unrelated. >> >> >>> /* Call for side effects. */ >>> - get_frame_func (next_frame); >>> + cache->pc = get_frame_func (next_frame); >> >> Please remove that comment as it is now wrong. >> >>> + if (regnum == MICROBLAZE_SP_REGNUM) >>> + regnum = 1; >> >> Wrong indentation. >> >>> + if (regnum == -1) { >>> + int i; >>> + >>> + for (i = 0; i < MICROBLAZE_REDR_REGNUM; i++) { >>> + regcache->raw_supply (i, regs + i * MICROBLAZE_REGISTER_SIZE); >>> + } >> >> Wrong brace placement in this hunk. >> >>> + cb (".reg", tdep->sizeof_gregset, tdep->sizeof_gregset, tdep->gregset, NULL, >>> + cb_data); >> >> Normally in new code we're using 'nullptr' now. Best would be to go >> through the whole patch and check for this. You don't have to fix >> pre-existing code that is using NULL though. >> >>> gdbarch *gdbarch >>> = gdbarch_alloc (&info, gdbarch_tdep_up (new microblaze_gdbarch_tdep)); >> >>> + microblaze_gdbarch_tdep *tdep >>> + = gdbarch_tdep (gdbarch); >>> + >>> + tdep->gregset = NULL; >>> + tdep->sizeof_gregset = 0; >>> + tdep->fpregset = NULL; >>> + tdep->sizeof_fpregset = 0; >> >> Here it would be better to just add inline initializers to the new >> fields in microblaze_gdbarch_tdep. Then they'll automatically be >> initialized by the 'new'. >> >> Tom >