From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ejP9AJmnN2aFEAcAWB0awg (envelope-from ) for ; Sun, 05 May 2024 11:36:57 -0400 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=brasko-net.20230601.gappssmtp.com header.i=@brasko-net.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=dy31qpam; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id E3E431E0C1; Sun, 5 May 2024 11:36:56 -0400 (EDT) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (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 9AB141E092 for ; Sun, 5 May 2024 11:36:54 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8A6093858D33 for ; Sun, 5 May 2024 15:36:53 +0000 (GMT) Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by sourceware.org (Postfix) with ESMTPS id 722DE3858D28 for ; Sun, 5 May 2024 15:36:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 722DE3858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=brasko.net Authentication-Results: sourceware.org; spf=none smtp.mailfrom=brasko.net ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 722DE3858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::12a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714923390; cv=none; b=iReHKE+V4smPtMho5EymuiRYkQbeQuL5EJkjwiL0A0nst8EsBu4OaBYzejtLf0pXRVncCxl0hpcSxcygi4n+ArgvHyYNSeBWEjRp6ebtf1gZ/5ZFzTVPc6e6jpXM9cus8xIPdTsPvsZ6mGAq6xJCbtREwEuPjUzteFmJEDFl+qA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714923390; c=relaxed/simple; bh=iQCkBYjWR7EzH+qwrurkdtTk951g88+482u4gYH7bR8=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=c3hYufYq0rIQtT29ckjG4009MBUdR36/71g7Z2c5kYpEqrr1Xi75LCmr1PJEV8cjIebiP6dvI54dMA0XSB545OWv2Z30nI2kkoevmBV0tRRriL1IaMTuuMQVRf4TTFgwjuqpzzgSI2TPHKjymqgVxZXhP/zASo3c0r6GeXM45R0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-51f2ebbd8a7so1305013e87.2 for ; Sun, 05 May 2024 08:36:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasko-net.20230601.gappssmtp.com; s=20230601; t=1714923385; x=1715528185; darn=sourceware.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=JPgNnhPuX/b7w96Sgc++cWBB6EPmQ3kdoE/gTQAULWY=; b=dy31qpamwy2Zce+ifSKOom5fE2b8EMdzZoJZum/OAjkU0qxYSRIs+LXbXdj7kO+Um8 gPfmpsEr3cbXOmLfs6yGWXveTwnU7BkuEfe1Vb21Mq7Os8sQzJuwIAjTWQU/umKqbgro 8LCyZT5c2D3Kd35xOGslbTt0z7HqEDHgiUtOaBaGtD6WfL9PHwaDrpEaQnhrPKJtbcum 1dU9EGcMQHmKwThUGrw+NjTxwkgNBpJeMYNKvUfmIUxhYTdkySTv/OMQz7AGF6uephxS kYlnjxSvMOy/Sf2kupOgGcnc2Oa9gFiENmN5m7Vwc/VTWqqXXCq6tjmojh5Pz7iLkS15 V/uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714923385; x=1715528185; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=JPgNnhPuX/b7w96Sgc++cWBB6EPmQ3kdoE/gTQAULWY=; b=MwV70Ju7SoJPsx6WlNiePppqTrQrH26zU1vXyCE+4ztfa0qiY+bFJOFRAxTZiSPfyu 2/z0Q7Zc+SGm2gE6lZE6N8xnvlt8CaTp8agA7YJKFIlk5Bfpz9qFAKplxWVM/Xloc7VK VAZqmnyuv23IzcpStBDVK8aKhM9cRAP58btTMZQiUi9z1+ZuHcLsC++t6JOraknlhZF+ s5A+mnvcGwthZOTN7yxpWNSZxKCHno/nL6wW7dPypJILrZlRYHMh2Pd+X52JLpTx/yzl r5Dd5kOp8Hz+pVcI2g335rEtj2vK2K0DbQuDL2U16QcuYnZq5PCnHnLhxv1Oh81IC87F 4V9w== X-Gm-Message-State: AOJu0YzlIdkvKHjS3rDAnlQKRwDONAV0UlvqiUW9jFkSH+SBpNt18Si+ pynAG2IIujtixLiHy29EW5gcO1TfjVMAXur9DX6fcmwCR8iDMc2LmI+l/47vKxYMigkKE5IDuaQ wwHH5LYD3DFVeaHL6c/wB/rIWhFfyso54GJd9aOadF+wMNKYxwhc= X-Google-Smtp-Source: AGHT+IEljwsUIqnnThMJPAsCUvd/21Q/UoW37pkTGE8DiswdkhVmdlP0X2oRoTvObQfMr39gI3uYQUpPJ5ZVs9PNOB8= X-Received: by 2002:a05:6512:1395:b0:520:5261:9cd0 with SMTP id fc21-20020a056512139500b0052052619cd0mr1402901lfb.57.1714923385145; Sun, 05 May 2024 08:36:25 -0700 (PDT) MIME-Version: 1.0 References: <20200404235424.GB5321@xubuntu.brasko.net> <20200414112304.GB22764@xubuntu.brasko.net> <20200414121705.GD2366@embecosm.com> <20200415021324.GB31494@xubuntu.brasko.net> <20200416174128.GA1633140@embecosm.com> <20210313170028.GA7813@xubuntu.brasko.net> <6f609020-19f6-3e47-3c3f-f268e4600b43@redhat.com> In-Reply-To: From: Robert Rossi Date: Sun, 5 May 2024 11:36:13 -0400 Message-ID: Subject: Re: source annotation now prints source line To: GDB Development Content-Type: multipart/mixed; boundary="0000000000003082a40617b6b7bb" X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-Content-Filtered-By: Mailman/MimeDel 2.1.30 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: , Errors-To: gdb-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb" --0000000000003082a40617b6b7bb Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I've created and attached a patch that might achieve the desired goal. Could I have some feedback? I've added a new print source option to control printing source code to the gdb console. (gdb) show print source Printing of source code to gdb console is on. You can turn the printing of the source code off as follows. (gdb) set print source off (gdb) When the printing of source code is on, (gdb) r Starting program: /home/bob/rcs/git/gdb/gdb-build/main .... Breakpoint 1, main (argc=3D1, argv=3D0x7fffffffe0c8) at test_main.cpp:42 42 { (gdb) n 43 int i =3D 3; (gdb) n 44 int j =3D 4; (gdb) n 47 long_func(); When the printing of source code is off, (gdb) r Starting program: /home/bob/rcs/git/gdb/gdb-build/main ... Breakpoint 1, main (argc=3D1, argv=3D0x7fffffffe098) at test_main.cpp:42 (gdb) n (gdb) n (gdb) n (gdb) I don't know gdb code well enough to understand if i've disabled functionality beyond what i was hoping to. I'm not sure how to control this from cgdb when using old versions of gdb. I get the following error when i run --ex "set print source off" when starting gdb. Undefined set print command: "source off". Try "help set print". Thanks, Bob Rossi On Sat, May 4, 2024 at 4:09=E2=80=AFPM Robert Rossi wrote: > Sorry to respond to an ancient thread. I thought the context might be > helpful. > > I've been happily using the mi new-ui feature from gdb in cgdb for quite = a > while. > Occasionally, I get people unhappy with gdb printing code out to the > console when stepping through code. > > Here is an example, > https://github.com/cgdb/cgdb/issues/336 > Here is another example, > https://github.com/cgdb/cgdb/issues/223 > > In the past, it was expressed by Pedro (i believe) that this was a featur= e. > You can see from the requests some people do not want to see the code in > the console. > That's because they already see it more clearly in the code view. > > Can we consider disabling this behavior or making it optional somehow? > Thoughts? > > Thanks, > Bob Rossi > > On Mon, Mar 15, 2021 at 9:10=E2=80=AFAM Pedro Alves w= rote: > >> On 13/03/21 17:01, Bob Rossi wrote: >> > On Thu, Apr 16, 2020 at 06:41:28PM +0100, Andrew Burgess wrote: >> >> I'll take a look to see if there's a good way to give you the >> >> functionality you're looking for and close the bugs off. >> > >> > Thank you for doing this Andrew, I appreciate it. >> > >> > Ironically, I just upgraded CGDB to no longer use annotations. >> > I'm moved it from annotations to gdb/mi, in the same way that >> > Eclipse uses MI, by using the new-ui feature of gdb. Now i see the >> > source linse are still visible in the console. gdb doesn't know >> > to not show them in this mode. >> > >> > To recap, >> > - cgdb using annotations does not show code in console >> > - cgdb using mi using new-ui does show code in console >> > - gdb tui does not show code in console >> > - eclipse probably shows code in console, as it uses mi and new-ui >> > >> > Would it be to much to ask that if new-ui is being used, that we >> > assume a front end is being used, and not display the code in the >> console? >> > >> > I've CC'd Pedro and Marc as I believe they may be the relevant people = to >> > have an opinion on how this would impact eclipse. >> > >> >> A driving idea behind the new-ui work was that the CLI running inside >> the console window would work exactly like a GDB running on a terminal. >> >> It should be possible even to start a GDB on a terminal, and then spawn = a >> separate Eclipse GUI connected to the GDB running on the terminal, still >> outside >> Eclipse, like a "launch-gui" command or some such written in python that >> would spawn eclipse and have it connect to gdb with new-ui. I don't >> know whether >> anyone ever implemented this in Eclipse, but it was a consideration in t= he >> original design. It isn't clear to me that in this scenario you would >> not want >> print the source line in the console. I think I would want it. >> >> Also, while the new-ui feature was originally designed alongside Eclipse= , >> it has >> potential for more usecases. A secondary MI channel could not be >> displaying any >> GUI at all, for example. >> >> I think that if you want to make GDB not print source lines, then that >> should >> be a separate option. >> >> Thanks, >> Pedro Alves >> >> --0000000000003082a40617b6b7bb Content-Type: text/x-patch; charset="US-ASCII"; name="sourceprint.diff" Content-Disposition: attachment; filename="sourceprint.diff" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_lvtp3ak50 ZGlmZiAtdXJOcCBnZGItMTQuMi5vcmlnL2dkYi9zdGFjay5jIGdkYi0xNC4yL2dkYi9zdGFjay5j Ci0tLSBnZGItMTQuMi5vcmlnL2dkYi9zdGFjay5jCTIwMjQtMDMtMDMgMDA6NTU6MDAuMDAwMDAw MDAwIC0wNTAwCisrKyBnZGItMTQuMi9nZGIvc3RhY2suYwkyMDI0LTA1LTA1IDExOjI3OjA3Ljcz NTU3NjYyNCAtMDQwMApAQCAtMTE2MSw3ICsxMTYxLDkgQEAgcHJpbnRfZnJhbWVfaW5mbyAoY29u c3QgZnJhbWVfcHJpbnRfb3B0aQogCSAgICAgIHVpb3V0LT50ZXh0ICgiXHQiKTsKIAkgICAgfQog Ci0JICBwcmludF9zb3VyY2VfbGluZXMgKHNhbC5zeW10YWIsIHNhbC5saW5lLCBzYWwubGluZSAr IDEsIDApOworICAgICAgCisgICAgICAgICAgaWYgKG9wdHMuc291cmNlcHJpbnQpCisgICAgICAg ICAgICAgIHByaW50X3NvdXJjZV9saW5lcyAoc2FsLnN5bXRhYiwgc2FsLmxpbmUsIHNhbC5saW5l ICsgMSwgMCk7CiAJfQogCiAgICAgICAvKiBJZiBkaXNhc3NlbWJsZS1uZXh0LWxpbmUgaXMgc2V0 IHRvIG9uIGFuZCB0aGVyZSBpcyBsaW5lIGRlYnVnCmRpZmYgLXVyTnAgZ2RiLTE0LjIub3JpZy9n ZGIvdmFscHJpbnQuYyBnZGItMTQuMi9nZGIvdmFscHJpbnQuYwotLS0gZ2RiLTE0LjIub3JpZy9n ZGIvdmFscHJpbnQ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