From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3722 invoked by alias); 22 Jul 2011 16:35:28 -0000 Received: (qmail 3704 invoked by uid 22791); 22 Jul 2011 16:35:26 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 22 Jul 2011 16:35:11 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id E98F82BB3EE; Fri, 22 Jul 2011 12:35:09 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id VJBUVu3L-rQ4; Fri, 22 Jul 2011 12:35:09 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id B01C02BB3E9; Fri, 22 Jul 2011 12:35:09 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id C9A8C145615; Fri, 22 Jul 2011 09:35:06 -0700 (PDT) Date: Fri, 22 Jul 2011 16:42:00 -0000 From: Joel Brobecker To: Tom Tromey Cc: Sanjoy Das , gdb-patches@sourceware.org Subject: Re: [PATCH 2/2] Add symbol-handling callbacks to the jit-reader interface. Message-ID: <20110722163506.GB5177@adacore.com> References: <1310588446-23904-1-git-send-email-sanjoy@playingwithpointers.com> <1310588446-23904-2-git-send-email-sanjoy@playingwithpointers.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) 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/msg00623.txt.bz2 > Sanjoy> +#include > > I assume this isn't portable. > > You could either lift the needed code from GCC's plugin interface, or I > suppose use libtool's libltdl. There was a similar need for the VxWorks port, that I have yet to rebase, retest, and commit :-(. In any case, I thought it would be very easy to create gdb_dlfcn.h/c: | #ifdef HAVE_LIBDL | #include | #elif __MINGW32__ | #include | #else | /* Unsupported configuration. See Eg. gdb_dlopen for details. */ | #error API to load shared library missing (Eg. libdl) | #endif | | /* Load the dynamic library file named FILENAME, and return a handle | for that dynamic library. Return NULL if the loading fails for | any reason. */ | | static void * | gdb_dlopen (const char *filename) | { | #ifdef HAVE_LIBDL | return dlopen (filename, RTLD_NOW); | #elif __MINGW32__ | return (void *) LoadLibrary (filename); | #endif | } | | /* Return the address of the symbol named SYMBOL inside the shared library | whose handle is HANDLE. Return NULL when the symbol could not be found. */ | | static void * | gdb_dlsym(void *handle, const char *symbol) | { | #ifdef HAVE_LIBDL | return dlsym (handle, symbol); | #elif __MINGW32__ | return (void *) GetProcAddress (handle, symbol); | #endif | } -- Joel