public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH] Use ui_out for "maint info frame-unwinders"
Date: Wed, 22 Mar 2023 10:56:16 -0600	[thread overview]
Message-ID: <20230322165616.2036104-1-tromey@adacore.com> (raw)

This changes "maint info frame-unwinders" to use ui-out.  This makes
the table slightly nicer.  In general I think it's better to use
ui-out for tables.
---
 gdb/frame-unwind.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c
index a3673dde77a..866b2e6b4a6 100644
--- a/gdb/frame-unwind.c
+++ b/gdb/frame-unwind.c
@@ -347,13 +347,22 @@ maintenance_info_frame_unwinders (const char *args, int from_tty)
   struct gdbarch *gdbarch = target_gdbarch ();
   struct frame_unwind_table *table = get_frame_unwind_table (gdbarch);
 
+  ui_out *uiout = current_uiout;
+  ui_out_emit_table table_emitter (uiout, 2, -1, "FrameUnwinders");
+  uiout->table_header (27, ui_left, "name", "Name");
+  uiout->table_header (25, ui_left, "type", "Type");
+  uiout->table_body ();
+
   for (struct frame_unwind_table_entry *entry = table->list; entry != NULL;
        entry = entry->next)
     {
       const char *name = entry->unwinder->name;
       const char *type = frame_type_str (entry->unwinder->type);
 
-      gdb_printf (gdb_stdout, "%-16s\t%-16s\n", name, type);
+      ui_out_emit_list tuple_emitter (uiout, nullptr);
+      uiout->field_string ("name", name);
+      uiout->field_string ("type", type);
+      uiout->text ("\n");
     }
 }
 
-- 
2.39.1


             reply	other threads:[~2023-03-22 16:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22 16:56 Tom Tromey [this message]
2023-04-07 15:18 ` Tom Tromey

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=20230322165616.2036104-1-tromey@adacore.com \
    --to=tromey@adacore.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).