+2019-07-15 Tom Tromey <tromey@adacore.com>
+
+ * mi/mi-out.h (class mi_ui_out) <do_field_unsigned>: Declare.
+ * mi/mi-out.c (mi_ui_out::do_field_unsigned): New method.
+ * cli-out.h (class cli_ui_out) <do_field_unsigned>: Declare.
+ * cli-out.c (cli_ui_out::do_field_int): New method.
+ * ui-out.c (ui_out::field_unsigned): New method.
+ * symfile.c (generic_load): Use field_unsigned.
+ (print_transfer_performance): Likewise.
+ * record-btrace.c (ui_out_field_uint): Remove.
+ (btrace_call_history_insn_range, btrace_call_history): Use
+ field_unsigned.
+ * disasm.c (gdb_pretty_print_disassembler::pretty_print_insn): Use
+ field_unsigned.
+ * ui-out.h (class ui_out) <field_unsigned>: New method.
+ <do_field_unsigned>: Likewise.
+
2019-07-15 Tom Tromey <tromey@adacore.com>
* mi/mi-main.c (list_available_thread_groups): Use field_string.
ui_out_style_kind::DEFAULT);
}
+/* output an unsigned field */
+
+void
+cli_ui_out::do_field_unsigned (int fldno, int width, ui_align alignment,
+ const char *fldname, ULONGEST value)
+{
+ if (m_suppress_output)
+ return;
+
+ do_field_string (fldno, width, alignment, fldname, pulongest (value),
+ ui_out_style_kind::DEFAULT);
+}
+
/* used to omit a field */
void
virtual void do_end (ui_out_type type) override;
virtual void do_field_int (int fldno, int width, ui_align align,
const char *fldname, int value) override;
+ virtual void do_field_unsigned (int fldno, int width, ui_align align,
+ const char *fldname, ULONGEST value)
+ override;
virtual void do_field_skip (int fldno, int width, ui_align align,
const char *fldname) override;
virtual void do_field_string (int fldno, int width, ui_align align,
if (insn->number != 0)
{
- uiout->field_fmt ("insn-number", "%u", insn->number);
+ uiout->field_unsigned ("insn-number", insn->number);
uiout->text ("\t");
}
ui_out_style_kind::DEFAULT);
}
+/* Output an unsigned field. */
+
+void
+mi_ui_out::do_field_unsigned (int fldno, int width, ui_align alignment,
+ const char *fldname, ULONGEST value)
+{
+ do_field_string (fldno, width, alignment, fldname, pulongest (value),
+ ui_out_style_kind::DEFAULT);
+}
+
/* Used to omit a field. */
void
virtual void do_end (ui_out_type type) override;
virtual void do_field_int (int fldno, int width, ui_align align,
const char *fldname, int value) override;
+ virtual void do_field_unsigned (int fldno, int width, ui_align align,
+ const char *fldname, ULONGEST value)
+ override;
virtual void do_field_skip (int fldno, int width, ui_align align,
const char *fldname) override;
virtual void do_field_string (int fldno, int width, ui_align align,
uiout->text (_("]\n"));
}
-/* Print an unsigned int. */
-
-static void
-ui_out_field_uint (struct ui_out *uiout, const char *fld, unsigned int val)
-{
- uiout->field_fmt (fld, "%u", val);
-}
-
/* A range of source lines. */
struct btrace_line_range
begin = bfun->insn_offset;
end = begin + size - 1;
- ui_out_field_uint (uiout, "insn begin", begin);
+ uiout->field_unsigned ("insn begin", begin);
uiout->text (",");
- ui_out_field_uint (uiout, "insn end", end);
+ uiout->field_unsigned ("insn end", end);
}
/* Compute the lowest and highest source line for the instructions in BFUN
msym = bfun->msym;
/* Print the function index. */
- ui_out_field_uint (uiout, "index", bfun->number);
+ uiout->field_unsigned ("index", bfun->number);
uiout->text ("\t");
/* Indicate gaps in the trace. */
uiout->text ("Start address ");
uiout->field_core_addr ("address", target_gdbarch (), entry);
uiout->text (", load size ");
- uiout->field_fmt ("load-size", "%lu", total_progress.data_count);
+ uiout->field_unsigned ("load-size", total_progress.data_count);
uiout->text ("\n");
regcache_write_pc (get_current_regcache (), entry);
if (uiout->is_mi_like_p ())
{
- uiout->field_fmt ("transfer-rate", "%lu", rate * 8);
+ uiout->field_unsigned ("transfer-rate", rate * 8);
uiout->text (" bits/sec");
}
else if (rate < 1024)
{
- uiout->field_fmt ("transfer-rate", "%lu", rate);
+ uiout->field_unsigned ("transfer-rate", rate);
uiout->text (" bytes/sec");
}
else
{
- uiout->field_fmt ("transfer-rate", "%lu", rate / 1024);
+ uiout->field_unsigned ("transfer-rate", rate / 1024);
uiout->text (" KB/sec");
}
}
else
{
- uiout->field_fmt ("transferred-bits", "%lu", (data_count * 8));
+ uiout->field_unsigned ("transferred-bits", (data_count * 8));
uiout->text (" bits in <1 sec");
}
if (write_count > 0)
{
uiout->text (", ");
- uiout->field_fmt ("write-rate", "%lu", data_count / write_count);
+ uiout->field_unsigned ("write-rate", data_count / write_count);
uiout->text (" bytes/write");
}
uiout->text (".\n");
do_field_int (fldno, input_width, input_align, fldname, value);
}
+/* See ui-out.h. */
+
+void
+ui_out::field_unsigned (const char *fldname, ULONGEST value)
+{
+ int fldno;
+ int width;
+ ui_align align;
+
+ verify_field (&fldno, &width, &align);
+
+ do_field_unsigned (fldno, width, align, fldname, value);
+}
+
/* Documented in ui-out.h. */
void
void field_int (const char *fldname, int value);
void field_fmt_int (int width, ui_align align, const char *fldname,
int value);
+ /* Like field_int, but print an unsigned value. */
+ void field_unsigned (const char *fldname, ULONGEST value);
void field_core_addr (const char *fldname, struct gdbarch *gdbarch,
CORE_ADDR address);
void field_string (const char *fldname, const char *string,
virtual void do_end (ui_out_type type) = 0;
virtual void do_field_int (int fldno, int width, ui_align align,
const char *fldname, int value) = 0;
+ virtual void do_field_unsigned (int fldno, int width, ui_align align,
+ const char *fldname, ULONGEST value) = 0;
virtual void do_field_skip (int fldno, int width, ui_align align,
const char *fldname) = 0;
virtual void do_field_string (int fldno, int width, ui_align align,