summaryrefslogtreecommitdiff
path: root/gdb/mi
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-08-11 15:02:04 -0600
committerTom Tromey <tom@tromey.com>2017-09-09 13:46:05 -0600
commit76f9c9cfd42eb8df90ce8455a92109c0f71b41e1 (patch)
tree412125e3a8e7f78d909430fbed1cd045e332828a /gdb/mi
parentdc9fe180a4437b437015a8b835d05e32d64dff3d (diff)
downloadbinutils-gdb-76f9c9cfd42eb8df90ce8455a92109c0f71b41e1.tar.gz
Use ui_out_emit_tuple in more places
This changes more places to use ui_out_emit_tuple, removing cleanups. ChangeLog 2017-09-09 Tom Tromey <tom@tromey.com> * target.c (flash_erase_command): Use ui_out_emit_tuple. * stack.c (print_frame): Use ui_out_emit_tuple. * spu-tdep.c (info_spu_event_command): Use ui_out_emit_tuple. (info_spu_mailbox_command, info_spu_dma_command) (info_spu_proxydma_command): Likewise. * mi/mi-main.c (mi_cmd_trace_frame_collected): Use ui_out_emit_tuple, gdb::byte_vector, bin2hex. * mi/mi-cmd-file.c (mi_cmd_file_list_shared_libraries): Use ui_out_emit_tuple. * breakpoint.c (print_it_watchpoint): Use ui_out_emit_tuple.
Diffstat (limited to 'gdb/mi')
-rw-r--r--gdb/mi/mi-cmd-file.c5
-rw-r--r--gdb/mi/mi-main.c22
2 files changed, 7 insertions, 20 deletions
diff --git a/gdb/mi/mi-cmd-file.c b/gdb/mi/mi-cmd-file.c
index 2b3522b7b16..a39ef3b35b4 100644
--- a/gdb/mi/mi-cmd-file.c
+++ b/gdb/mi/mi-cmd-file.c
@@ -153,10 +153,7 @@ mi_cmd_file_list_shared_libraries (const char *command, char **argv, int argc)
if (pattern != NULL && !re_exec (so->so_name))
continue;
- struct cleanup *tuple_clean_up
- = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
+ ui_out_emit_tuple tuple_emitter (uiout, NULL);
mi_output_solib_attribs (uiout, so);
-
- do_cleanups (tuple_clean_up);
}
}
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 8e3684abaf2..d4e2e8f2871 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -61,6 +61,7 @@
#include "run-time-clock.h"
#include <chrono>
#include "progspace-and-thread.h"
+#include "common/rsp-low.h"
enum
{
@@ -2872,36 +2873,25 @@ mi_cmd_trace_frame_collected (const char *command, char **argv, int argc)
for (i = 0; VEC_iterate (mem_range_s, available_memory, i, r); i++)
{
- struct cleanup *cleanup_child;
- gdb_byte *data;
struct gdbarch *gdbarch = target_gdbarch ();
- cleanup_child = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
+ ui_out_emit_tuple tuple_emitter (uiout, NULL);
uiout->field_core_addr ("address", gdbarch, r->start);
uiout->field_int ("length", r->length);
- data = (gdb_byte *) xmalloc (r->length);
- make_cleanup (xfree, data);
+ gdb::byte_vector data (r->length);
if (memory_contents)
{
- if (target_read_memory (r->start, data, r->length) == 0)
+ if (target_read_memory (r->start, data.data (), r->length) == 0)
{
- int m;
- char *data_str, *p;
-
- data_str = (char *) xmalloc (r->length * 2 + 1);
- make_cleanup (xfree, data_str);
-
- for (m = 0, p = data_str; m < r->length; ++m, p += 2)
- sprintf (p, "%02x", data[m]);
- uiout->field_string ("contents", data_str);
+ std::string data_str = bin2hex (data.data (), r->length);
+ uiout->field_string ("contents", data_str.c_str ());
}
else
uiout->field_skip ("contents");
}
- do_cleanups (cleanup_child);
}
do_cleanups (list_cleanup);