public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/30771] New: GDB need a silent thread-selecting command akin to "select-frame"
@ 2023-08-16 15:41 moshe.rubin at gmail dot com
  2023-08-16 17:37 ` [Bug cli/30771] " tromey at sourceware dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: moshe.rubin at gmail dot com @ 2023-08-16 15:41 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30771

            Bug ID: 30771
           Summary: GDB need a silent thread-selecting command akin to
                    "select-frame"
           Product: gdb
           Version: 8.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: moshe.rubin at gmail dot com
  Target Milestone: ---

Problem Description
===================
GDB enables users to select threads and frames from the gdb command line prompt
using the "thread n" and "frame n" commands.  When used, these commands display
output to the display, e.g.:

<snippet>
(gdb) thread 2
[Switching to thread 2 (Thread 0x155538885700 (LWP 8875))]
#0  0x0000155552be3aa8 in hack_digit (p=0x155538882480) at printf_fp.c:175
175     printf_fp.c: No such file or directory.
(gdb)

(gdb) frame 1
#1  __GI___printf_fp_l (...) at printf_fp.c:962
962     in printf_fp.c
(gdb)
</snippet>

GDB also supports the "up" and "down" commands for selecting a frame relative
to the currently selected one.  Like "frame n", they also display output to the
screen.

Thankfully, gdb has a silent version of "frame n", i.e. "select-frame n":

<snippet>
#0  0x0000155552be3aa8 in hack_digit (p=0x155538882480) at printf_fp.c:175
175     in printf_fp.c
(gdb) select-frame 1
(gdb)
</snippet>

The value of this silent selection command cannot be overstated.  It enables
complex custom commands to make many frame selections without producing display
"noise" as an artifact.

The problem is that there is no analog for silently selecting threads.  No
matter how one tries, it is impossible to select a thread without getting
unwanted output on the display.  Playing with logging commands, set commands,
and the like do not help.  Here is an example of a custom command run that
executes "thread n" commands internally, producing a messy display output:

<snippet>
(gdb) custom_command
[Switching to thread 3 (Thread 0x155555354b00 (LWP 16327))]
#0  0x0000155554019ad3 in ...
[Switching to thread 4 (Thread 0x15553084e700 (LWP 13823))]
#0  std::_Hashtable<std::pair< ... (5 lines of output)
[Switching to thread 5 (Thread 0x155532695700 (LWP 8874))]
#0  0x0000155552ca5947 in ...
[Switching to thread 6 (Thread 0x155551a19700 (LWP 16826))]
#0  0x0000155554019ad3 in ...
[Switching to thread 1 (Thread 0x155538844700 (LWP 8876))]
#0  __GI_raise (sig=sig@entry=6) at ...
[Switching to thread 2 (Thread 0x155538885700 (LWP 8875))]
#0  0x0000155552be3aa8 in ...
</snippet>

Request
=======
Can a silent gdb-prompt thread-selecting command (e.g., 'select-thread') be
added to the already existing 'select-frame'?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-05-08 18:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-16 15:41 [Bug gdb/30771] New: GDB need a silent thread-selecting command akin to "select-frame" moshe.rubin at gmail dot com
2023-08-16 17:37 ` [Bug cli/30771] " tromey at sourceware dot org
2023-08-16 17:58 ` [Bug cli/30771] GDB needs " moshe.rubin at gmail dot com
2023-08-16 18:15 ` moshe.rubin at gmail dot com
2023-08-16 22:27 ` tromey at sourceware dot org
2023-08-17  7:20 ` moshe.rubin at gmail dot com
2023-08-17 13:00 ` tromey at sourceware dot org
2023-08-18 12:08 ` moshe.rubin at gmail dot com
2024-05-08 18:47 ` tromey at sourceware dot org

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).