From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id aMZRMelqfWluXB8AWB0awg (envelope-from ) for ; Fri, 30 Jan 2026 21:37:29 -0500 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=AxcFnSew; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id B38E71E089; Fri, 30 Jan 2026 21:37:29 -0500 (EST) 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 A06FD1E089 for ; Fri, 30 Jan 2026 21:37:28 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id ECC3F4BA2E37 for ; Sat, 31 Jan 2026 02:37:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ECC3F4BA2E37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1769827048; bh=OBVjtdazvedvUs5aIDerx5yW4nITUd2x1SWu2MdiIV8=; h=References:In-Reply-To:Date:Subject:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=AxcFnSew3WcvD3+bNhvUfic6v50uh5yroNACha4peEA5Tp+Ffw7zMFezPAv6Hz3sm bzBxBLNz4zd9gPOUv4iIlPYplgje8arh0I3fdsN99xgrmOhHfz+3CwyElTsWhIprb1 JPFRQEk5ysrPeTO2OolVCPJDAeMBO9keHePyOg/o= Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id 9A1034BA2E05 for ; Sat, 31 Jan 2026 02:36:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9A1034BA2E05 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9A1034BA2E05 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1769827010; cv=pass; b=q4axjkslkKDKNM4Zw5PkXoVIMITRiZuQU6TSdXHqKp4QgWBflcsfRvHHXMMu0mcaPmHuZOZdU8Vr5TJYa4JQV2NRr4SFFKHGExP+H3y7QeKSuCgBDgRMfumjLsvjiHAJoqTkNEzxemHK5JsQ1Irt3/iIdRWM5fjMPksLfGn0Scw= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1769827010; c=relaxed/simple; bh=VzldVsRGI/VeTw+WdhInktmbtAW/2Lx0wNH5c/bfpz0=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=oM6oIW7O6bXyMcYa1MppIBFUtufJof9bzNRB0DyJLgqaN1+lvjzvBYC4lSSh7pfo8fJ7582OqOefXQ2ND+3pSYu2GVDMjzAhixviVAzdhtoBb4lbmXyZmGfP7t913vPayvUKd8S1vcGBCW67rA81oMH0hsCUFttLMg0twlDiadw= ARC-Authentication-Results: i=2; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9A1034BA2E05 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-b883c8dfb00so649858566b.1 for ; Fri, 30 Jan 2026 18:36:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1769827009; cv=none; d=google.com; s=arc-20240605; b=Y+orBQLL8xmSy1ZzDZlgNU/yYtTXddKhp+EoJPvehF1SPx06nPBL+iWKsX3iYlfcaS KvX7HYAtrI6jjjQlexFwZNe/K6FG6KmRQCBvUn2sS5vT+sz45+sNUxsq/eF/EGe6H6P0 MHC6aoTgAlJ6PK7DCV4IcrAdoUNdQ09/XZQI9zmaeSBbBZcEc+UFgar55lT2DX1lIxJb mPoUgiVLM6hs5feNMKuFeLA/FYOvT0NYVhbdbBzjp/E+zyxA20F6WCek/AjcrDUzSbVT 6aMt9gpJhcvKW0oJK9dBKl+qtOglSP2OgiL+Fg94iww/zfVrD/WSayoUGlbu/uoyPUxV 7rKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=OBVjtdazvedvUs5aIDerx5yW4nITUd2x1SWu2MdiIV8=; fh=7gKd/bFE7BTop9BfWCTwW8BstJas80iEzeKxrwrn5T0=; b=flg73GEVsjzMwvBXxskty65pmM7noq23FtACcGhWM+9dzsz9t1GIC/XvoMlINIHnSY PO15yKHhrPpUNxCRBrof7LxE77puYrP/KZPEVzGsDL9h1g3WEZVlFlcwHiZN7avoJ/vo l/ADgy0/ZN0f9xw4QWg5gNS6jpChnQtwDMqN0yyz43f3jh2a3Gem4iOjKXUiTDi+d2qP TU7XV/0n3uBmC4aMoxsr1n8wfTgpyAZGpNY9DqXAN7is3xFNcTfMPKqPJf3y9FQ6iH0x UnM2aUVJD+Zj+ftDllWwpeFQD4W35ikCaHvV5zBtyyy9cT0CS2Rz3wvwoogL+chH/NpH qqsw==; darn=sourceware.org ARC-Authentication-Results: i=1; mx.google.com; arc=none X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769827009; x=1770431809; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=OBVjtdazvedvUs5aIDerx5yW4nITUd2x1SWu2MdiIV8=; b=UAtxY2Jb+BhkzDoAymIoixD+ttr1LxLoT3Jnagq/HaEA9h1RNvmA8r8FQ5qysXK+w3 IXkXBlhy56LxYBTh8dJMbqoZjySAtmuiFgvKI3q9RrOzqDAYqsBj5/MFNJ1SX5/cneLQ equfNmimGu2y0Kx3I9NFBYZoaZoq2Rcps4oZ+3+yx9kJp746LTS0JoOcRqh9wMSHO4z3 5CuAaNww+hmZx85Y+PGLRwaeMpsLov8UZhi7WowqDZq6vibVLlmuxqWpTKUTBPillmd/ P2j+kWlZw30JTg6BOeG46w2wn81kstUMS1Qy+VDw7D/A6XgP0Ph397LW7dZ4oWgq063B mFrA== X-Forwarded-Encrypted: i=1; AJvYcCVBfu4nQh7WNTFR5eRB/fIXlnmyjPwCDxFHPOEhGD7XzXfzTD5AI3pzw/ZUvIxAfKUouNM=@sourceware.org X-Gm-Message-State: AOJu0YzZWO05zd0p4P+2eLI76auhVXU01cdjaaIjArzATLQW1u3pqwuw x9YGVHyJM37iKaVkwDfIVX/caaOoNo8z6Tnzoo6FXPYiFmoiCcMBsjci+4po7XfBXCF9snUqPTa YouJxRipQAh4DxfHxI9Jk0xrpNbp/DQw= X-Gm-Gg: AZuq6aLV70BFnZwQ+kPld4Ht3rRW4GG6jP0FfxCxTTS+bGjS/4MkOzB5vEPlC8f9+bq KmGc34jiYQviQ7UvwdsY6T+LDEgnfk2Kxz/ij6A1XmGLPV2iyOVbY+Gp65sVxmUnNu3B3//CBnq jRJqEHI79jzyafljm86ODCt+9Gu1csjD4lK4BqIFqZYfaLNcJiEXP6JB65mA9nsFa9eHe+zujAM 2S8qzi5wgtVgBbVwRG3LGAcOlrzKKgeZK8PhngX9lIT1HPL1TQvd1a6r4/s8IMMuNpWWrhCcshp dkn8guQyNKDy+mGNqh2Q+n6J22/okcdBH8gOreI4FLUKICDViC3UZVpZPF+XDJhWqUGecIGqkZK XYIrOKOqO+TYbsaPk3wlNrWpX97/JYdrjKqoBepK8rqS+kO5m8Q== X-Received: by 2002:a17:907:c09:b0:b87:5464:8b5c with SMTP id a640c23a62f3a-b8dff721f5cmr284386766b.63.1769827009280; Fri, 30 Jan 2026 18:36:49 -0800 (PST) MIME-Version: 1.0 References: <06d90d0ef774cf4ffd69a675a9092afee18a3446.camel@starynkevitch.net> <87ikci97xh.fsf@tromey.com> In-Reply-To: <87ikci97xh.fsf@tromey.com> Date: Sat, 31 Jan 2026 02:36:36 +0000 X-Gm-Features: AZwV_QjCED8hmahPexncZw05CPJJ2_8XqB-uQgQo6_h-j5OtOEBzL8_M6Gg9N6M Message-ID: Subject: Re: GDB variants accepting plugins (to the debugger) ? To: Tom Tromey Cc: Basile Starynkevitch , gdb@sourceware.org, team@refpersys.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Matt Rice via Gdb Reply-To: Matt Rice Errors-To: gdb-bounces~public-inbox=simark.ca@sourceware.org Sender: "Gdb" On Fri, Jan 30, 2026 at 8:13=E2=80=AFPM Tom Tromey wrote: > > >>>>> "Basile" =3D=3D Basile Starynkevitch wri= tes: > > Basile> But coding manually a Python or Guile function for every > Basile> important C++ classes of a software is very time consuming > > People often bring up the idea of using helper functions from the > inferior for pretty-printing. And maybe it can be done, kind of. > > But normally I push back against this idea for a few reasons. > > Internally this means making an inferior call in gdb. But, gdb will use > pretty-printers in all situations, including when unwinding the stack. > This might work but its somewhat problematic to modify the stack while > unwinding it. > > A related thing is that infcalls are sometimes very surprising. For > instance unless you mess with scheduler-locking, they cause other > threads to run. So, e.g., you could easily hit a breakpoint when > printing a variable. > > Finally, this approach doesn't work at all for core files. > > A somewhat better idea is to have the compiler spit out some IR (wasm is > often suggested) for these pretty-printers (and accessor functions and > whatever else) and then have gdb run this. This would be great but > nobody has ever done the work... I did once consider doing this with a > gcc plugin and having it generate Python but time is kind of short. > Yeah, I've thought wasm based pretty printers could be really cool, especially for languages that already include debug based pretty printing c= ode, writing separate python pretty printers always seems like a bunch of extra = work. I suppose that one of the big hurdles is the standardization of something l= ike the component model, https://component-model.bytecodealliance.org/ I don't really know enough about wasi/the component model yet to know how much of an impact changes to the component model would impact gdb (because it currently is a work in progress and isn't fully standardized afaik so subject to changes). Anyhow I would be/have been somewhat interesting in putting in time/effort into working on this sort of building out wasm inspired by parts of the python API, but it feels like you'd probably want to put a big experimental sticker on it in the sense that it could end up with some component-model upstream change which in theory may mean that the bytecode compiled pretty printer may be tied to a particular version gdb using whatever version of the component model. In the same sense that we currently rely on a python version (with the difference being that python is much longer history of stabilization than the component model which) So in my opinion there is a little more to it than just putting in the work, there is a lot less prior art than python modules. Perhaps it would be best to start out with configure option not enabled by default, with the understanding that it is currently experimental. something like --enable-experimental-wasm-plugins or some such. Anyhow I would be excited to play around with it some if there was a roadmap for how we want to handle these issues... > Basile> I regret that GDB 17.1 has not evolved into something similar to > Basile> the old and unmaintained UPS open source debugger > Basile> https://ups.sourceforge.net/ which sadly is not working on > Basile> Linux/AMD-64 computers running a recent kernel 6.17 and and > Basile> using recent libc and libstdc++ > > I don't have much to suggest other than you can already do a lot with > Python in gdb. For instance I wrote a gdb GUI that runs in-process. > > Most of the gdb Python code you'll find in the wild will be > pretty-printers; gdb has some of these for itself. libstdc++ has some > xmethods and sometimes you'll stumble across a frame filter; and there's > at least one unwinder out there. > > There's some links here > > https://sourceware.org/gdb/wiki/ExtensionsInPython > > Tom