Index: gdb/testsuite/gdb.threads/dlopen-libpthread.c |
diff --git a/gdb/testsuite/gdb.cp/infcall-dlopen.cc b/gdb/testsuite/gdb.threads/dlopen-libpthread.c |
similarity index 67% |
copy from gdb/testsuite/gdb.cp/infcall-dlopen.cc |
copy to gdb/testsuite/gdb.threads/dlopen-libpthread.c |
index 024eb046c0dbd47a1e0015361f006961654e5376..7d6c00e2a15eec75f37b90eb844cfabe4833bc32 100644 |
--- a/gdb/testsuite/gdb.cp/infcall-dlopen.cc |
+++ b/gdb/testsuite/gdb.threads/dlopen-libpthread.c |
@@ -1,6 +1,6 @@ |
/* This testcase is part of GDB, the GNU debugger. |
- Copyright 2010-2012 Free Software Foundation, Inc. |
+ Copyright 2011-2013 Free Software Foundation, Inc. |
This program is free software; you can redistribute it and/or modify |
it under the terms of the GNU General Public License as published by |
@@ -17,27 +17,30 @@ |
#include <dlfcn.h> |
#include <stddef.h> |
+#include <assert.h> |
-static int |
-openlib (const char *filename) |
-{ |
- void *h = dlopen (filename, RTLD_LAZY); |
- |
- if (filename == NULL) |
- return 0; |
+static const char *volatile filename; |
- if (h == NULL) |
- return 0; |
- if (dlclose (h) != 0) |
- return 0; |
- return 1; |
+static void |
+notify (void) |
+{ |
+ filename = NULL; /* notify-here */ |
} |
int |
main (void) |
{ |
- /* Dummy call to get the function always compiled in. */ |
- openlib (NULL); |
+ void *h; |
+ void (*fp) (void (*) (void)); |
+ |
+ assert (filename != NULL); |
+ h = dlopen (filename, RTLD_LAZY); |
+ assert (h != NULL); |
+ |
+ fp = dlsym (h, "f"); |
+ assert (fp != NULL); |
+ |
+ fp (notify); |
return 0; |
} |