OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [testsuite/] [gdb.base/] [solib.c] - Diff between revs 107 and 1765

Only display areas with differences | Details | Blame | View Log

Rev 107 Rev 1765
/* This program uses HP-UX-specific features to load and unload SOM
/* This program uses HP-UX-specific features to load and unload SOM
   shared libraries that it wasn't linked against (i.e., libraries
   shared libraries that it wasn't linked against (i.e., libraries
   that the loader doesn't automatically load along with the program
   that the loader doesn't automatically load along with the program
   itself).
   itself).
   */
   */
 
 
#include <stdio.h>
#include <stdio.h>
#include <dl.h>
#include <dl.h>
 
 
int main ()
int main ()
{
{
  shl_t  solib_handle;
  shl_t  solib_handle;
  int  dummy;
  int  dummy;
  int  status;
  int  status;
  int  (*solib_main) (int);
  int  (*solib_main) (int);
 
 
  /* Load a shlib, with immediate binding of all symbols.
  /* Load a shlib, with immediate binding of all symbols.
 
 
     Note that the pathname of the loaded shlib is assumed to be relative
     Note that the pathname of the loaded shlib is assumed to be relative
     to the testsuite directory (from whence the tested GDB is run), not
     to the testsuite directory (from whence the tested GDB is run), not
     from dot/.
     from dot/.
   */
   */
  dummy = 1;  /* Put some code between shl_ calls... */
  dummy = 1;  /* Put some code between shl_ calls... */
  solib_handle = shl_load ("gdb.base/solib1.sl", BIND_IMMEDIATE, 0);
  solib_handle = shl_load ("gdb.base/solib1.sl", BIND_IMMEDIATE, 0);
 
 
  /* Find a function within the shlib, and call it. */
  /* Find a function within the shlib, and call it. */
  status = shl_findsym (&solib_handle,
  status = shl_findsym (&solib_handle,
                        "solib_main",
                        "solib_main",
                        TYPE_PROCEDURE,
                        TYPE_PROCEDURE,
                        (long *) &solib_main);
                        (long *) &solib_main);
  status = (*solib_main) (dummy);
  status = (*solib_main) (dummy);
 
 
  /* Unload the shlib. */
  /* Unload the shlib. */
  status = shl_unload (solib_handle);
  status = shl_unload (solib_handle);
 
 
  /* Load a different shlib, with deferred binding of all symbols. */
  /* Load a different shlib, with deferred binding of all symbols. */
  dummy = 2;
  dummy = 2;
  solib_handle = shl_load ("gdb.base/solib2.sl", BIND_DEFERRED, 0);
  solib_handle = shl_load ("gdb.base/solib2.sl", BIND_DEFERRED, 0);
 
 
  /* Find a function within the shlib, and call it. */
  /* Find a function within the shlib, and call it. */
  status = shl_findsym (&solib_handle,
  status = shl_findsym (&solib_handle,
                        "solib_main",
                        "solib_main",
                        TYPE_PROCEDURE,
                        TYPE_PROCEDURE,
                        (long *) &solib_main);
                        (long *) &solib_main);
  status = (*solib_main) (dummy);
  status = (*solib_main) (dummy);
 
 
  /* Unload the shlib. */
  /* Unload the shlib. */
  status = shl_unload (solib_handle);
  status = shl_unload (solib_handle);
 
 
  /* Reload the first shlib again, with deferred symbol binding this time. */
  /* Reload the first shlib again, with deferred symbol binding this time. */
  dummy = 3;
  dummy = 3;
  solib_handle = shl_load ("gdb.base/solib1.sl", BIND_IMMEDIATE, 0);
  solib_handle = shl_load ("gdb.base/solib1.sl", BIND_IMMEDIATE, 0);
 
 
  /* Unload it without trying to find any symbols in it. */
  /* Unload it without trying to find any symbols in it. */
  status = shl_unload (solib_handle);
  status = shl_unload (solib_handle);
 
 
  /* All done. */
  /* All done. */
  dummy = -1;
  dummy = -1;
  return 0;
  return 0;
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.