aboutsummaryrefslogtreecommitdiff
path: root/gdb/solib-aix.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-10-12 16:48:35 -0600
committerTom Tromey <tom@tromey.com>2017-10-16 16:10:21 -0600
commitb7b030adc405017f01e996a90f85e40730ef8397 (patch)
tree5d6fdf82c43f719834633295cbcde80f75d5663d /gdb/solib-aix.c
parentb80406accc70791a1789e40f24d64161bc41de34 (diff)
downloadgdb-b7b030adc405017f01e996a90f85e40730ef8397.zip
gdb-b7b030adc405017f01e996a90f85e40730ef8397.tar.gz
gdb-b7b030adc405017f01e996a90f85e40730ef8397.tar.bz2
Return unique_xmalloc_ptr from target_read_stralloc
This changes target_read_stralloc to return a unique_xmalloc_ptr, and then fixes all the callers. unique_xmalloc_ptr is used, rather than std::string, because target_read_stralloc gives a special meaning to a NULL return. ChangeLog 2017-10-16 Tom Tromey <tom@tromey.com> * xml-syscall.c (xml_init_syscalls_info): Update. * xml-support.c (xinclude_start_include): Update. (xml_fetch_content_from_file): Return unique_xmalloc_ptr. * xml-support.h (xml_fetch_another): Return unique_xmalloc_ptr. (xml_fetch_content_from_file): Likewise. * osdata.c (get_osdata): Update. * target.h (target_read_stralloc, target_get_osdata): Return unique_xmalloc_ptr. * solib-aix.c (solib_aix_get_library_list): Update. * solib-target.c (solib_target_current_sos): Update. * solib-svr4.c (svr4_current_sos_via_xfer_libraries): Update. * xml-tdesc.c (fetch_available_features_from_target): Update. (target_fetch_description_xml): Update. (file_read_description_xml): Update. * remote.c (remote_get_threads_with_qxfer, remote_memory_map) (remote_traceframe_info, btrace_read_config, remote_read_btrace) (remote_pid_to_exec_file): Update. * target.c (target_read_stralloc): Return unique_xmalloc_ptr. (target_get_osdata): Likewise.
Diffstat (limited to 'gdb/solib-aix.c')
-rw-r--r--gdb/solib-aix.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c
index 9233e78..de238e5 100644
--- a/gdb/solib-aix.c
+++ b/gdb/solib-aix.c
@@ -271,39 +271,34 @@ static VEC (lm_info_aix_p) *
solib_aix_get_library_list (struct inferior *inf, const char *warning_msg)
{
struct solib_aix_inferior_data *data;
- char *library_document;
- struct cleanup *cleanup;
/* If already computed, return the cached value. */
data = get_solib_aix_inferior_data (inf);
if (data->library_list != NULL)
return data->library_list;
- library_document = target_read_stralloc (&current_target,
- TARGET_OBJECT_LIBRARIES_AIX,
- NULL);
+ gdb::unique_xmalloc_ptr<char> library_document
+ = target_read_stralloc (&current_target, TARGET_OBJECT_LIBRARIES_AIX,
+ NULL);
if (library_document == NULL && warning_msg != NULL)
{
warning (_("%s (failed to read TARGET_OBJECT_LIBRARIES_AIX)"),
warning_msg);
return NULL;
}
- cleanup = make_cleanup (xfree, library_document);
if (solib_aix_debug)
fprintf_unfiltered (gdb_stdlog,
"DEBUG: TARGET_OBJECT_LIBRARIES_AIX = \n%s\n",
- library_document);
+ library_document.get ());
- data->library_list = solib_aix_parse_libraries (library_document);
+ data->library_list = solib_aix_parse_libraries (library_document.get ());
if (data->library_list == NULL && warning_msg != NULL)
{
warning (_("%s (missing XML support?)"), warning_msg);
- do_cleanups (cleanup);
return NULL;
}
- do_cleanups (cleanup);
return data->library_list;
}