Discussion:
Possibility to add dlinfo() to dlfcn.h?
Ryan Johnson
2012-02-02 14:52:03 UTC
Permalink
Hi all,

Before I go off hacking code, is there a particular reason dlinfo() is
missing from cygwin's dlfcn.h, other than SHTDI? I know it's not
strictly a posix function, but it is present in the linux systems I have
access to and can be rather handy. I considered parsing /proc/$$/maps,
but that doesn't guarantee the module is actually loaded (as opposed to
merely mmapped).

Based on past tangles with cygwin's underbelly I would think some
boilerplate surrounding a call to GetLoadedModules() would suffice.

Thoughts?
Ryan
Corinna Vinschen
2012-02-02 15:25:40 UTC
Permalink
Post by Ryan Johnson
Hi all,
Before I go off hacking code, is there a particular reason dlinfo()
is missing from cygwin's dlfcn.h, other than SHTDI? I know it's not
I guess it's a case of SHTNI, too, with N == notice or need. After
all, it doesn't even have a man page.
Post by Ryan Johnson
strictly a posix function, but it is present in the linux systems I
have access to and can be rather handy. I considered parsing
/proc/$$/maps, but that doesn't guarantee the module is actually
loaded (as opposed to merely mmapped).
Based on past tangles with cygwin's underbelly I would think some
boilerplate surrounding a call to GetLoadedModules() would suffice.
Not sure about that. What do you want this function for? What's
your use case? Reading the info in dlfcn.h, I don't see how this
function can be useful under Windows:

RTLD_DI_LMID We have no namespace ID
RTLD_DI_LINKMAP Possible, except l_ld doesn't mean anything
RTLD_DI_CONFIGADDR ?
RTLD_DI_SERINFO Would return the DLL search path.
RTLD_DI_SERINFOSIZE Ditto, sizeof
RTLD_DI_ORIGIN There is no $ORIGIN
RTLD_DI_PROFILENAME ?
RTLD_DI_PROFILEOUT ?
RTLD_DI_TLS_MODID We have no PT_TLS segment, and no TLS relocations.
RTLD_DI_TLS_DATA Ditto

Looks like only RTLD_DI_LINKMAP and RTLD_DI_SERINFO{SIZE} may be of
any use. But still, what's your use case?


Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
Ryan Johnson
2012-02-02 15:34:37 UTC
Permalink
Post by Corinna Vinschen
Post by Ryan Johnson
Hi all,
Before I go off hacking code, is there a particular reason dlinfo()
is missing from cygwin's dlfcn.h, other than SHTDI? I know it's not
I guess it's a case of SHTNI, too, with N == notice or need. After
all, it doesn't even have a man page.
Post by Ryan Johnson
strictly a posix function, but it is present in the linux systems I
have access to and can be rather handy. I considered parsing
/proc/$$/maps, but that doesn't guarantee the module is actually
loaded (as opposed to merely mmapped).
Based on past tangles with cygwin's underbelly I would think some
boilerplate surrounding a call to GetLoadedModules() would suffice.
Not sure about that. What do you want this function for? What's
your use case?
Sorry, you're right -- I'd mostly be interested in the linkmap, and
forgot about the other request types. I'm hoping the former would help
introspect unwind sections to construct accurate backtraces from within
an app. No big deal, tho. I'll play on a linux machine until I see
whether it's compelling enough to be worth porting to cygwin.

Thanks!
Ryan

Loading...