From: Andrew Burgess <aburgess@redhat.com>
To: gdb-patches@sourceware.org
Cc: Andrew Burgess <aburgess@redhat.com>
Subject: [PATCHv3 6/7] gdb/maint: add core file name to 'maint info program-spaces' output
Date: Fri, 18 Nov 2022 16:42:57 +0000 [thread overview]
Message-ID: <6e8ccd780e088af4a3e9f822aad10d1ff72132f9.1668789658.git.aburgess@redhat.com> (raw)
In-Reply-To: <cover.1668789658.git.aburgess@redhat.com>
Each program space can have an associated core file. Include this
information in the output of 'maint info program-spaces'.
---
gdb/NEWS | 4 ++++
gdb/doc/gdb.texinfo | 8 ++++++--
gdb/progspace.c | 18 ++++++++++++++++--
3 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/gdb/NEWS b/gdb/NEWS
index 424e5ffd829..8176940ae1a 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -146,6 +146,10 @@ maintenance info line-table
entry corresponds to an address where a breakpoint should be placed
to be at the first instruction past a function's prologue.
+maintenance info program-spaces
+ This command now includes a 'Core File' column which indicates the
+ name of the core file associated with each program space.
+
* New targets
GNU/Linux/LoongArch (gdbserver) loongarch*-*-linux*
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index bb7b2764408..566da9e7d92 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -3465,6 +3465,10 @@
the name of the executable loaded into the program space, with e.g.,
the @code{file} command.
+@item
+the name of the core file loaded into the program space, with e.g.,
+the @code{core-file} command.
+
@end enumerate
@noindent
@@ -3477,7 +3481,7 @@
@smallexample
(@value{GDBP}) maint info program-spaces
- Id Executable
+ Id Executable Core File
* 1 hello
2 goodbye
Bound inferiors: ID 1 (process 21561)
@@ -3491,7 +3495,7 @@
@smallexample
(@value{GDBP}) maint info program-spaces
- Id Executable
+ Id Executable Core File
* 1 vfork-test
Bound inferiors: ID 2 (process 18050), ID 1 (process 18045)
@end smallexample
diff --git a/gdb/progspace.c b/gdb/progspace.c
index 90003d964fe..4f58d44a0e6 100644
--- a/gdb/progspace.c
+++ b/gdb/progspace.c
@@ -251,22 +251,30 @@ print_program_space (struct ui_out *uiout, int requested)
{
int count = 0;
+ /* Start with a minimum width of 17 for the executable name column. */
+ size_t longest_exec_name = 17;
+
/* Compute number of pspaces we will print. */
for (struct program_space *pspace : program_spaces)
{
if (requested != -1 && pspace->num != requested)
continue;
+ if (pspace->exec_filename != nullptr)
+ longest_exec_name = std::max (strlen (pspace->exec_filename.get ()),
+ longest_exec_name);
+
++count;
}
/* There should always be at least one. */
gdb_assert (count > 0);
- ui_out_emit_table table_emitter (uiout, 3, count, "pspaces");
+ ui_out_emit_table table_emitter (uiout, 4, count, "pspaces");
uiout->table_header (1, ui_left, "current", "");
uiout->table_header (4, ui_left, "id", "Id");
- uiout->table_header (17, ui_left, "exec", "Executable");
+ uiout->table_header (longest_exec_name, ui_left, "exec", "Executable");
+ uiout->table_header (17, ui_left, "core", "Core File");
uiout->table_body ();
for (struct program_space *pspace : program_spaces)
@@ -291,6 +299,12 @@ print_program_space (struct ui_out *uiout, int requested)
else
uiout->field_skip ("exec");
+ if (pspace->cbfd != nullptr)
+ uiout->field_string ("core", bfd_get_filename (pspace->cbfd.get ()),
+ file_name_style.style ());
+ else
+ uiout->field_skip ("core");
+
/* Print extra info that doesn't really fit in tabular form.
Currently, we print the list of inferiors bound to a pspace.
There can be more than one inferior bound to the same pspace,
--
2.25.4
next prev parent reply other threads:[~2022-11-18 16:43 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-21 13:12 [PATCH] gdb: fix target_ops reference count for some cases Andrew Burgess
2022-09-21 15:30 ` Simon Marchi
2022-09-22 14:21 ` Andrew Burgess
2022-09-22 14:52 ` Simon Marchi
2022-09-22 15:00 ` Simon Marchi
2022-09-22 17:24 ` Andrew Burgess
2022-09-26 14:16 ` Simon Marchi
2022-10-01 20:58 ` Andrew Burgess
2022-10-02 17:04 ` [PATCHv2 0/7] " Andrew Burgess
2022-10-02 17:04 ` [PATCHv2 1/7] gdb/remote: remove some manual reference count handling Andrew Burgess
2022-10-02 17:04 ` [PATCHv2 2/7] gdb: remove decref_target Andrew Burgess
2022-10-02 17:04 ` [PATCHv2 3/7] gdb: have target_stack automate reference count handling Andrew Burgess
2022-10-02 17:04 ` [PATCHv2 4/7] gdb: remove the pop_all_targets (and friends) global functions Andrew Burgess
2022-10-05 20:49 ` Lancelot SIX
2022-10-06 11:14 ` Andrew Burgess
2022-10-02 17:04 ` [PATCHv2 5/7] gdb: ensure all targets are popped before an inferior is destructed Andrew Burgess
2022-10-02 17:04 ` [PATCHv2 6/7] gdb/maint: add core file name to 'maint info program-spaces' output Andrew Burgess
2022-10-02 17:21 ` Eli Zaretskii
2022-10-02 17:04 ` [PATCHv2 7/7] gdb: some process_stratum_target should not be shared Andrew Burgess
2022-10-02 17:21 ` Eli Zaretskii
2022-10-05 21:15 ` Lancelot SIX
2022-10-06 11:44 ` Andrew Burgess
2022-11-18 16:42 ` [PATCHv3 0/7] gdb: fix target_ops reference count for some cases Andrew Burgess
2022-11-18 16:42 ` [PATCHv3 1/7] gdb/remote: remove some manual reference count handling Andrew Burgess
2022-11-18 16:42 ` [PATCHv3 2/7] gdb: remove decref_target Andrew Burgess
2022-11-18 17:22 ` Tom Tromey
2022-11-18 16:42 ` [PATCHv3 3/7] gdb: have target_stack automate reference count handling Andrew Burgess
2022-11-18 17:25 ` Tom Tromey
2022-11-18 16:42 ` [PATCHv3 4/7] gdb: remove the pop_all_targets (and friends) global functions Andrew Burgess
2022-11-18 17:29 ` Tom Tromey
2022-11-18 16:42 ` [PATCHv3 5/7] gdb: ensure all targets are popped before an inferior is destructed Andrew Burgess
2022-11-18 16:42 ` Andrew Burgess [this message]
2022-11-18 17:03 ` [PATCHv3 6/7] gdb/maint: add core file name to 'maint info program-spaces' output Eli Zaretskii
2022-11-18 16:42 ` [PATCHv3 7/7] gdb: some process_stratum_target should not be shared Andrew Burgess
2022-11-18 17:02 ` Eli Zaretskii
2022-11-18 18:04 ` Tom Tromey
2022-12-14 13:57 ` Andrew Burgess
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=6e8ccd780e088af4a3e9f822aad10d1ff72132f9.1668789658.git.aburgess@redhat.com \
--to=aburgess@redhat.com \
--cc=gdb-patches@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).