This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [rfa:threads] Report when using libthread_db
- From: cgd at broadcom dot com
- To: ac131313 at redhat dot com
- Cc: "Elena Zannoni" <ezannoni at redhat dot com>,gdb-patches at sources dot redhat dot com,"Michael Elizabeth Chastain" <mec at shout dot net>
- Date: 07 Aug 2003 13:30:56 -0700
- Subject: Re: [rfa:threads] Report when using libthread_db
- References: <3F3004F7.6090003@redhat.com> <3F32AF3A.1080106@redhat.com><mailpost.1060286286.1556@news-sj1-1>
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