From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7705 invoked by alias); 24 Jul 2011 16:00:14 -0000 Received: (qmail 7383 invoked by uid 22791); 24 Jul 2011 16:00:09 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from mail-pz0-f52.google.com (HELO mail-pz0-f52.google.com) (209.85.210.52) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 24 Jul 2011 15:59:53 +0000 Received: by pzd13 with SMTP id 13so6313649pzd.25 for ; Sun, 24 Jul 2011 08:59:53 -0700 (PDT) Received: by 10.68.19.193 with SMTP id h1mr6463035pbe.419.1311523191914; Sun, 24 Jul 2011 08:59:51 -0700 (PDT) Received: from localhost.localdomain ([203.110.240.178]) by mx.google.com with ESMTPS id p7sm3758423pbn.65.2011.07.24.08.59.49 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 24 Jul 2011 08:59:51 -0700 (PDT) From: Sanjoy Das To: gdb-patches@sourceware.org Cc: Sanjoy Das Subject: [PATCH 4/4] Adds platform agnostic dynamic loading code. Date: Sun, 24 Jul 2011 17:41:00 -0000 Message-Id: <1311523427-20501-5-git-send-email-sanjoy@playingwithpointers.com> In-Reply-To: <1311523427-20501-1-git-send-email-sanjoy@playingwithpointers.com> References: <1311523427-20501-1-git-send-email-sanjoy@playingwithpointers.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-07/txt/msg00670.txt.bz2 Adds gdb-dlfcn.h and gdb-dlfcn.c which implement gdb_dlopen, gdb_dlsym and gdb_dlclose for POSIX and windows systems differently. This provides a compatibility layer between the platforms. gdb/ChangeLog * gdb-dlfcn.h, gdb-dlfcn.c: New. * Makefile.in: Add gdb_dlcfn.c and gdb_dlcfn.h to the build system. * configure.ac, config.in: Check for -ldl and accordingly define HAVE_LIBDL. --- gdb/ChangeLog | 6 ++++++ gdb/Makefile.in | 6 +++--- gdb/config.in | 3 +++ gdb/configure | 45 +++++++++++++++++++++++++++++++++++++++++++++ gdb/configure.ac | 1 + 5 files changed, 58 insertions(+), 3 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 656a42d..a0ddab4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2011-07-24 Sanjoy Das + * gdb-dlfcn.h, gdb-dlfcn.c: New. + * Makefile.in: Add gdb_dlcfn.c and gdb_dlcfn.h to the build system. + * configure.ac, config.in: Check for -ldl and accordingly define HAVE_LIBDL. + +2011-07-24 Sanjoy Das + * gdb.texinfo: Some documentation about the new JIT debug info reader functionality. 2011-07-24 Sanjoy Das diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 7ed6136..edbf0bc 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -739,7 +739,7 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \ annotate.c common/signals.c copying.c dfp.c gdb.c inf-child.c \ regset.c sol-thread.c windows-termcap.c \ common/common-utils.c common/xml-utils.c \ - common/ptid.c common/buffer.c + common/ptid.c common/buffer.c gdb-dlfcn.c LINTFILES = $(SFILES) $(YYFILES) $(CONFIG_SRCS) init.c @@ -820,7 +820,7 @@ solib-darwin.h solib-ia64-hpux.h solib-spu.h windows-nat.h xcoffread.h \ gnulib/extra/arg-nonnull.h gnulib/extra/c++defs.h gnulib/extra/warn-on-use.h \ gnulib/stddef.in.h inline-frame.h \ common/common-utils.h common/xml-utils.h common/buffer.h common/ptid.h \ -common/linux-osdata.h +common/linux-osdata.h gdb-dlfcn.h # Header files that already have srcdir in them, or which are in objdir. @@ -907,7 +907,7 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \ target-descriptions.o target-memory.o xml-tdesc.o xml-builtin.o \ inferior.o osdata.o gdb_usleep.o record.o gcore.o \ jit.o progspace.o \ - common-utils.o buffer.o ptid.o + common-utils.o buffer.o ptid.o gdb-dlfcn.o TSOBS = inflow.o diff --git a/gdb/config.in b/gdb/config.in index 8862144..92dbb15 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -985,3 +985,6 @@ /* The directory to search for JIT debug info reader plugins. */ #undef GDB_JIT_READER_PATH + +/* Define if -ldl will work. */ +#undef HAVE_LIBDL diff --git a/gdb/configure b/gdb/configure index 3d984c7..ea84519 100755 --- a/gdb/configure +++ b/gdb/configure @@ -9935,6 +9935,51 @@ _ACEOF +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if test "${ac_cv_lib_dl_dlopen+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBDL 1 +_ACEOF + + LIBS="-ldl $LIBS" + +fi + ac_config_files="$ac_config_files jit-reader.h:jit-reader.h.in" diff --git a/gdb/configure.ac b/gdb/configure.ac index 19263c1..8e13cfe 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -598,6 +598,7 @@ AC_DEFINE_UNQUOTED(GDB_JIT_READER_PATH, "$GDB_JIT_READER_PATH", [The directory to look for JIT debug info readers]) AC_SUBST(HOST_U_64_BIT) +AC_CHECK_LIB([dl], [dlopen], [], [], []) AC_CONFIG_FILES([jit-reader.h:jit-reader.h.in]) AC_ARG_WITH(expat, -- 1.7.5.4