debuggers: convert to opal_dl interface
Этот коммит содержится в:
родитель
a9d86129c6
Коммит
c683500a29
@ -9,7 +9,7 @@
|
|||||||
# University of Stuttgart. All rights reserved.
|
# University of Stuttgart. All rights reserved.
|
||||||
# Copyright (c) 2004-2005 The Regents of the University of California.
|
# Copyright (c) 2004-2005 The Regents of the University of California.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
# Copyright (c) 2007-2013 Cisco Systems, Inc. All rights reserved.
|
# Copyright (c) 2007-2015 Cisco Systems, Inc. All rights reserved.
|
||||||
# $COPYRIGHT$
|
# $COPYRIGHT$
|
||||||
#
|
#
|
||||||
# Additional copyrights may follow
|
# Additional copyrights may follow
|
||||||
@ -20,10 +20,7 @@
|
|||||||
noinst_LTLIBRARIES = libdebuggers.la libompi_debugger_canary.la
|
noinst_LTLIBRARIES = libdebuggers.la libompi_debugger_canary.la
|
||||||
ompilib_LTLIBRARIES = libompi_dbg_msgq.la
|
ompilib_LTLIBRARIES = libompi_dbg_msgq.la
|
||||||
|
|
||||||
check_PROGRAMS = predefined_gap_test predefined_pad_test
|
check_PROGRAMS = predefined_gap_test predefined_pad_test dlopen_test
|
||||||
if OPAL_HAVE_DLOPEN
|
|
||||||
check_PROGRAMS += dlopen_test
|
|
||||||
endif
|
|
||||||
|
|
||||||
TESTS = $(check_PROGRAMS)
|
TESTS = $(check_PROGRAMS)
|
||||||
|
|
||||||
@ -44,11 +41,10 @@ headers = \
|
|||||||
msgq_interface.h ompi_msgq_dll_defs.h
|
msgq_interface.h ompi_msgq_dll_defs.h
|
||||||
|
|
||||||
# Simple checks to ensure that the DSOs are functional
|
# Simple checks to ensure that the DSOs are functional
|
||||||
# This test is only built if we have libltdl support.
|
|
||||||
|
|
||||||
dlopen_test_SOURCES = dlopen_test.c
|
dlopen_test_SOURCES = dlopen_test.c
|
||||||
dlopen_test_CPPFLAGS = -I$(top_srcdir)/opal/libltdl
|
dlopen_test_LDADD = $(top_builddir)/ompi/libmpi.la
|
||||||
dlopen_test_LDADD = $(top_builddir)/opal/libltdl/libltdlc.la
|
dlopen_test_DEPENDENCIES = $(ompi_predefined_LDADD)
|
||||||
|
|
||||||
predefined_gap_test_SOURCES = predefined_gap_test.c
|
predefined_gap_test_SOURCES = predefined_gap_test.c
|
||||||
predefined_gap_test_LDFLAGS = $(WRAPPER_EXTRA_LDFLAGS)
|
predefined_gap_test_LDFLAGS = $(WRAPPER_EXTRA_LDFLAGS)
|
||||||
|
Двоичные данные
ompi/debuggers/core.lt-dlopen_test-1424445474-6373
Обычный файл
Двоичные данные
ompi/debuggers/core.lt-dlopen_test-1424445474-6373
Обычный файл
Двоичный файл не отображается.
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2009-2010 Cisco Systems, Inc. All rights reserved.
|
* Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
* Additional copyrights may follow
|
* Additional copyrights may follow
|
||||||
@ -13,9 +13,10 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "opal/libltdl/ltdl.h"
|
#include "opal/runtime/opal.h"
|
||||||
|
#include "opal/mca/dl/base/base.h"
|
||||||
|
|
||||||
#if !OPAL_WANT_LIBLTDL
|
#if !OPAL_HAVE_DL_SUPPORT
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
/* If OPAL wasn't built with libltdl support, then skip this test */
|
/* If OPAL wasn't built with libltdl support, then skip this test */
|
||||||
@ -23,7 +24,36 @@ int main(int argc, char *argv[])
|
|||||||
return 77;
|
return 77;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* OPAL_WANT_LIBLTDL */
|
#else /* OPAL_HAVE_DL_SUPPORT */
|
||||||
|
|
||||||
|
static int try_open(const char *filename)
|
||||||
|
{
|
||||||
|
char *err_msg;
|
||||||
|
opal_dl_handle_t *handle;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = opal_dl_open(filename, true, true, &handle, &err_msg);
|
||||||
|
if (OPAL_SUCCESS == ret) {
|
||||||
|
opal_dl_close(handle);
|
||||||
|
printf("File opened with private namespace, all passed\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Failed to open with private namespace: %s\n", err_msg);
|
||||||
|
printf("Retrying with global namespace\n");
|
||||||
|
|
||||||
|
ret = opal_dl_open(filename, true, false, &handle, &err_msg);
|
||||||
|
if (OPAL_SUCCESS == ret) {
|
||||||
|
opal_dl_close(handle);
|
||||||
|
printf("File opened with global namespace\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(stderr, "File failed to open with global namespace: %s\n",
|
||||||
|
err_msg);
|
||||||
|
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
static int do_test(void)
|
static int do_test(void)
|
||||||
{
|
{
|
||||||
@ -32,11 +62,6 @@ static int do_test(void)
|
|||||||
char full_filename[] = "./libompi_dbg_msgq.la";
|
char full_filename[] = "./libompi_dbg_msgq.la";
|
||||||
char line[1024];
|
char line[1024];
|
||||||
int happy;
|
int happy;
|
||||||
lt_dlhandle dlhandle;
|
|
||||||
|
|
||||||
#if OPAL_HAVE_LTDL_ADVISE
|
|
||||||
lt_dladvise dladvise;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Double check that the .la file is there that we expect; if it's
|
/* Double check that the .la file is there that we expect; if it's
|
||||||
not, skip this test. */
|
not, skip this test. */
|
||||||
@ -74,60 +99,41 @@ static int do_test(void)
|
|||||||
exit(77);
|
exit(77);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Startup LT */
|
char cwd[4096];
|
||||||
if (lt_dlinit() != 0) {
|
getcwd(cwd, sizeof(cwd) - 1);
|
||||||
fprintf(stderr, "Failed to lt_dlinit\n");
|
cwd[sizeof(cwd) - 1] = '\0';
|
||||||
return 1;
|
printf("Running in CWD: %s\n", cwd);
|
||||||
}
|
|
||||||
|
|
||||||
printf("Trying to lt_dlopen file with dladvise_local: %s\n", filename);
|
printf("Trying to open file with private namespace: %s\n", filename);
|
||||||
|
|
||||||
#if OPAL_HAVE_LTDL_ADVISE
|
/* If that works, great */
|
||||||
if (lt_dladvise_init(&dladvise) ||
|
if (0 == try_open(filename)) {
|
||||||
lt_dladvise_ext(&dladvise) ||
|
|
||||||
lt_dladvise_local(&dladvise)) {
|
|
||||||
fprintf(stderr, "lt_dladvise failed to initialize properly\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
dlhandle = lt_dlopenadvise(filename, dladvise);
|
|
||||||
lt_dladvise_destroy(&dladvise);
|
|
||||||
#else
|
|
||||||
dlhandle = lt_dlopenext(filename);
|
|
||||||
#endif
|
|
||||||
if (NULL != dlhandle) {
|
|
||||||
lt_dlclose(dlhandle);
|
|
||||||
printf("File opened with dladvise_local, all passed\n");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Failed to open with dladvise_local: %s\n", lt_dlerror());
|
/* If we're using libltdl, it will find the .la file and may
|
||||||
printf("Retrying with dladvise_global\n");
|
discover that it needs to open the actual file in the .libs
|
||||||
|
directory. If we're not using libltdl, then we won't know
|
||||||
#if OPAL_HAVE_LTDL_ADVISE
|
about the magic .la file / .libs directory. Hueristic: if we
|
||||||
if (lt_dladvise_init(&dladvise) ||
|
get here, manually prefix the filename with .libs/ and try
|
||||||
lt_dladvise_ext(&dladvise) ||
|
again. */
|
||||||
lt_dladvise_global(&dladvise)) {
|
char *rel_filename;
|
||||||
fprintf(stderr, "lt_dladvise failed to initialize properly\n");
|
asprintf(&rel_filename, ".libs/%s", filename);
|
||||||
|
if (NULL == rel_filename) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
dlhandle = lt_dlopenadvise(filename, dladvise);
|
int rc = try_open(rel_filename);
|
||||||
lt_dladvise_destroy(&dladvise);
|
free(rel_filename);
|
||||||
#else
|
|
||||||
dlhandle = lt_dlopenext(filename);
|
|
||||||
#endif
|
|
||||||
if (NULL != dlhandle) {
|
|
||||||
lt_dlclose(dlhandle);
|
|
||||||
printf("File opened with dladvise_global\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
fprintf(stderr, "File failed to open with dladvise_global: %s\n",
|
|
||||||
lt_dlerror());
|
|
||||||
|
|
||||||
return 2;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
return do_test();
|
opal_init(&argc, &argv);
|
||||||
|
int ret = do_test();
|
||||||
|
opal_finalize();
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
#endif /* OPAL_WANT_LIBLTDL */
|
#endif /* OPAL_HAVE_DL_SUPPORT */
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user