Extending /proc/*/maps

Corinna Vinschen corinna-cygwin@cygwin.com
Tue Apr 19 16:01:00 GMT 2011


On Apr 19 11:38, Ryan Johnson wrote:
> Hi all,
> 
> While trying to diagnose the problems with DLL placement during
> fork(), I extended the implementation of the procfs maps file to be
> much more complete, because I noticed the existing one was not
> showing even close to everything that was going on (comparison
> below).
> 
> The official version can be summarized as follows:
> - It lists a subset of loaded dlls, as well as cygwin-mapped files.
> No other memory is shown.
> - Each mapped image or file has only one entry, with the listed
> permissions coming from the last mapped page in the file.
> - It calls GetWorkingSet, which retrieves an entry for every mapped
> page but ignores addresses which are only reserved.
> - It also calls GetModuleInformation and GetModuleFileNameExW to
> learn about loaded DLLs.
> 
> My version:
> - Uses VirtualQueryEx to identify all memory segments (reserved or
> mapped), identifying those belonging to heap or shared memory
> - Lists all loaded dlls and all mapped files, using GetMappedFileNameW
> - Uses CreateToolhelp32Snapshot to identify heap segments
> 
> I'm not sending a patch because I haven't (yet) signed the copyright
> release form, but if people are interested I will do so. Otherwise,
> I'll keep using it to debug but not bother cygwin-patches.

Please sign the copyright assignment and provide the patch.  This looks
very good to me.

> BTW, /cygdrive/c/Windows/System32/locale.nls seems to be the reason
> that even statically linked dlls don't always load in the same place
> twice in a row.

How so?  And then, when is it loaded?  I assume that this file is
fetched as soon as the GetLocaleInfo function is called.  What OS
are you using?  If it's Vista or later, there's a chance that the
LocaleNameToLCID function is the culprit as well.  But the real
problem is, how can that be worked around?  For the locale stuff
we need these functions.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat



More information about the Cygwin-developers mailing list