Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: gdb/testsuite/gdb.perf/solib.c

Issue 124383005: GDB 7.6.50 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@upstream
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gdb/testsuite/gdb.perf/single-step.py ('k') | gdb/testsuite/gdb.perf/solib.exp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/testsuite/gdb.perf/solib.c
diff --git a/gdb/testsuite/gdb.base/watchpoint-solib.c b/gdb/testsuite/gdb.perf/solib.c
similarity index 56%
copy from gdb/testsuite/gdb.base/watchpoint-solib.c
copy to gdb/testsuite/gdb.perf/solib.c
index a14c15a01f85d5f13622a8e1d698f5a2c1ce7da2..5da944d89cbe9cd2ab206aed179136e58513eb65 100644
--- a/gdb/testsuite/gdb.base/watchpoint-solib.c
+++ b/gdb/testsuite/gdb.perf/solib.c
@@ -1,6 +1,6 @@
/* This testcase is part of GDB, the GNU debugger.
- Copyright 2004, 2007, 2009-2012 Free Software Foundation, Inc.
+ Copyright (C) 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
@@ -13,7 +13,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <stdio.h>
#include <stdlib.h>
@@ -21,51 +21,63 @@
#ifdef __WIN32__
#include <windows.h>
#define dlopen(name, mode) LoadLibrary (TEXT (name))
-#ifdef _WIN32_WCE
-# define dlsym(handle, func) GetProcAddress (handle, TEXT (func))
-#else
# define dlsym(handle, func) GetProcAddress (handle, func)
-#endif
#define dlclose(handle) FreeLibrary (handle)
#else
#include <dlfcn.h>
#endif
+static void **handles;
-void open_shlib ()
+void
+do_test_load (int number)
{
- void *handle;
- void (*foo) (int);
+ char libname[40];
+ int i;
- handle = dlopen (SHLIB_NAME, RTLD_LAZY);
-
- if (!handle)
+ handles = malloc (sizeof (void *) * number);
+ if (handles == NULL)
{
-#ifdef __WIN32__
- fprintf (stderr, "error %d occurred\n", GetLastError ());
-#else
- fprintf (stderr, "%s\n", dlerror ());
-#endif
- exit (1);
+ printf ("ERROR on malloc\n");
+ exit (-1);
}
- foo = (void (*)(int))dlsym (handle, "foo");
-
- if (!foo)
+ for (i = 0; i < number; i++)
{
- fprintf (stderr, "%s\n", dlerror ());
- exit (1);
+ sprintf (libname, "solib-lib%d", i);
+ handles[i] = dlopen (libname, RTLD_LAZY);
+ if (handles[i] == NULL)
+ {
+ printf ("ERROR on dlopen %s\n", libname);
+ exit (-1);
+ }
}
+}
+
+void
+do_test_unload (int number)
+{
+ int i;
- foo (1); // call to foo
- foo (2);
+ /* Unload shared libraries in different orders. */
+#ifndef SOLIB_DLCLOSE_REVERSED_ORDER
+ for (i = 0; i < number; i++)
+#else
+ for (i = number - 1; i >= 0; i--)
+#endif
+ dlclose (handles[i]);
- dlclose (handle);
+ free (handles);
}
+static void
+end (void)
+{}
-int main()
+int
+main (void)
{
- open_shlib ();
+ end ();
+
return 0;
}
« no previous file with comments | « gdb/testsuite/gdb.perf/single-step.py ('k') | gdb/testsuite/gdb.perf/solib.exp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698