diff options
Diffstat (limited to 'gdb/mi/mi-out.c')
-rw-r--r-- | gdb/mi/mi-out.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c index 9aaeec6..ea77e50 100644 --- a/gdb/mi/mi-out.c +++ b/gdb/mi/mi-out.c @@ -30,6 +30,7 @@ struct ui_out_data int suppress_output; int mi_version; struct ui_file *buffer; + struct ui_file *original_buffer; }; typedef struct ui_out_data mi_out_data; @@ -63,6 +64,7 @@ static void mi_message (struct ui_out *uiout, int verbosity, ATTRIBUTE_PRINTF (3, 0); static void mi_wrap_hint (struct ui_out *uiout, char *identstring); static void mi_flush (struct ui_out *uiout); +static int mi_redirect (struct ui_out *uiout, struct ui_file *outstream); /* This is the MI ui-out implementation functions vector */ @@ -86,7 +88,7 @@ struct ui_out_impl mi_ui_out_impl = mi_message, mi_wrap_hint, mi_flush, - NULL, + mi_redirect, 1, /* Needs MI hacks. */ }; @@ -210,11 +212,6 @@ void mi_field_skip (struct ui_out *uiout, int fldno, int width, enum ui_align alignment, const char *fldname) { - mi_out_data *data = ui_out_data (uiout); - - if (data->suppress_output) - return; - mi_field_string (uiout, fldno, width, alignment, fldname, ""); } /* other specific mi_field_* end up here so alignment and field @@ -294,6 +291,25 @@ mi_flush (struct ui_out *uiout) gdb_flush (data->buffer); } +int +mi_redirect (struct ui_out *uiout, struct ui_file *outstream) +{ + mi_out_data *data = ui_out_data (uiout); + + if (outstream != NULL) + { + data->original_buffer = data->buffer; + data->buffer = outstream; + } + else if (data->original_buffer != NULL) + { + data->buffer = data->original_buffer; + data->original_buffer = NULL; + } + + return 0; +} + /* local functions */ /* access to ui_out format private members */ |