This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rfa:threads] Report when using libthread_db


At Thu, 7 Aug 2003 19:58:06 +0000 (UTC), "Andrew Cagney" wrote:
> Anyone know how to get a version number from libthread_db, or it's
> absolute path?

looks like there are two ways one can do this:

dlinfo() on Solaris (and other systems that have it -- but it doesn't
appear common).

dladdr() on systems that have it and this one is more widespread (incl
solaris, linux at least with -D_GNU_SOURCE, and it looks like NetBSD
has it as well).

Use dladdr like:

{
    int rv;
    Dl_info dli;
    rv = dladdr(cosine, &dli);
    printf ("rv = %d\n", rv);
    printf ("name = %s\n", dli.dli_fname);
}

(that example should drop into example provided in the RH 7.3 x86
'dlopen' manual page.  I'm not sure the original source of that manual
page, though...  8-)

(works for dlsym'd addresses, but doesn't necessarily work as one
would naively expect for symbols needed directly by the main program,
of course...)



cgd


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]