summaryrefslogtreecommitdiff
path: root/gdb/valprint.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-08-05 16:23:18 -0600
committerTom Tromey <tom@tromey.com>2017-09-03 13:03:02 -0600
commit1ccbe9985f607b291bb6fc920beda60225f1bf83 (patch)
tree660da8f15daa3e60fd6a969ee515a762fddc4373 /gdb/valprint.c
parent0e30d991804de9dfd368653d6a88bf3766a27ffc (diff)
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 <tom@tromey.com> * 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.
Diffstat (limited to 'gdb/valprint.c')
-rw-r--r--gdb/valprint.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/gdb/valprint.c b/gdb/valprint.c
index eef99b1f3b..5b02e2face 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, "<error: ");
- fputs_filtered (str, stream);
+ fputs_filtered (str.c_str (), stream);
fprintf_filtered (stream, ">");
}