diff options
Diffstat (limited to 'gdb/mi')
-rw-r--r-- | gdb/mi/mi-cmd-file.c | 5 | ||||
-rw-r--r-- | gdb/mi/mi-main.c | 22 |
2 files changed, 7 insertions, 20 deletions
diff --git a/gdb/mi/mi-cmd-file.c b/gdb/mi/mi-cmd-file.c index 2b3522b..a39ef3b 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 8e3684a..d4e2e8f 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); |