aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2009-06-10 22:08:19 +0000
committerTom Tromey <tromey@redhat.com>2009-06-10 22:08:19 +0000
commit8bb318c686da09d7b614eaa7b147137d8747a985 (patch)
treea4d5a54ba432ea4e3b2f5f4b873235c66c33cfd4 /gdb
parentbbb2952039d223ad645d07369f508606bbb82672 (diff)
downloadgdb-8bb318c686da09d7b614eaa7b147137d8747a985.zip
gdb-8bb318c686da09d7b614eaa7b147137d8747a985.tar.gz
gdb-8bb318c686da09d7b614eaa7b147137d8747a985.tar.bz2
* inferior.c (print_inferior): Make a table, not a list. Emit
table headers.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/inferior.c30
2 files changed, 31 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d9754e5..000b6e8 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2009-06-05 Tom Tromey <tromey@redhat.com>
+
+ * inferior.c (print_inferior): Make a table, not a list. Emit
+ table headers.
+
2009-06-10 Jonas Maebe <jonas.maebe@elis.ugent.be>
* darwin-nat.c (darwin_stop_inferior): Pass 0 as options to
diff --git a/gdb/inferior.c b/gdb/inferior.c
index 723006b..a99a3be 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -302,8 +302,31 @@ print_inferior (struct ui_out *uiout, int requested_inferior)
{
struct inferior *inf;
struct cleanup *old_chain;
+ int inf_count = 0;
- old_chain = make_cleanup_ui_out_list_begin_end (uiout, "inferiors");
+ /* Compute number of inferiors we will print. */
+ for (inf = inferior_list; inf; inf = inf->next)
+ {
+ struct cleanup *chain2;
+
+ if (requested_inferior != -1 && inf->num != requested_inferior)
+ continue;
+
+ ++inf_count;
+ }
+
+ if (inf_count == 0)
+ {
+ ui_out_message (uiout, 0, "No inferiors.\n");
+ return;
+ }
+
+ old_chain = make_cleanup_ui_out_table_begin_end (uiout, 3, inf_count,
+ "inferiors");
+ ui_out_table_header (uiout, 3, ui_right, "current", "Cur");
+ ui_out_table_header (uiout, 4, ui_right, "id", "Id");
+ ui_out_table_header (uiout, 7, ui_right, "target-id", "PID");
+ ui_out_table_body (uiout);
for (inf = inferior_list; inf; inf = inf->next)
{
@@ -315,12 +338,11 @@ print_inferior (struct ui_out *uiout, int requested_inferior)
chain2 = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
if (inf->pid == ptid_get_pid (inferior_ptid))
- ui_out_text (uiout, "* ");
+ ui_out_field_string (uiout, "current", "*");
else
- ui_out_text (uiout, " ");
+ ui_out_field_skip (uiout, "current");
ui_out_field_int (uiout, "id", inf->num);
- ui_out_text (uiout, " ");
ui_out_field_int (uiout, "target-id", inf->pid);
ui_out_text (uiout, "\n");