aboutsummaryrefslogtreecommitdiff
path: root/gdb/linux-thread-db.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-03-27 14:31:10 -0600
committerTom Tromey <tom@tromey.com>2018-03-30 13:22:58 -0600
commite83e4e24021acb4b095b1e8a45a51c2ea088a1ed (patch)
tree4740a6532e556fbb49a7de4234c2913796366212 /gdb/linux-thread-db.c
parent263db9a1f4105b76ddf00829d50430ea0a3bcba6 (diff)
downloadbinutils-e83e4e24021acb4b095b1e8a45a51c2ea088a1ed.zip
binutils-e83e4e24021acb4b095b1e8a45a51c2ea088a1ed.tar.gz
binutils-e83e4e24021acb4b095b1e8a45a51c2ea088a1ed.tar.bz2
Change target_read_string to use unique_xmalloc_ptr
This changes the out parameter of target_read_string to be a unique_xmalloc_ptr. This avoids a cleanup and sets the stage for more cleanup removals. This patch also removes a seemingly needless alloca from print_subexp_standard. gdb/ChangeLog 2018-03-30 Tom Tromey <tom@tromey.com> * windows-nat.c (handle_output_debug_string, handle_exception): Update. * target.h (target_read_string): Update. * target.c (target_read_string): Change "string" to unique_xmalloc_ptr. * solib-svr4.c (open_symbol_file_object, svr4_read_so_list): Update. * solib-frv.c (frv_current_sos): Update. * solib-dsbt.c (dsbt_current_sos): Update. * solib-darwin.c (darwin_current_sos): Update. * linux-thread-db.c (inferior_has_bug): Update. * expprint.c (print_subexp_standard) <case OP_OBJC_MSGCALL>: Update. Remove alloca. * ada-lang.c (ada_main_name): Update.
Diffstat (limited to 'gdb/linux-thread-db.c')
-rw-r--r--gdb/linux-thread-db.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index cfedd98..08e3cfb 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -413,7 +413,7 @@ inferior_has_bug (const char *ver_symbol, int ver_major_min, int ver_minor_min)
{
struct bound_minimal_symbol version_msym;
CORE_ADDR version_addr;
- char *version;
+ gdb::unique_xmalloc_ptr<char> version;
int err, got, retval = 0;
version_msym = lookup_minimal_symbol (ver_symbol, NULL, NULL);
@@ -422,15 +422,14 @@ inferior_has_bug (const char *ver_symbol, int ver_major_min, int ver_minor_min)
version_addr = BMSYMBOL_VALUE_ADDRESS (version_msym);
got = target_read_string (version_addr, &version, 32, &err);
- if (err == 0 && memchr (version, 0, got) == &version[got -1])
+ if (err == 0 && memchr (version.get (), 0, got) == version.get () + got - 1)
{
int major, minor;
- retval = (sscanf (version, "%d.%d", &major, &minor) == 2
+ retval = (sscanf (version.get (), "%d.%d", &major, &minor) == 2
&& (major < ver_major_min
|| (major == ver_major_min && minor < ver_minor_min)));
}
- xfree (version);
return retval;
}