projects
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
PR22769, crash when running 32-bit objdump on corrupted file
[binutils-gdb.git]
/
gdb
/
gdb-dlfcn.c
diff --git
a/gdb/gdb-dlfcn.c
b/gdb/gdb-dlfcn.c
index c69528faa5189de22d9f94ba9d6728b16915f80a..76873cfc73c605576baa40a8bcb2b404e2228877 100644
(file)
--- a/
gdb/gdb-dlfcn.c
+++ b/
gdb/gdb-dlfcn.c
@@
-1,6
+1,6
@@
/* Platform independent shared object routines for GDB.
/* Platform independent shared object routines for GDB.
- Copyright (C) 2011 Free Software Foundation, Inc.
+ Copyright (C) 2011
-2018
Free Software Foundation, Inc.
This file is part of GDB.
This file is part of GDB.
@@
-18,8
+18,6
@@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
-#include "gdb_assert.h"
-
#include "gdb-dlfcn.h"
#ifdef HAVE_DLFCN_H
#include "gdb-dlfcn.h"
#ifdef HAVE_DLFCN_H
@@
-33,27
+31,20
@@
#ifdef NO_SHARED_LIB
#ifdef NO_SHARED_LIB
-void *
+gdb_dlhandle_up
gdb_dlopen (const char *filename)
{
gdb_assert_not_reached ("gdb_dlopen should not be called on this platform.");
}
void *
gdb_dlopen (const char *filename)
{
gdb_assert_not_reached ("gdb_dlopen should not be called on this platform.");
}
void *
-gdb_dlsym (
void *
handle, const char *symbol)
+gdb_dlsym (
const gdb_dlhandle_up &
handle, const char *symbol)
{
gdb_assert_not_reached ("gdb_dlsym should not be called on this platform.");
}
{
gdb_assert_not_reached ("gdb_dlsym should not be called on this platform.");
}
-struct cleanup *
-make_cleanup_dlclose (void *handle)
-{
- gdb_assert_not_reached ("make_cleanup_dlclose should not be called on this "
- "platform.");
-}
-
-int
-gdb_dlclose (void *handle)
+void
+dlclose_deleter::operator() (void *handle) const
{
gdb_assert_not_reached ("gdb_dlclose should not be called on this platform.");
}
{
gdb_assert_not_reached ("gdb_dlclose should not be called on this platform.");
}
@@
-66,7
+57,7
@@
is_dl_available (void)
#else /* NO_SHARED_LIB */
#else /* NO_SHARED_LIB */
-void *
+gdb_dlhandle_up
gdb_dlopen (const char *filename)
{
void *result;
gdb_dlopen (const char *filename)
{
void *result;
@@
-76,7
+67,7
@@
gdb_dlopen (const char *filename)
result = (void *) LoadLibrary (filename);
#endif
if (result != NULL)
result = (void *) LoadLibrary (filename);
#endif
if (result != NULL)
- return
result
;
+ return
gdb_dlhandle_up (result)
;
#ifdef HAVE_DLFCN_H
error (_("Could not load %s: %s"), filename, dlerror());
#ifdef HAVE_DLFCN_H
error (_("Could not load %s: %s"), filename, dlerror());
@@
-99,37
+90,25
@@
gdb_dlopen (const char *filename)
}
void *
}
void *
-gdb_dlsym (
void *
handle, const char *symbol)
+gdb_dlsym (
const gdb_dlhandle_up &
handle, const char *symbol)
{
#ifdef HAVE_DLFCN_H
{
#ifdef HAVE_DLFCN_H
- return dlsym (handle, symbol);
+ return dlsym (handle
.get ()
, symbol);
#elif __MINGW32__
#elif __MINGW32__
- return (void *) GetProcAddress (
handle
, symbol);
+ return (void *) GetProcAddress (
(HMODULE) handle.get ()
, symbol);
#endif
}
#endif
}
-int
-gdb_dlclose (void *handle)
+void
+dlclose_deleter::operator() (void *handle) const
{
#ifdef HAVE_DLFCN_H
{
#ifdef HAVE_DLFCN_H
-
return
dlclose (handle);
+ dlclose (handle);
#elif __MINGW32__
#elif __MINGW32__
-
return !((int) FreeLibrary (handle)
);
+
FreeLibrary ((HMODULE) handle
);
#endif
}
#endif
}
-static void
-do_dlclose_cleanup (void *handle)
-{
- gdb_dlclose (handle);
-}
-
-struct cleanup *
-make_cleanup_dlclose (void *handle)
-{
- return make_cleanup (do_dlclose_cleanup, handle);
-}
-
int
is_dl_available (void)
{
int
is_dl_available (void)
{