From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Konstantin Kharlamov Newsgroups: gmane.emacs.devel Subject: Re: Difficulty using M-x gdb Date: Sat, 04 Feb 2023 00:35:11 +0300 Message-ID: References: <87357pqvxq.fsf@md5i.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29702"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.46.3 To: Michael Welsh Duggan , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Feb 03 22:36:00 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pO3iy-0007XY-N1 for ged-emacs-devel@m.gmane-mx.org; Fri, 03 Feb 2023 22:36:00 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pO3if-00031y-G2; Fri, 03 Feb 2023 16:35:41 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pO3iV-0002w3-1J for emacs-devel@gnu.org; Fri, 03 Feb 2023 16:35:32 -0500 Original-Received: from forward501b.mail.yandex.net ([2a02:6b8:c02:900:1:45:d181:d501]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pO3iP-0001kd-RH for emacs-devel@gnu.org; Fri, 03 Feb 2023 16:35:29 -0500 Original-Received: from myt5-18b0513eae63.qloud-c.yandex.net (myt5-18b0513eae63.qloud-c.yandex.net [IPv6:2a02:6b8:c12:571f:0:640:18b0:513e]) by forward501b.mail.yandex.net (Yandex) with ESMTP id 65C745EDC0; Sat, 4 Feb 2023 00:35:12 +0300 (MSK) Original-Received: by myt5-18b0513eae63.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id BZgcn4pY3Ko1-vzQ88vf0; Sat, 04 Feb 2023 00:35:11 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1675460112; bh=1aAQEduQ63+yfePbAmvRNXmxM9pGJipfiLNZU351fXs=; h=In-Reply-To:Date:References:To:From:Subject:Message-ID; b=DiQVQErtFjDBS+RRZ++UitmefE6QdIploOE1Oz41w+ul1GHVtf9PstmkM/i2dOTzY Ke/13WZjytW5RWZeLHM/64vhwANpsHburd4OYN8mlwIFSGNT3D39GpbQc2e2HOVKEW p3Sa/56Dm3AhGjNKaoynBccns4sNMlPPOZasYjIw= Authentication-Results: myt5-18b0513eae63.qloud-c.yandex.net; dkim=pass header.i=@yandex.ru In-Reply-To: <87357pqvxq.fsf@md5i.com> Received-SPF: pass client-ip=2a02:6b8:c02:900:1:45:d181:d501; envelope-from=hi-angel@yandex.ru; helo=forward501b.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:302936 Archived-At: On Wed, 2023-02-01 at 09:53 -0500, Michael Welsh Duggan wrote: > I have used "M-x gud-gdb" to run gdb for many years.=C2=A0 I used it for > quite a while after the gdb-mi interface was added due to its ability to > debug the same program multiple times at the same time in the same > Emacs.=C2=A0 I don't need that capability right now.=20 >=20 > Due to a bug in `gud-gdb` (#61162) I am trying to switch to "M-x gdb" > instead.=C2=A0 Unfortunately, I can't really figure out how to make this = work > in a way that makes sense to me.=C2=A0 `gdb-many-windows` being nil is th= e > default, and the default should be reasonably easy to use (one would > hope), but I am having the following problem: >=20 > When I step through a program, the interface keeps track of where I am > in the source buffer.=C2=A0 But, when the program produces output, it > replaces the source buffer window with an input/output buffer window > which is dedicated.=C2=A0 The only way I have found out to display the so= urce > buffer again is to use "M-x gdb-restore-windows".=C2=A0 In code that is d= oing > a fair amount of output, this is very tedious. >=20 > What is right way to handle this?=C2=A0 If it requires customization, why= is > customization needed to make this fairly common case work well?=C2=A0 Is > there a way to make output go the interaction buffer?=C2=A0 Maybe most > importantly, this input/output buffer/window doesn't seem to be > mentioned in the Emacs documentation at all. >=20 > I have my suspicions that, once I get used to the new interface, I might > like using it, but right now I'm having difficulty figuring out what > habits I need to relearn. FWIW, I have the following code in my config that fixes the behavior you mention. ;; Force gdb-mi to not dedicate any windows (advice-add 'gdb-display-buffer :around (lambda (orig-fun &rest r) (let ((window (apply orig-fun r))) (set-window-dedicated-p window nil) window))) With that said, neither I think it's a useful default behavior to replace a window with a source code file with the one that shows app output.