aboutsummaryrefslogtreecommitdiff
path: root/gdb/progspace.c
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2022-09-23 10:04:58 +0100
committerAndrew Burgess <aburgess@redhat.com>2022-12-14 13:57:22 +0000
commit5d80df4a109e7b648e324423a5fbc3c1ba02e816 (patch)
tree23ac758c75157eafef3f0b905a9c34ea3a0131c8 /gdb/progspace.c
parent740a579fd5f5cd56bfb42a3f62c61ffd42d43186 (diff)
downloadbinutils-5d80df4a109e7b648e324423a5fbc3c1ba02e816.zip
binutils-5d80df4a109e7b648e324423a5fbc3c1ba02e816.tar.gz
binutils-5d80df4a109e7b648e324423a5fbc3c1ba02e816.tar.bz2
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'.
Diffstat (limited to 'gdb/progspace.c')
-rw-r--r--gdb/progspace.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/gdb/progspace.c b/gdb/progspace.c
index 90003d9..4f58d44 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,