From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by sourceware.org (Postfix) with ESMTPS id 16289385BF83 for ; Tue, 14 Apr 2020 12:57:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 16289385BF83 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=andrew.burgess@embecosm.com Received: by mail-wm1-x342.google.com with SMTP id z6so13855840wml.2 for ; Tue, 14 Apr 2020 05:57:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=2sGTeMszkeXcId7F/hrpUoqD0gp4GUTlMtqrLdMsKgk=; b=R3e2HgsW/1/5CZzIgq5Ala82kDgifNC5dufzOyF3m5hFDaAKqt8KN4xm8TyzaY2m5Y 4+kFfuWRhkPGiYg7oi1wZBjNO5H5AyvNZQWdqwUaM2PlfAMbzTxhmfGHzJCE8X2XfaZQ hArEYnja0Lp/fU6wU7EXrkJ6Yp5fpm/YsD7i3JyW1FdjfLte+b7PKwAgxWj1El5+ZmAs cb7TAsPga48o9hwDmNMjjFEv/EGgT3DOTx65EMEZELO0MQIad6PKsqg898Pdz0oBmLNl XLcMcTJr76tJUXiN3Li0rQDjxU5eAPNPgqfOp/fmE7UwcA/E1S/0XqfIBpPHhBA9mphM lhjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=2sGTeMszkeXcId7F/hrpUoqD0gp4GUTlMtqrLdMsKgk=; b=cjZJUlj7zY8kBEdy/+dL4OKX2gpMMYoOZXLhrJKEsmzLTARqXAbPiHoNk89D5BCqZh bXsPNNI6yLrPgJCS+UGEsokf3KWz54kiLQwyZn05cpJzPwkbCe1dIiM9hFldtKe88yJ7 54kSBoclQqM2xh0V5zAUnJgANcyF3AoUB+WntV+Krp+1rue6x7NGW3LKo5/V5rF4oJG+ Ub0wVVGZeI6LRAcsd/yCG3RwOCkFLR/WQgHmgMIFg9LsakwZp5uTgoKD64GytP01Hb4A uBcMgDlCYnxziuItKPbw4SlFNpF0A+i2gUktTs3ag9TgnYYcWIEGVwh0bFysusPrJ6na AfJw== X-Gm-Message-State: AGi0PuZW1xjn/WgCx0cZ3v8PhIENgg1mzUB1DWYRktKzQHLFE53ADJik iAJbYc/bRhu6r8N02WQCTgAqHw== X-Google-Smtp-Source: APiQypJ+fXXcoEqjVVVUvFbNG1WSzZ7ZxkX+7clTwoo5f1+cqKv/LPBEtrKVVw2idJ5Xl8+MmC+J2A== X-Received: by 2002:a1c:6402:: with SMTP id y2mr16043417wmb.116.1586869034985; Tue, 14 Apr 2020 05:57:14 -0700 (PDT) Received: from localhost (host81-151-181-184.range81-151.btcentralplus.com. [81.151.181.184]) by smtp.gmail.com with ESMTPSA id q143sm19634274wme.31.2020.04.14.05.57.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Apr 2020 05:57:14 -0700 (PDT) Date: Tue, 14 Apr 2020 13:57:13 +0100 From: Andrew Burgess To: Bob Rossi Cc: gdb@sourceware.org Subject: Re: source annotation now prints source line Message-ID: <20200414125713.GE2366@embecosm.com> References: <20200404235424.GB5321@xubuntu.brasko.net> <20200414112304.GB22764@xubuntu.brasko.net> <20200414121705.GD2366@embecosm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20200414121705.GD2366@embecosm.com> X-Operating-System: Linux/5.5.13-200.fc31.x86_64 (x86_64) X-Uptime: 13:45:35 up 6 days, 4:00, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Apr 2020 12:57:17 -0000 * Andrew Burgess [2020-04-14 13:17:05 +0100]: > * Bob Rossi [2020-04-14 07:23:04 -0400]: > > > On Sat, Apr 04, 2020 at 07:54:24PM -0400, Bob Rossi wrote: > > > When the source annotation is sent to the front end, the source line > > > is now also sent to the front end console. I believe this commit > > > introduced it, > > > https://github.com/bminor/binutils-gdb/commit/ec8e2b6d3051f0b4b2a8e= ee9917898e95046c62f > > > > > > Now CGDB displays, > > > (gdb) n > > > 43 int i =3D 3; > > > (gdb) > > > > > > Instead of, > > > (gdb) n > > > (gdb) > > > > > > CGDB is a front end, and so it has a source view to display the code = to > > > the user. Why did GDB decide to also print the line of code to the fr= ont > > > end's console window as well? This is confusing. > > > > The concept behind this commit seems incorrect. > > > > The motivation for the patch isn't clearly explained in > > the commit message. I believe I've given a reasonable explanation > > on why this patch makes no sense for front ends. > > > > Should I submit a patch reverting it? > > The patch in context is discussed here: > > https://sourceware.org/pipermail/gdb-patches/2019-June/158310.html > https://sourceware.org/pipermail/gdb-patches/2019-June/158350.html > https://sourceware.org/pipermail/gdb-patches/2019-June/158351.html > https://sourceware.org/pipermail/gdb-patches/2019-June/158352.html > https://sourceware.org/pipermail/gdb-patches/2019-June/158353.html > > I'm not sure you've convinced me yet that the idea behind the patch is > incorrect. Annotations should be a (deprecated) way for F/Es to parse > GDB's output, but they shouldn't impact _what_ GDB prints. > > In this particular case, printing the source line actually updates > some internal state, which impacts how later commands operate. What > this means is that the users session will behave differently if they > have annotations on than when annotations are off. > > I guess, what I don't understand is that if a F/E wants to hide a > particular piece of the output, why can't it just strip that from the > output stream? The F/E must already be removing the annotation > markers, so all the output must be going through the F/E anyway. > > Further, removing this particular piece of output makes sense for this > F/E, but is it always going to be true for all F/Es? > > I haven't gone back and looked at the old behaviour, maybe I'll have > more thoughts once I've looked at that again. For the record, here's GDB's output before the patch (8.3.1): ## START ## Temporary breakpoint 1, main () at hello.c:6 6 printf ("Hello World\n"); (gdb) set annotate 0xff =EF=BF=BD=EF=BF=BDpre-prompt (gdb) =EF=BF=BD=EF=BF=BDprompt n =EF=BF=BD=EF=BF=BDpost-prompt =EF=BF=BD=EF=BF=BDstarting Hello World =EF=BF=BD=EF=BF=BDsource /home/andrew/tmp/hello.c:7:62:beg:0x401134 =EF=BF=BD=EF=BF=BDstopped =EF=BF=BD=EF=BF=BDpre-prompt (gdb) =EF=BF=BD=EF=BF=BDprompt ## END ## And here's the output after the patch (9.1): ## START ## Temporary breakpoint 1, main () at hello.c:6 6 printf ("Hello World\n"); (gdb) set annotate 0xff =EF=BF=BD=EF=BF=BDpre-prompt (gdb) =EF=BF=BD=EF=BF=BDprompt n =EF=BF=BD=EF=BF=BDpost-prompt =EF=BF=BD=EF=BF=BDstarting Hello World =EF=BF=BD=EF=BF=BDsource /home/andrew/tmp/hello.c:7:62:beg:0x401134 7 return 0; =EF=BF=BD=EF=BF=BDstopped =EF=BF=BD=EF=BF=BDpre-prompt (gdb) =EF=BF=BD=EF=BF=BDprompt ## END ## I guess I'd still suggest that the "right" thing would be to strip the output when processing GDB's output. But, if you strongly disagree then you could put forward a patch for discussion. However, I think you'd need to do more than revert the original patch. If you look inside source.c:print_source_lines_base then you'll see the current source line and symtab being updated. This is done as part of printing the '7 ..... return 0' line. If you'd going to stop this being printed, then you'd need to duplicate this behaviour somewhere else, so that the current line/symtab are updated when annotations are on. Thanks, Andrew