I have a strange problem. I am using a factory registration template that refers internally to std :: map. I use this approach for several components, and registration occurs at several points in different compilation units (aka.cpp files). This happens during static initialization time of variables (before calling "main"). For some strange reason, I get segfault when I mean
map[key] = value;
(basically when I register a specific pfn). Now, if I translate the registration for these specific problematic components in one compilation unit, everything works. Again, if I delay the registration of just one component, I get segfault.
I have to say that this is not the first time I use this template and it works for the same executable for other components (i.e. components distributed through several .cpp for another type of factory are registered during initialization no problem, using mostly the same source code).
what should I do? At the moment, I left component registration in the same .cpp (and it works flawlessly). What is the best way to explore?
I am using g ++ (Ubuntu / Linaro 4.4.4-14ubuntu5) 4.4.5
Below stacktrace
0x00007ffff793da1a in std :: _ Rb_tree_decrement (std :: _ Rb_tree_node_base *) () from /usr/lib/libstdc++.so.6
(gdb) bt
# 0 0x00007ffff793da1a in std :: _ Rb_tree_decrement (std :: _ Rb_tree_node_base *) () from /usr/lib/libstdc++.so.6
#1 0x0000000000413fe9 in std::_Rb_tree_iterator, std::allocator > const, http::servlet* (*)()> >::operator-- (
this=0x7fffffffdff0) at /usr/include/c++/4.4/bits/stl_tree.h:199
#2 0x000000000041379d in std::_Rb_tree, std::allocator >, std::pair, std::allocator > const, http::servlet* (*)()>, std::_Select1st, std::allocator > const, http::servlet* (*)()> >, std::less, std::allocator > >, std::allocator, std::allocator > const, http::servlet* (*)()> > >::_M_insert_unique (this=0x632a20, __v=...) at /usr/include/c++/4.4/bits/stl_tree.h:1179
#3 0x00000000004125f2 in std::_Rb_tree, std::allocator >, std::pair, std::allocator > const, http::servlet* (*)()>, std::_Select1st, std::allocator > const, http::servlet* (*)()> >, std::less, std::allocator > >, std::allocator, std::allocator > const, http::servlet* (*)()> > >::_M_insert_unique_ (this=0x632a20, __position=..., __v=...) at /usr/include/c++/4.4/bits/stl_tree.h:1217
#4 0x00000000004116c4 in std::map, std::allocator >, http::servlet* (*)(), std::less, std::allocator > >, std::allocator, std::allocator > const, http::servlet* (*)()> > >::insert (
this=0x632a20, __position=..., __x=...) at /usr/include/c++/4.4/bits/stl_map.h:540
#5 0x0000000000410a63 in std::map, std::allocator >, http::servlet* (*)(), std::less, std::allocator > >, std::allocator, std::allocator > const, http::servlet* (*)()> > >::operator[] (
this=0x632a20, __k=...) at /usr/include/c++/4.4/bits/stl_map.h:450
#6 0x000000000040e3b1 in http::servlet::add_creator (type=0x4234d0 "/gpu/european_opt_xyz", func=0x421567 )
at ./src/http.cpp:336