aboutsummaryrefslogtreecommitdiff
path: root/gdb/solist.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-11-10 13:07:46 -0700
committerTom Tromey <tom@tromey.com>2018-02-14 08:09:52 -0700
commit797bc1cb25b9dbdbc663cf711aecb0acc2450276 (patch)
tree8a38a8625056ea60dcaea4458a6dead3b9ba86c1 /gdb/solist.h
parent12ef3f5a7c5a6b89964842fd3da047b8d07dec91 (diff)
downloadgdb-797bc1cb25b9dbdbc663cf711aecb0acc2450276.zip
gdb-797bc1cb25b9dbdbc663cf711aecb0acc2450276.tar.gz
gdb-797bc1cb25b9dbdbc663cf711aecb0acc2450276.tar.bz2
Return unique_xmalloc_ptr from some solib.c functions
This changes a couple of solib.c functions -- exec_file_find and solib_find -- to return a unique_xmalloc_ptr, and then fixes up the users. This allows the removal of some cleanups. This also changes solib_bfd_open to not take ownership of its argument. I think this change is somewhat cleaner. gdb/ChangeLog 2018-02-14 Tom Tromey <tom@tromey.com> * solist.h (exec_file_find, solib_find): Return unique_xmalloc_ptr. (solib_bfd_fopen): Take a const char *. * solib.c (solib_find_1): Return unique_xmalloc_ptr. (exec_file_find, solib_find): Likewise. (solib_bfd_fopen): Do not take ownership of "pathname". (solib_bfd_open): Use unique_xmalloc_ptr. * solib-darwin.c (darwin_bfd_open): Use unique_xmalloc_ptr. * solib-aix.c (solib_aix_bfd_open): Use unique_xmalloc_ptr. * infrun.c (follow_exec): Use unique_xmalloc_ptr. * exec.c (exec_file_locate_attach): Use unique_xmalloc_ptr.
Diffstat (limited to 'gdb/solist.h')
-rw-r--r--gdb/solist.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/gdb/solist.h b/gdb/solist.h
index 1445913..aba00eb 100644
--- a/gdb/solist.h
+++ b/gdb/solist.h
@@ -192,13 +192,15 @@ typedef std::unique_ptr<so_list, so_deleter> so_list_up;
struct so_list *master_so_list (void);
/* Find main executable binary file. */
-extern char *exec_file_find (const char *in_pathname, int *fd);
+extern gdb::unique_xmalloc_ptr<char> exec_file_find (const char *in_pathname,
+ int *fd);
/* Find shared library binary file. */
-extern char *solib_find (const char *in_pathname, int *fd);
+extern gdb::unique_xmalloc_ptr<char> solib_find (const char *in_pathname,
+ int *fd);
/* Open BFD for shared library file. */
-extern gdb_bfd_ref_ptr solib_bfd_fopen (char *pathname, int fd);
+extern gdb_bfd_ref_ptr solib_bfd_fopen (const char *pathname, int fd);
/* Find solib binary file and open it. */
extern gdb_bfd_ref_ptr solib_bfd_open (char *in_pathname);