From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id vZI0JxA/L2lkiBEAWB0awg (envelope-from ) for ; Tue, 02 Dec 2025 14:33:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1764704016; bh=zA8ExqzJI2jPpf6WHqD8wLGPkuEIEIOqxBqbuxiTWQc=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Bs4GcIKE7a8M2ksB0RdZ18NeA3ZoMEPQh3fTgG9w29tfJerdhxGY/8NxtIM6vdZan ZKZtJUR5v5iNnE3aZ1bfhzaVuYRX1BFjTBwwGeHW76g75Ez7+ggzTLtvFVCfEKTY0b 6NWi1CENFG3w3HM5IlRygGJ5TBk+KZPu5aym4tvY= Received: by simark.ca (Postfix, from userid 112) id 90ABD1E0B3; Tue, 02 Dec 2025 14:33:36 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=no autolearn_force=no version=4.0.1 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=xNRICIpF; dkim-atps=neutral Received: from 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 108371E08D for ; Tue, 02 Dec 2025 14:33:36 -0500 (EST) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8DD884BBCDAC for ; Tue, 2 Dec 2025 19:33:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8DD884BBCDAC Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=xNRICIpF Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 926AA4BB58E4 for ; Tue, 2 Dec 2025 19:33:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 926AA4BB58E4 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 926AA4BB58E4 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1764703989; cv=none; b=LjPsr3b9RcY0aNMrxYTM1DOw7EQcFa2RkUQME0MDTVUjitvviz/DuiB9XIQsJQQtJsMCTI34Q0S06FOTWnrUVN00psGW/B1/tttxnuGPVNGidgGmQOZ/ZY03tr+WcRNzoNBVNUkKFOa2tbrvHrcccHcg7vbAT/fr6sLc+MU037M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1764703989; c=relaxed/simple; bh=zA8ExqzJI2jPpf6WHqD8wLGPkuEIEIOqxBqbuxiTWQc=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=EtcHAVHeOZSuono8CHfArBIAPxgx2mNM6kngoOsYlwRDrJcLVbz8vFm5MaG5T570gqgh83ZocjD/l/B4meV/DkdekLvOQy1AkpPVelc/fGlmc6CskAPR/UULwsGxd9ChaYy5JL7uLQl6DowiKV7js5oVuOnM9QyJgRPhzyCW+HI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 926AA4BB58E4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1764703989; bh=zA8ExqzJI2jPpf6WHqD8wLGPkuEIEIOqxBqbuxiTWQc=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=xNRICIpF131OSBUJR+1YdzYJfBDDZdQ+jb+bnT/DowN0knBKv5kIndZvJY8Np5bP9 WJLyW7BVmOII5OZqTSwXfSqWTopZpd3wbIJ0+MMrarxE13b4Fl7wqmZH9lfAqLP7kh sxjSVIWVmHBE5p1v/2UpxRnuvyWc/tYPLcSyvuD8= Received: by simark.ca (Postfix) id 1A5951E08D; Tue, 02 Dec 2025 14:33:09 -0500 (EST) Message-ID: Date: Tue, 2 Dec 2025 14:33:08 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] gdb: add tutorial command To: Eli Zaretskii , Guinevere Larsen Cc: gdb-patches@sourceware.org References: <20251201170819.1573624-1-guinevere@redhat.com> <864iq93qyw.fsf@gnu.org> Content-Language: fr From: Simon Marchi In-Reply-To: <864iq93qyw.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 On 12/2/25 9:20 AM, Eli Zaretskii wrote: >> From: Guinevere Larsen >> Cc: Guinevere Larsen >> Date: Mon, 1 Dec 2025 14:08:19 -0300 >> >> Before this commit, there is little way for a new user to learn how to >> use GDB on their own. The documentation contains an example session, >> but that isn't contained in GDB itself, and the "help" and "apropos" >> commands exist, but they aren't the best to really teach what GDB can >> do, only to describe commands on their own. >> >> This commit changes this by introducing a command called "tutorial", >> which takes a page out of common design from the last few decades and >> provides a self-contained tutorial for users, walking them through a >> simple bug in C code, and explaining several commands in context. > > Thanks. It's a very good idea to have an interactive tutorial, but I > suggest we discuss a few alternatives for implementing it before > diving into the details. > > First, writing this command in Python means that GDB without Python > will not have a tutorial, which is IMO a pity. Is it so complicated > to have this implemented in C++ instead? The text and the basic > script of the tutorial session could be on a text file that code > accesses when the tutorial is running, so that only the necessary > stuff needs to be in code. If possible, it would indeed be nice, but I'll take a tutorial written in Python over nothing. Maybe an advantage to have it in C++ is that it could be better integrated in the event-loop / command system. I haven't look at the current implementation in depth, but from what I see, it grabs textual user input and passes in through gdb.execute. This means that things like tab completion and readline shortcuts won't work. I think that tab completion at least would be nice to demonstrate in the tutorial. > Next, I'm not sure we need to compile a program for this purpose. We > could use the GDB executable itself instead: that would allow us to > show the basic commands without the need for the user to have a > compiler and a working development environment to go with it. I don't see how that's feasible or practical. The GDB binary users are most likely to have are optimized (bad debugging experience, especially if you're learning) and won't have debug info anyway. And like Guinevere said, GDB is way too complicated to throw at newbies anyway. I like Guinevere's idea of giving the user a small program they can toy with. > > Also, a tutorial doesn't have to teach people how to debug, it could > only teach them the important GDB commands to use for debugging. > Doing both makes the tutorial more complex because it teaches two > non-trivial subjects instead of just one. > > What do others think? I don't understand your last point. Do you mean that the tutorial should just be some text that says "you can use command X to do this, command Y to do that, etc"? Seems way less interesting and interactive than what is proposed here. Simon