public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "moshe.rubin at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/30771] New: GDB need a silent thread-selecting command akin to "select-frame"
Date: Wed, 16 Aug 2023 15:41:53 +0000 [thread overview]
Message-ID: <bug-30771-4717@http.sourceware.org/bugzilla/> (raw)
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.
next reply other threads:[~2023-08-16 15:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-16 15:41 moshe.rubin at gmail dot com [this message]
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
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=bug-30771-4717@http.sourceware.org/bugzilla/ \
--to=sourceware-bugzilla@sourceware.org \
--cc=gdb-prs@sourceware.org \
/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).