diff options
author | Tom Tromey <tromey@adacore.com> | 2020-03-20 07:15:08 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2020-03-20 08:28:52 -0600 |
commit | 1773be9ea2207d42442222e6dc3c8fdbe638e28e (patch) | |
tree | d59c056f8da51ffa36d952d343bd7de018c1fa12 /gdb/symmisc.c | |
parent | 70304be939301a91dade0dc7d4234c081372bd24 (diff) | |
download | gdb-1773be9ea2207d42442222e6dc3c8fdbe638e28e.zip gdb-1773be9ea2207d42442222e6dc3c8fdbe638e28e.tar.gz gdb-1773be9ea2207d42442222e6dc3c8fdbe638e28e.tar.bz2 |
Fix column alignment in "maint info line-table"
Andrew Burgess pointed out on irc that "maint info line-table" doesn't
properly align the table headers. This patch fixes the problem by
switching the table to use ui-out.
This required a small tweak to one test case, as ui-out will pad a
field using spaces, even at the end of a line.
gdb/ChangeLog
2020-03-20 Tom Tromey <tromey@adacore.com>
* symmisc.c (maintenance_print_one_line_table): Use ui_out.
gdb/testsuite/ChangeLog
2020-03-20 Tom Tromey <tromey@adacore.com>
* gdb.dwarf2/dw2-ranges-base.exp: Update regular expressions.
Diffstat (limited to 'gdb/symmisc.c')
-rw-r--r-- | gdb/symmisc.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 4bf1f08..3df526b 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -985,26 +985,31 @@ maintenance_print_one_line_table (struct symtab *symtab, void *data) printf_filtered (_("Line table has no lines.\n")); else { - int i; - /* Leave space for 6 digits of index and line number. After that the tables will just not format as well. */ - printf_filtered (_("%-6s %6s %s %s\n"), - _("INDEX"), _("LINE"), _("ADDRESS"), _("IS-STMT")); - - for (i = 0; i < linetable->nitems; ++i) + struct ui_out *uiout = current_uiout; + ui_out_emit_table table_emitter (uiout, 4, -1, "line-table"); + uiout->table_header (6, ui_left, "index", _("INDEX")); + uiout->table_header (6, ui_left, "line", _("LINE")); + uiout->table_header (18, ui_left, "address", _("ADDRESS")); + uiout->table_header (1, ui_left, "is-stmt", _("IS-STMT")); + uiout->table_body (); + + for (int i = 0; i < linetable->nitems; ++i) { struct linetable_entry *item; item = &linetable->item [i]; - printf_filtered ("%-6d ", i); + ui_out_emit_tuple tuple_emitter (uiout, nullptr); + uiout->field_signed ("index", i); if (item->line > 0) - printf_filtered ("%6d ", item->line); + uiout->field_signed ("line", item->line); else - printf_filtered ("%6s ", _("END")); - printf_filtered ("%s%s\n", - core_addr_to_string (item->pc), - (item->is_stmt ? " Y" : "")); + uiout->field_string ("line", _("END")); + uiout->field_core_addr ("address", get_objfile_arch (objfile), + item->pc); + uiout->field_string ("is-stmt", item->is_stmt ? "Y" : ""); + uiout->text ("\n"); } } |