Re: source annotation now prints source line

Andrew Burgess <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
* Bob Rossi <[email protected]> [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/ec8e2b6d3051f0b4b2a8eee9917898e95046c62f
> > 
> > Now CGDB displays,
> >     (gdb) n
> >     43          int i = 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 front
> > 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.

Thanks,
Andrew
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.