From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id oe8gLPCbd2lmTxYAWB0awg (envelope-from ) for ; Mon, 26 Jan 2026 11:53:04 -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=Pl2UiKub; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id B18711E08D; Mon, 26 Jan 2026 11:53:04 -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 1B0ED1E08D for ; Mon, 26 Jan 2026 11:53:04 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id B0D204BA2E21 for ; Mon, 26 Jan 2026 16:53:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B0D204BA2E21 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1769446383; bh=hX265JoF2zrhuR0xvv4IfLR3XXzzkQMxj67B2YbYigM=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Pl2UiKubH7BpVRiXTLYZToLgWjlIe8PmfknWfGgI07/GS4O8zDz9ji8tW9qpChMTD ZSL5rm3EYYQRO2jrauq46IO8jJEX3DuRnBgCNCwL3I8AUi06AyymD9p4soKt3rp8hs 8coT3M13mbMdNVub0LVWdVamTmXNHpT1qXkOr2fk= Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id B12284BA2E06 for ; Mon, 26 Jan 2026 16:52:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B12284BA2E06 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B12284BA2E06 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1769446349; cv=none; b=B31FB1Pf11vIfYSI2ofmeoVjD9hL79MkVgmTlCN3A1J7rslGlmb50SoSj4z5EaY6u7YdCIWPmM0o8lqEVC2v5zAYBQfxXeU2xaU8n9GWucx7MD+RXuyc34z36Mj9n9yBRLKz+In3cskyFlMgxMTs12Ns7RJ25cqcIPRE0YuG754= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1769446349; c=relaxed/simple; bh=9q49pCrM2JKF8iQQmPXtMLJkILt+r1kvWRxXuXJpNCw=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=kEbdhWBWnFqVbQ+7T7jdfGj36EZlZOcmUcFs/zfPT5IP4RcB6RP9ObFYFSOpw4oyRL8XQOusEZ9Nzo0qi/Wxa8mA8cBLjsMZHhmNx8YyF1Ei4cjLn9CADV3QzxbIjoiehz5Khqr4PP+zLxSWRJKl1pl7FuWkETF1/dOpS/R6cGw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B12284BA2E06 Received: by simark.ca (Postfix) id 19DC01E08D; Mon, 26 Jan 2026 11:52:29 -0500 (EST) Message-ID: <22882514-250f-42c9-8b6e-771966e9c3b9@simark.ca> Date: Mon, 26 Jan 2026 11:52:28 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: seeking open source examples of GDB scripting To: Basile Starynkevitch , gdb@sourceware.org References: <631f016aca22712c52b3718cb2cd43c496a3e9f7.camel@starynkevitch.net> Content-Language: fr In-Reply-To: <631f016aca22712c52b3718cb2cd43c496a3e9f7.camel@starynkevitch.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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: Simon Marchi via Gdb Reply-To: Simon Marchi Errors-To: gdb-bounces~public-inbox=simark.ca@sourceware.org Sender: "Gdb" On 1/18/26 2:01 PM, Basile Starynkevitch wrote: > Hello all, > > I am seeking open source examples (or tutorials, given that I am unfamiliar with Python) of GDB scripting. > > Since I have a naughty bug : https://github.com/RefPerSys/RefPerSys/issues/30 > > The scripting could be in GNU guile (I much prefer that language). I'm sure there are good examples of real-world scripting out there, on github or otherwise, but I don't have good examples in mind. The Guile API is unfortunately not as maintained as the Python one, so it's missing features compared to the Python one. And even the Python API is missing some key things, people just add whatever they need. > For example, I would like to automatically add a breakpoint to every line calling the RPS_POSSIBLE_BREAKPOINT() macro > That macro is nearly a no-op one defined in https://github.com/RefPerSys/RefPerSys/blob/19f01d3783c9f727980f21fc2c66db4837745b61/refpersys.hh#L1335 I don't think it's possible for GDB by itself to figure out the "call sites" of a macro. But you could perhaps modify your RPS_POSSIBLE_BREAKPOINT_AT macro to include a call to a dummy/empty function, and put a breakpoint on that. That wouldn't require using the Python or Guile API. Otherwise, I see that your macro defines some symbols of the form: "__" RPS_BASENAME "_brk_" #Lin You could try the rbreak command to try to put a breakpoint on all symbols matching a given regex pattern. But that only works if the symbol is visible to gdb, I'm not sure it will be. You might need to make it ".global", I don't know. Simon