diff options
author | Tom Tromey <tom@tromey.com> | 2018-04-29 20:50:43 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-04-30 12:59:05 -0600 |
commit | f3c6ababac34f3a291997f8d5ea6a63949b58b87 (patch) | |
tree | b320871f0ef2f9feafd4479f4ae1e8110ce38ec1 | |
parent | 40c03530b197d8d6ef550283ecd6684e8d49301b (diff) | |
download | gdb-f3c6ababac34f3a291997f8d5ea6a63949b58b87.zip gdb-f3c6ababac34f3a291997f8d5ea6a63949b58b87.tar.gz gdb-f3c6ababac34f3a291997f8d5ea6a63949b58b87.tar.bz2 |
Remove a use of is_mi_like_p from tracepoint.c
This removes a use of is_mi_like_p and changes a printf_filtered into
a call to ui_out::text.
ChangeLog
2018-04-30 Tom Tromey <tom@tromey.com>
* tracepoint.c (tvariables_info_1): Remove use of is_mi_like_p.
-rw-r--r-- | gdb/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/tracepoint.c | 75 |
2 files changed, 41 insertions, 38 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 84a2ddf..97260fb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2018-04-30 Tom Tromey <tom@tromey.com> + * tracepoint.c (tvariables_info_1): Remove use of is_mi_like_p. + +2018-04-30 Tom Tromey <tom@tromey.com> + * spu-tdep.c (info_spu_mailbox_list, info_spu_dma_cmdlist) (info_spu_event_command): Remove some uses of is_mi_like_p. diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 7e173ce..f40fb04 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -420,51 +420,50 @@ tvariables_info_1 (void) { struct ui_out *uiout = current_uiout; - if (tvariables.empty () && !uiout->is_mi_like_p ()) - { - printf_filtered (_("No trace state variables.\n")); - return; - } - /* Try to acquire values from the target. */ for (trace_state_variable &tsv : tvariables) tsv.value_known = target_get_trace_state_variable_value (tsv.number, &tsv.value); - ui_out_emit_table table_emitter (uiout, 3, tvariables.size (), - "trace-variables"); - uiout->table_header (15, ui_left, "name", "Name"); - uiout->table_header (11, ui_left, "initial", "Initial"); - uiout->table_header (11, ui_left, "current", "Current"); + { + ui_out_emit_table table_emitter (uiout, 3, tvariables.size (), + "trace-variables"); + uiout->table_header (15, ui_left, "name", "Name"); + uiout->table_header (11, ui_left, "initial", "Initial"); + uiout->table_header (11, ui_left, "current", "Current"); - uiout->table_body (); + uiout->table_body (); - for (const trace_state_variable &tsv : tvariables) - { - const char *c; - - ui_out_emit_tuple tuple_emitter (uiout, "variable"); - - uiout->field_string ("name", std::string ("$") + tsv.name); - uiout->field_string ("initial", plongest (tsv.initial_value)); - - if (tsv.value_known) - c = plongest (tsv.value); - else if (uiout->is_mi_like_p ()) - /* For MI, we prefer not to use magic string constants, but rather - omit the field completely. The difference between unknown and - undefined does not seem important enough to represent. */ - c = NULL; - else if (current_trace_status ()->running || traceframe_number >= 0) - /* The value is/was defined, but we don't have it. */ - c = "<unknown>"; - else - /* It is not meaningful to ask about the value. */ - c = "<undefined>"; - if (c) - uiout->field_string ("current", c); - uiout->text ("\n"); - } + for (const trace_state_variable &tsv : tvariables) + { + const char *c; + + ui_out_emit_tuple tuple_emitter (uiout, "variable"); + + uiout->field_string ("name", std::string ("$") + tsv.name); + uiout->field_string ("initial", plongest (tsv.initial_value)); + + if (tsv.value_known) + c = plongest (tsv.value); + else if (uiout->is_mi_like_p ()) + /* For MI, we prefer not to use magic string constants, but rather + omit the field completely. The difference between unknown and + undefined does not seem important enough to represent. */ + c = NULL; + else if (current_trace_status ()->running || traceframe_number >= 0) + /* The value is/was defined, but we don't have it. */ + c = "<unknown>"; + else + /* It is not meaningful to ask about the value. */ + c = "<undefined>"; + if (c) + uiout->field_string ("current", c); + uiout->text ("\n"); + } + } + + if (tvariables.empty ()) + uiout->text (_("No trace state variables.\n")); } /* List all the trace state variables. */ |