ubsan: z8k: index 10 out of bounds for type 'unsigned int const[10]'
[deliverable/binutils-gdb.git] / gdb / mi / mi-out.c
index 4f8c9bff8e58f57ce1971c3686613ac9728bf43b..050c05c7e0653a0684e8be8d853236b4451ad4d9 100644 (file)
@@ -1,6 +1,6 @@
 /* MI Command Set - output generating routines.
 
-   Copyright (C) 2000-2019 Free Software Foundation, Inc.
+   Copyright (C) 2000-2020 Free Software Foundation, Inc.
 
    Contributed by Cygnus Solutions (a Red Hat company).
 
@@ -35,8 +35,8 @@ mi_ui_out::do_table_begin (int nr_cols, int nr_rows,
                           const char *tblid)
 {
   open (tblid, ui_out_type_tuple);
-  do_field_int (-1, -1, ui_left, "nr_rows", nr_rows);
-  do_field_int (-1, -1, ui_left, "nr_cols", nr_cols);
+  do_field_signed (-1, -1, ui_left, "nr_rows", nr_rows);
+  do_field_signed (-1, -1, ui_left, "nr_cols", nr_cols);
   open ("hdr", ui_out_type_list);
 }
 
@@ -67,12 +67,12 @@ mi_ui_out::do_table_header (int width, ui_align alignment,
                            const std::string &col_hdr)
 {
   open (NULL, ui_out_type_tuple);
-  do_field_int (0, 0, ui_center, "width", width);
-  do_field_int (0, 0, ui_center, "alignment", alignment);
+  do_field_signed (0, 0, ui_center, "width", width);
+  do_field_signed (0, 0, ui_center, "alignment", alignment);
   do_field_string (0, 0, ui_center, "col_name", col_name.c_str (),
-                  ui_out_style_kind::DEFAULT);
+                  ui_file_style ());
   do_field_string (0, width, alignment, "colhdr", col_hdr.c_str (),
-                  ui_out_style_kind::DEFAULT);
+                  ui_file_style ());
   close (ui_out_type_tuple);
 }
 
@@ -95,14 +95,21 @@ mi_ui_out::do_end (ui_out_type type)
 /* Output an int field.  */
 
 void
-mi_ui_out::do_field_int (int fldno, int width, ui_align alignment,
-                        const char *fldname, int value)
+mi_ui_out::do_field_signed (int fldno, int width, ui_align alignment,
+                           const char *fldname, LONGEST value)
 {
-  char buffer[20];     /* FIXME: how many chars long a %d can become? */
+  do_field_string (fldno, width, alignment, fldname, plongest (value),
+                  ui_file_style ());
+}
+
+/* Output an unsigned field.  */
 
-  xsnprintf (buffer, sizeof (buffer), "%d", value);
-  do_field_string (fldno, width, alignment, fldname, buffer,
-                  ui_out_style_kind::DEFAULT);
+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_file_style ());
 }
 
 /* Used to omit a field.  */
@@ -119,7 +126,7 @@ mi_ui_out::do_field_skip (int fldno, int width, ui_align alignment,
 void
 mi_ui_out::do_field_string (int fldno, int width, ui_align align,
                            const char *fldname, const char *string,
-                           ui_out_style_kind style)
+                           const ui_file_style &style)
 {
   ui_file *stream = m_streams.back ();
   field_separator ();
@@ -134,8 +141,8 @@ mi_ui_out::do_field_string (int fldno, int width, ui_align align,
 
 void
 mi_ui_out::do_field_fmt (int fldno, int width, ui_align align,
-                        const char *fldname, const char *format,
-                        va_list args)
+                        const char *fldname, const ui_file_style &style,
+                        const char *format, va_list args)
 {
   ui_file *stream = m_streams.back ();
   field_separator ();
@@ -159,7 +166,8 @@ mi_ui_out::do_text (const char *string)
 }
 
 void
-mi_ui_out::do_message (const char *format, va_list args)
+mi_ui_out::do_message (const ui_file_style &style,
+                      const char *format, va_list args)
 {
 }
 
@@ -280,7 +288,9 @@ mi_ui_out::version ()
 /* Constructor for an `mi_out_data' object.  */
 
 mi_ui_out::mi_ui_out (int mi_version)
-: m_suppress_field_separator (false),
+: ui_out (mi_version >= 3
+         ? fix_multi_location_breakpoint_output : (ui_out_flag) 0),
+  m_suppress_field_separator (false),
   m_suppress_output (false),
   m_mi_version (mi_version)
 {
@@ -297,10 +307,10 @@ mi_ui_out::~mi_ui_out ()
 mi_ui_out *
 mi_out_new (const char *mi_version)
 {
-  if (streq (mi_version, INTERP_MI3))
+  if (streq (mi_version, INTERP_MI3) ||  streq (mi_version, INTERP_MI))
     return new mi_ui_out (3);
 
-  if (streq (mi_version, INTERP_MI2) || streq (mi_version, INTERP_MI))
+  if (streq (mi_version, INTERP_MI2))
     return new mi_ui_out (2);
 
   if (streq (mi_version, INTERP_MI1))
This page took 0.026171 seconds and 4 git commands to generate.