dlclose not calling destructors of static variables.

Dave Korn dave.korn.cygwin@googlemail.com
Mon Feb 1 19:59:00 GMT 2010


On 01/02/2010 19:28, Dave Korn wrote:
> On 01/02/2010 17:51, Christopher Faylor wrote:
>> On Mon, Feb 01, 2010 at 12:46:11PM -0500, Christopher Faylor wrote:
> 
>>>> Cribbing from the gdb source code, it looks like they use BaseAddrees + 
>>>> 0x1000 for the start point and then call GetModuleInformation to workout 
>>>> the size of the module.
>>> Yeah, duh.  "they" == "me".  I should have checked gdb for this since I've
>>> already done this research once before.
>>>
>>> If you do find that this works, then I think this may fall into the
>>> realm of a non-trivial patch so it may be best to just tell me what
>>> you've found rather than provide a patch - unless you want to go through
>>> the approval process with Red Hat.
>>>
>>> Or, you can just wait for me to adapt what's in gdb to cygwin.  I can do
>>> tonight when I get back to a windows system.
>> Btw, it isn't entirely clear that GetModuleInformation will work with
>> older versions of Windows NT so this may not be a complete solution.  We
>> do use GetModuleInformation in Cygwin but it is not in anything as
>> crucial as this.
> 
>   Can't we use the info in the dll struct?  It has pointers to the data and
> bss section, we could take the max out of them and the data in the M_B_I
> struct.  (Tell you what, I'll try it.)

  Yep, that makes the original testcase work for me.  How about it?

winsup/cygwin/ChangeLog:


	* dll_init.cc (remove_dll_atexit): Take pointer to dll and
	estimate end of dll more generously.
	(dll_list::detach): Update caller.

  (This is just the first patch on its way relating to this subject.)

    cheers,
      DaveK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mbi-fix.diff
Type: text/x-c
Size: 1307 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20100201/696e52f2/attachment.bin>


More information about the Cygwin-patches mailing list