Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Tom Tromey <tromey@redhat.com>
Cc: Sanjoy Das <sanjoy@playingwithpointers.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 2/2] Add symbol-handling callbacks to the jit-reader interface.
Date: Fri, 22 Jul 2011 16:42:00 -0000	[thread overview]
Message-ID: <20110722163506.GB5177@adacore.com> (raw)
In-Reply-To: <m3y600dakq.fsf@fleche.redhat.com>

> Sanjoy> +#include <dlfcn.h>
> 
> 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 <dlfcn.h>
| #elif __MINGW32__
| #include <windows.h>
| #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


  reply	other threads:[~2011-07-22 16:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-13 20:23 [PATCH 1/2] jit-reader.h: describe interface implemented by the JIT readers Sanjoy Das
2011-07-13 20:23 ` [PATCH 2/2] Add symbol-handling callbacks to the jit-reader interface Sanjoy Das
2011-07-14 17:54   ` Tom Tromey
2011-07-22 16:42     ` Joel Brobecker [this message]
2011-07-22 17:12       ` Tom Tromey
2011-07-14 17:43 ` [PATCH 1/2] jit-reader.h: describe interface implemented by the JIT readers Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110722163506.GB5177@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sanjoy@playingwithpointers.com \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox