From 1ccbe9985f607b291bb6fc920beda60225f1bf83 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 5 Aug 2017 16:23:18 -0600 Subject: Return std::string from memory_error_message This changes memory_error_message to return a std::string and fixes up the callers. This removes some cleanups. ChangeLog 2017-09-03 Tom Tromey * valprint.c (val_print_string): Update. * gdbcore.h (memory_error_message): Return std::string. * corefile.c (memory_error_message): Return std::string. (memory_error): Update. * breakpoint.c (insert_bp_location): Update. --- gdb/valprint.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'gdb/valprint.c') diff --git a/gdb/valprint.c b/gdb/valprint.c index eef99b1..5b02e2f 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -2988,13 +2988,10 @@ val_print_string (struct type *elttype, const char *encoding, if (err != 0) { - char *str; - - str = memory_error_message (TARGET_XFER_E_IO, gdbarch, addr); - make_cleanup (xfree, str); + std::string str = memory_error_message (TARGET_XFER_E_IO, gdbarch, addr); fprintf_filtered (stream, ""); } -- cgit v1.1