/* Output generating routines for GDB.
- Copyright (C) 1999, 2000, 2001, 2002, 2004, 2005, 2007, 2008, 2009, 2010,
- 2011 Free Software Foundation, Inc.
+ Copyright (C) 1999-2013 Free Software Foundation, Inc.
Contributed by Cygnus Solutions.
Written by Fernando Nasser for Cygnus.
/* FIXME: This should not be a global, but something passed down from main.c
or top.c. */
-struct ui_out *uiout = &def_uiout;
+struct ui_out *current_uiout = &def_uiout;
/* These are the interfaces to implementation functions. */
uo_field_int (uiout, fldno, input_width, input_align, fldname, value);
}
+/* Documented in ui-out.h. */
+
void
ui_out_field_core_addr (struct ui_out *uiout,
const char *fldname,
struct gdbarch *gdbarch,
CORE_ADDR address)
{
- /* Maximum size string returned by hex_string_custom is 50 chars.
- This buffer must be bigger than that, for safety. */
- char addstr[64];
- int addr_bit = gdbarch_addr_bit (gdbarch);
-
- if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
- address &= ((CORE_ADDR) 1 << addr_bit) - 1;
-
- /* FIXME: cagney/2002-05-03: Need local_address_string() function
- that returns the language localized string formatted to a width
- based on gdbarch_addr_bit. */
- if (addr_bit <= 32)
- strcpy (addstr, hex_string_custom (address, 8));
- else
- strcpy (addstr, hex_string_custom (address, 16));
-
- ui_out_field_string (uiout, fldname, addstr);
+ ui_out_field_string (uiout, fldname,
+ print_core_address (gdbarch, address));
}
void
ui_out_field_stream (struct ui_out *uiout,
const char *fldname,
- struct ui_stream *buf)
+ struct ui_file *stream)
{
long length;
- char *buffer = ui_file_xstrdup (buf->stream, &length);
+ char *buffer = ui_file_xstrdup (stream, &length);
struct cleanup *old_cleanup = make_cleanup (xfree, buffer);
if (length > 0)
ui_out_field_string (uiout, fldname, buffer);
else
ui_out_field_skip (uiout, fldname);
- ui_file_rewind (buf->stream);
+ ui_file_rewind (stream);
do_cleanups (old_cleanup);
}
va_end (args);
}
-struct ui_stream *
-ui_out_stream_new (struct ui_out *uiout)
-{
- struct ui_stream *tempbuf;
-
- tempbuf = XMALLOC (struct ui_stream);
- tempbuf->uiout = uiout;
- tempbuf->stream = mem_fileopen ();
- return tempbuf;
-}
-
-void
-ui_out_stream_delete (struct ui_stream *buf)
-{
- ui_file_delete (buf->stream);
- xfree (buf);
-}
-
-static void
-do_stream_delete (void *buf)
-{
- ui_out_stream_delete (buf);
-}
-
-struct cleanup *
-make_cleanup_ui_out_stream_delete (struct ui_stream *buf)
-{
- return make_cleanup (do_stream_delete, buf);
-}
-
-
void
ui_out_wrap_hint (struct ui_out *uiout, char *identstring)
{
return 0;
}
-#if 0
-void
-ui_out_result_begin (struct ui_out *uiout, char *class)
-{
-}
-
-void
-ui_out_result_end (struct ui_out *uiout)
-{
-}
-
-void
-ui_out_info_begin (struct ui_out *uiout, char *class)
-{
-}
-
-void
-ui_out_info_end (struct ui_out *uiout)
-{
-}
-
-void
-ui_out_notify_begin (struct ui_out *uiout, char *class)
-{
-}
-
-void
-ui_out_notify_end (struct ui_out *uiout)
-{
-}
-
-void
-ui_out_error_begin (struct ui_out *uiout, char *class)
-{
-}
-
-void
-ui_out_error_end (struct ui_out *uiout)
-{
-}
-#endif
-
-#if 0
-void
-gdb_error (ui_out * uiout, int severity, char *format,...)
-{
- va_list args;
-}
-
-void
-gdb_query (struct ui_out *uiout, int qflags, char *qprompt)
-{
-}
-#endif
-
int
ui_out_is_mi_like_p (struct ui_out *uiout)
{
{
uiout->table.header_next = uiout->table.header_first;
uiout->table.header_first = uiout->table.header_first->next;
- if (uiout->table.header_next->colhdr != NULL)
- xfree (uiout->table.header_next->colhdr);
+ xfree (uiout->table.header_next->colhdr);
+ xfree (uiout->table.header_next->col_name);
xfree (uiout->table.header_next);
}
gdb_assert (uiout->table.header_first == NULL);
uiout->table.header_next = uiout->table.header_last;
}
-/* Extract the format information for the NEXT header and and advance
+/* Extract the format information for the NEXT header and advance
the header pointer. Return 0 if there was no next header. */
static int
}
-/* Access to ui_out format private members. */
-
-void
-ui_out_get_field_separator (struct ui_out *uiout)
-{
-}
-
/* Access to ui-out members data. */
void *