Subject: Re: [1.7] Possible dynamic linker error
From: Charles Plager <[email-masked]>
To: [email-masked]
Cc: [email-masked], [email-masked]
Date: Fri, 11 Dec 2009 12:13:12 -0600
List-Id: <cygwin.cygwin.com>

David Korn wrote:
>> - I ran rebaseall on cygwin and all of the dlls in questions.  It still
>> crashes, but now crashes somewhere else.
> 
>   Ah!  Reinstall your libstdc++ dll.  Yaakov spotted that the 4.3.4-1
> libstdc++ dll isn't rebaseable, as it turns out there's a bug in LD(*).
> 
>   I'm just doing final testing on a new release to fix the problem, but until
> that's out, the current libstdc++ dll will have to be reinstalled if it gets
> rebased.

O.k.  Copying 'cygstdc++-6.dll' did "restore" the original problem (as 
well as allowed the "statically-linked" executable to work again).

>> libraries were compiled by me on the same machine using gcc4.3.4).  When
>> looking at the problem using GDB, it says it is now going to jump to
>> subroutine A (finishConstruction()), but instead jumps to subroutine B
>> (edm::ValueMap<double>::operator+=).
> 
>   This could be just the ordinary sort of thing that goes on when you compile
> with optimisation (and hence inlining) turned on.  It looks from the earlier
> lines like it's just constructed a std::map as part of the PluginFactory or
> PluginFactoryBase constructors, so if that edm::ValueMap is a derivation of
> std::map it might well be that finishConstruction() is correctly invoking the
> += operator to append an item, and gdb is showing you the source of the
> inlined operator function.
> 
>   So I think first thing you need to do is figure out if maybe it's actually
> going the right code path, and has gotten something wrong with the value of j.
>  Check the value of $eip before and after that final step command and find out
> exactly where you're running.

 From my friend Chris:
> 	The edm::ValueMap is not a 'derivation' of std::map, in fact it 
> doesn't even use it.  Also, finishConstruction() is not inlined [since 
> it is defined in a .cc file] and therefore has to be called directly.

So between the fact that the statically linked executable works and the 
above, it really does look like the code is jumping to the wrong 
function.  I'm attaching the another gdb session where I look at $eip 
before and after to see if that provides any clues.  Do you have any 
other ideas?  Is the dll simply too big?

	Thanks,
	  Charles

* "statically linked" just means that we don't dynamically link to the 
400 Mb dll, but rather compile in those .o files.  We still statically 
link to the rest of the libraries shown in:
http://cygwin.com/ml/cygwin/2009-12/msg00275.html

p.s. Since I'm not on the mailing list, is there a way to have a 
particular message sent to me so I can respond to it and not screw up 
the threading?

cplager@Hagrid> gdb ./cmsShow_dynamic.exe
GNU gdb 6.8.0.20080328-cvs (cygwin-special)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-cygwin"...
(gdb) run
Starting program: /mount/cplagerdoc/cplager/build/cmsShow34g/cmsShow_dynamic.exe
[New thread 4464.0x1140]
[New thread 4464.0x135c]

Program received signal SIGSEGV, Segmentation fault.
0x3e61a46a in edm::helper::Filler<edm::ValueMap<double> >::add ()
   from /mount/cplagerdoc/cplager/build/cmsShow34g/libCMSDataFormats.dll
(gdb) break 'edmplugin::PluginFactory<FWRPZDataProxyBuilderBase* ()()>::get ()'
Breakpoint 1 at 0x69d6e580: file src/Fireworks/Core/src/FWRPZDataProxyBuilderBaseFactory.cc, line 20.
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y

Starting program: /mount/cplagerdoc/cplager/build/cmsShow34g/cmsShow_dynamic.exe
[New thread 4488.0xa28]
Error in re-setting breakpoint 1: Function "edmplugin::PluginFactory<FWRPZDataProxyBuilderBase* ()()>::get ()" not defined.
[New thread 4488.0xaa0]

Program received signal SIGSEGV, Segmentation fault.
0x3e61a46a in edm::helper::Filler<edm::ValueMap<double> >::add ()
   from /mount/cplagerdoc/cplager/build/cmsShow34g/libCMSDataFormats.dll
(gdb) where
#0  0x3e61a46a in edm::helper::Filler<edm::ValueMap<double> >::add ()
   from /mount/cplagerdoc/cplager/build/cmsShow34g/libCMSDataFormats.dll
#1  0x3e61a828 in edm::helper::Filler<edm::ValueMap<double> >::Filler ()
   from /mount/cplagerdoc/cplager/build/cmsShow34g/libCMSDataFormats.dll
#2  0x3e6bf8fa in edm::ValueMap<double>::add ()
   from /mount/cplagerdoc/cplager/build/cmsShow34g/libCMSDataFormats.dll
#3  0x3e6bfae0 in edm::ValueMap<double>::operator+= ()
   from /mount/cplagerdoc/cplager/build/cmsShow34g/libCMSDataFormats.dll
#4  0x3864d07b in edmplugin::PluginFactory<FWRPZDataProxyBuilderBase* ()()>::PluginFactory ()
   from /mount/cplagerdoc/cplager/build/cmsShow34g/libCMSShow.dll
#5  0x384ee5bb in edmplugin::PluginFactory<FWRPZDataProxyBuilderBase* ()()>::get ()
   from /mount/cplagerdoc/cplager/build/cmsShow34g/libCMSShow.dll
#6  0x3864c223 in edmplugin::PluginFactory<FWRPZDataProxyBuilderBase* ()()>::PMaker<FWVertexRPZProxyBuilder>::PMaker () from /mount/cplagerdoc/cplager/build/cmsShow34g/libCMSShow.dll
#7  0x38571b7a in __static_initialization_and_destruction_0 ()
   from /mount/cplagerdoc/cplager/build/cmsShow34g/libCMSShow.dll
#8  0x38571d9c in global constructors keyed to _ZN23FWVertexRPZProxyBuilderC2Ev ()
   from /mount/cplagerdoc/cplager/build/cmsShow34g/libCMSShow.dll
#9  0x610203c3 in per_module::run_ctors () from /usr/bin/cygwin1.dll
#10 0x006aa727 in ?? ()
#11 0x610204b0 in dll::init () from /usr/bin/cygwin1.dll
#12 0x00000000 in ?? ()
(gdb) break 'edmplugin::PluginFactory<FWRPZDataProxyBuilderBase* ()()>::PluginFactory ()'
Breakpoint 2 at 0x3864d05c
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y

Starting program: /mount/cplagerdoc/cplager/build/cmsShow34g/cmsShow_dynamic.exe
[New thread 5280.0x1370]
[New thread 5280.0x1398]

Breakpoint 2, 0x3864d05c in edmplugin::PluginFactory<FWRPZDataProxyBuilderBase* ()()>::PluginFactory ()
   from /mount/cplagerdoc/cplager/build/cmsShow34g/libCMSShow.dll
(gdb) $eip
Undefined command: "$eip".  Try "help".
(gdb) show $eip
Undefined show command: "$eip".  Try "help show".
(gdb) help
List of classes of commands:

aliases -- Aliases of other commands
breakpoints -- Making program stop at certain points
data -- Examining data
files -- Specifying and examining files
internals -- Maintenance commands
obscure -- Obscure features
running -- Running the program
stack -- Examining the stack
status -- Status inquiries
support -- Support facilities
tracepoints -- Tracing of program execution without stopping the program
user-defined -- User-defined commands

Type "help" followed by a class name for a list of commands in that class.
Type "help all" for the list of all commands.
Type "help" followed by command name for full documentation.
Type "apropos word" to search for commands related to "word".
Command name abbreviations are allowed if unambiguous.
(gdb) status $eip
Undefined command: "status".  Try "help".
(gdb) i reg
eax            0x1      1
ecx            0x6aa7e0 6989792
edx            0x0      0
ebx            0x387e0710       947783440
esp            0x22cbe0 0x22cbe0
ebp            0x22cc08 0x22cc08
esi            0x386c8640       946636352
edi            0x6115dfef       1628823535
eip            0x3864d05c       0x3864d05c <edmplugin::PluginFactory<FWRPZDataProxyBuilderBase* ()()>::PluginFactory()+8>
eflags         0x202    [ IF ]
cs             0x1b     27
ss             0x23     35
ds             0x23     35
es             0x23     35
fs             0x3b     59
gs             0x0      0
(gdb) step
Single stepping until exit from function _ZN9edmplugin13PluginFactoryIFP25FWRPZDataProxyBuilderBasevEEC1Ev,
which has no line number information.

Program received signal SIGSEGV, Segmentation fault.
0x3e61a46a in edm::helper::Filler<edm::ValueMap<double> >::add ()
   from /mount/cplagerdoc/cplager/build/cmsShow34g/libCMSDataFormats.dll
(gdb) i reg
eax            0x0      0
ecx            0xc78b3d10       -947176176
edx            0x0      0
ebx            0x387e0710       947783440
esp            0x22cab0 0x22cab0
ebp            0x22cb48 0x22cb48
esi            0x386c8640       946636352
edi            0x6115dfef       1628823535
eip            0x3e61a46a       0x3e61a46a <edm::helper::Filler<edm::ValueMap<double> >::add(edm::ValueMap<double> const&)+98>
eflags         0x10282  [ SF IF RF ]
cs             0x1b     27
ss             0x23     35
ds             0x23     35
es             0x23     35
fs             0x3b     59
gs             0x0      0
(gdb) q
The program is running.  Exit anyway? (y or n) y
cplager@Hagrid>

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple