public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb/maint: add core file name to 'maint info program-spaces' output
@ 2022-12-14 13:58 Andrew Burgess
0 siblings, 0 replies; only message in thread
From: Andrew Burgess @ 2022-12-14 13:58 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5d80df4a109e7b648e324423a5fbc3c1ba02e816
commit 5d80df4a109e7b648e324423a5fbc3c1ba02e816
Author: Andrew Burgess <aburgess@redhat.com>
Date: Fri Sep 23 10:04:58 2022 +0100
gdb/maint: add core file name to 'maint info program-spaces' output
Each program space can have an associated core file. Include this
information in the output of 'maint info program-spaces'.
Diff:
---
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 c4ccfcc9e32..b631b489344 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -178,6 +178,10 @@ set debug solib-frv on|off
show debug solib-frv
Removed in favor of "set/show debug solib".
+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 5b566669975..755fbf72a7c 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -3465,6 +3465,10 @@ the program space number assigned by @value{GDBN}
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 @@ example, the list of inferiors bound to the program space.
@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 @@ the parent and child processes of a @code{vfork} call. For example,
@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,
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-12-14 13:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-14 13:58 [binutils-gdb] gdb/maint: add core file name to 'maint info program-spaces' output Andrew Burgess
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).