Ryan Johnson | 2 Feb 2012 15:52
Picon
Picon
Favicon

Possibility to add dlinfo() to dlfcn.h?

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 | 2 Feb 2012 16:25
Favicon

Re: Possibility to add dlinfo() to dlfcn.h?

On Feb  2 09:52, Ryan Johnson wrote:
> 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.

> 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.
(Continue reading)

Ryan Johnson | 2 Feb 2012 16:34
Picon
Picon
Favicon

Re: Possibility to add dlinfo() to dlfcn.h?

On 02/02/2012 10:25 AM, Corinna Vinschen wrote:
> On Feb  2 09:52, Ryan Johnson wrote:
>> 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.
>
>> 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


Gmane