public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Bob Rossi <bob@brasko.net>, Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: Optionally print source code to gdb console window
Date: Fri, 10 May 2024 11:19:25 +0100	[thread overview]
Message-ID: <875xvmrmtu.fsf@redhat.com> (raw)
In-Reply-To: <ZjwFq7YupLD9tSZA@zelda>

Bob Rossi <bob@brasko.net> writes:

> On Wed, May 08, 2024 at 09:46:16AM -0600, Tom Tromey wrote:
>> >>>>> "Bob" == Bob Rossi <bob@brasko.net> writes:
>> 
>> >> Perhaps 'set source open' could be extended to have a new value.  Or
>> >> perhaps some other 'set source' sub-option could be made.  I'm afraid
>> >> that normally we bikeshed option names a bit.
>> 
>> Bob> I think it's this behavior of gdb i want to suppress,
>> Bob> https://sourceware.org/gdb/current/onlinedocs/gdb#Source
>> Bob> "When your program stops, GDB spontaneously prints the line where it
>> Bob> stopped"
>> 
>> Bob> I'm looking for a way to control printing source lines when printing
>> Bob> frame information? (I'm modifying do_print_frame_info)
>> 
>> Bob> Something like 'set frame print_source off' might make sense to me.
>> Bob> Just a thought.
>> 
>> How about adding a new value to "set print frame-info"?
>> Like "set print frame-info nothing"?
>
> I saw in the NEWS file,
>     show print frame-info
>       This controls what frame information is printed by the commands printing
>       a frame.  This setting will e.g. influence the behaviour of 'backtrace',
>       'frame', 'stepi'.  The python frame filtering also respect this setting.
>       The 'backtrace' '-frame-info' option can override this global setting.
>
> So i tried out how frame-info impacts the bt command,
>     (gdb) set print frame-info short-location
>     (gdb) n
>     main (argc=1, argv=0x7fffffffe098)
>     (gdb) bt
>     #0  main (argc=1, argv=0x7fffffffe098)
>     (gdb) set print frame-info auto
>     (gdb) bt
>     #0  main (argc=1, argv=0x7fffffffe098) at test_main.cpp:47
>     (gdb) 
>
> The only request i've had, is not to print source lines automatically to
> the console, because cgdb already displays them in a source view.
> This is how cgdb worked with annotations, so people were familiar 
> with that behavior in cgdb, until i upgraded to mi.
>
> I don't think people want gdb's behavior changed under cgdb.
> If they prefer special settings for 'print frame-info', they should
> probably be allowed to keep them and not have cgdb hijack them.
>
> A new option, but separate from the existing frame-info command, as to
> not impact other areas of gdb.
>   set print frame-info-source-line off
> This is very similar to your approach, however, it lets the user choose
> whatever they want with print frame-info, and then it lets cgdb "subtract" the
> source-line printing from the console in only that case (and not bt case).

Have you tried 'set suppress-cli-notifications on'?

This:

  (a) Stops cli (even in new-ui) printing the location when inferior
  execution stops, and

  (b) Stops cli printing the context (stack frame) when the user changes
  the current stack frame (e.g. up, down, frame N, etc).

Now (a) seems like exactly what you want.

Not sure if (b) is what you want or not.  I don't think you mentioned
this, but if you have a GUI which is displaying the source location, you
might also be displaying the stack, in which case you might want (b)
too.

Internally, 'set suppress-cli-notifications on' sets two separate flags,
one each for (a) and (b), so you could potentially implement
sub-commands of 'set suppress-cli-notifications' to control each
component individually, if that is more helpful.

Maybe I've not understood the problem requirements though, so feel free
to ignore me if this isn't helpful :)

Thanks,
Andrew


  parent reply	other threads:[~2024-05-10 10:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-05 20:57 Robert Rossi
2024-05-06 22:18 ` Robert Rossi
2024-05-07 16:52 ` Tom Tromey
2024-05-07 21:33   ` Robert Rossi
2024-05-08  0:52     ` Tom Tromey
2024-05-08  1:29       ` Bob Rossi
2024-05-08 15:46         ` Tom Tromey
2024-05-08 23:07           ` Bob Rossi
2024-05-09 13:58             ` Tom Tromey
2024-05-10 10:19             ` Andrew Burgess [this message]
2024-05-10 18:07               ` Tom Tromey
2024-05-10 19:29           ` Pedro Alves
2024-05-10 19:23     ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875xvmrmtu.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=bob@brasko.net \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).