From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 List-Id: --0000000000003082a40617b6b7bb Content-Type: multipart/alternative; boundary="0000000000003082a20617b6b7b9" --0000000000003082a20617b6b7b9 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 >> >> --0000000000003082a20617b6b7b9-- --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 ZGlmZiAtdXJOcCBnZGItMTQuMi5vcmlnL2dkYi9zdGFjay5jIGdkYi0xNC4y L2dkYi9zdGFjay5jCi0tLSBnZGItMTQuMi5vcmlnL2dkYi9zdGFjay5jCTIw MjQtMDMtMDMgMDA6NTU6MDAuMDAwMDAwMDAwIC0wNTAwCisrKyBnZGItMTQu Mi9nZGIvc3RhY2suYwkyMDI0LTA1LTA1IDExOjI3OjA3LjczNTU3NjYyNCAt MDQwMApAQCAtMTE2MSw3ICsxMTYxLDkgQEAgcHJpbnRfZnJhbWVfaW5mbyAo Y29uc3QgZnJhbWVfcHJpbnRfb3B0aQogCSAgICAgIHVpb3V0LT50ZXh0ICgi XHQiKTsKIAkgICAgfQogCi0JICBwcmludF9zb3VyY2VfbGluZXMgK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