X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fgdb-dlfcn.h;h=d6446281edfe248c295a092715ebb30b8a9b87fd;hb=a45389f60d4372bdb3484e432935f3169037d88c;hp=31709a9637bf18924710e8f8920f2d636d8a8349;hpb=61baf725eca99af2569262d10aca03dcde2698f6;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/gdb-dlfcn.h b/gdb/gdb-dlfcn.h index 31709a9637..d6446281ed 100644 --- a/gdb/gdb-dlfcn.h +++ b/gdb/gdb-dlfcn.h @@ -1,6 +1,6 @@ /* Platform independent shared object routines for GDB. - Copyright (C) 2011-2017 Free Software Foundation, Inc. + Copyright (C) 2011-2018 Free Software Foundation, Inc. This file is part of GDB. @@ -20,26 +20,28 @@ #ifndef GDB_DLFCN_H #define GDB_DLFCN_H +/* A deleter that closes an open dynamic library. */ + +struct dlclose_deleter +{ + void operator() (void *handle) const; +}; + +/* A unique pointer that points to a dynamic library. */ + +typedef std::unique_ptr gdb_dlhandle_up; + /* Load the dynamic library file named FILENAME, and return a handle for that dynamic library. Return NULL if the loading fails for any reason. */ -void *gdb_dlopen (const char *filename); +gdb_dlhandle_up gdb_dlopen (const char *filename); /* Return the address of the symbol named SYMBOL inside the shared library whose handle is HANDLE. Return NULL when the symbol could not be found. */ -void *gdb_dlsym (void *handle, const char *symbol); - -/* Install a cleanup routine which closes the handle HANDLE. */ - -struct cleanup *make_cleanup_dlclose (void *handle); - -/* Cleanup the shared object pointed to by HANDLE. Return 0 on success - and nonzero on failure. */ - -int gdb_dlclose (void *handle); +void *gdb_dlsym (const gdb_dlhandle_up &handle, const char *symbol); /* Return non-zero if the dynamic library functions are available on this platform. */