提高:: ASIO触发SIGSEGV中的std :: TYPE_INFO ::运算符== [英] boost::asio triggers a sigsegv in std::type_info::operator==

查看:411
本文介绍了提高:: ASIO触发SIGSEGV中的std :: TYPE_INFO ::运算符==的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我有一个使用的boost :: ASIO的应用程序。由于该项目的复杂性,我不能分享它的源$ C ​​$ C,可悲的是:(

So, I've got an application that uses boost::asio. Due to complexity of the project, I cannot share it's source code, sadly :(

该应用程序使用升压的ASIO lib中创建一些Web服务。当尝试使用它,但是,有一个在STD一个SIGSEGV :: TYPE_INFO :: ==操作符,其中,因为我知道,而应工作。

The application uses boost's asio lib to create some webservices. When attempting to use it, however, there's a sigsegv in std::type_info::operator==, which, as I'm aware, should rather work.

(gdb) backtrace
#0  0x0000000000457b79 in std::type_info::operator== (
this=0x7ffff6dadf61 <typeinfo for boost::asio::detail::typeid_wrapper<boost::asio::deadline_timer_service<boost::posix_time::ptime, boost::asio::time_traits<boost::posix_time::ptime> > >+1>, __arg=...)
at /usr/include/c++/4.8.2/typeinfo:123
#1  0x00007ffff6961911 in boost::asio::detail::service_registry::keys_match (key1=..., key2=...) at /usr/include/boost/asio/detail/impl/service_registry.ipp:94
#2  0x00007ffff69619a1 in boost::asio::detail::service_registry::do_use_service (this=0x6bd3c0, key=..., 
factory=0x7ffff6988ba8 <boost::asio::detail::service_registry::create<boost::asio::deadline_timer_service<boost::posix_time::ptime, boost::asio::time_traits<boost::posix_time::ptime> > >(boost::asio::io_service&)>)
at /usr/include/boost/asio/detail/impl/service_registry.ipp:114
#3  0x00007ffff69842b6 in boost::asio::detail::service_registry::use_service<boost::asio::deadline_timer_service<boost::posix_time::ptime, boost::asio::time_traits<boost::posix_time::ptime> > > (this=0x6bd3c0)
at /usr/include/boost/asio/detail/impl/service_registry.hpp:48

回溯其余ommited,因为我不认为这将有助于反正。
当进一步深挖成什么GDB版画,这就是我得到:

The rest of backtrace ommited, as I don't think it would help anyway. When digging further into what GDB prints, that's what I get:

(gdb) frame 0
#0  0x0000000000457b79 in std::type_info::operator== (
this=0x7ffff6dadf61 <typeinfo for boost::asio::detail::typeid_wrapper<boost::asio::deadline_timer_service<boost::posix_time::ptime, boost::asio::time_traits<boost::posix_time::ptime> > >+1>, __arg=...)
at /usr/include/c++/4.8.2/typeinfo:123
123                   || (__name[0] != '*' &&
(gdb) list
118             : __builtin_strcmp (__name, __arg.__name) < 0; }
119
120         bool operator==(const type_info& __arg) const _GLIBCXX_NOEXCEPT
121         {
122           return ((__name == __arg.__name)
123                   || (__name[0] != '*' &&
124                       __builtin_strcmp (__name, __arg.__name) == 0));
125         }
126       #else
127         // On some targets we can rely on type_info's NTBS being unique,
(gdb) print __name
$2 = 0xd000007ffff6afbc <Address 0xd000007ffff6afbc out of bounds>
(gdb) print __arg.__name
warning: can't find linker symbol for virtual table for `std::type_info' value
$3 = 0x7ffff6afbc60 <typeinfo name for boost::asio::detail::typeid_wrapper<boost::asio::deadline_timer_service<boost::posix_time::ptime, boost::asio::time_traits<boost::posix_time::ptime> > >> "N5boost4asio6detail14typeid_wrapperINS0_22deadline_timer_serviceINS_10posix_time5ptimeENS0_11time_traitsIS5_EEEEEE"
(gdb) print __name[0]
Cannot access memory at address 0xd000007ffff6afbc
(gdb) frame 1
#1  0x00007ffff6961911 in boost::asio::detail::service_registry::keys_match (key1=..., key2=...) at /usr/include/boost/asio/detail/impl/service_registry.ipp:94
94          if (*key1.type_info_ == *key2.type_info_)
(gdb) list
89      {
90        if (key1.id_ && key2.id_)
91          if (key1.id_ == key2.id_)
92            return true;
93        if (key1.type_info_ && key2.type_info_)
94          if (*key1.type_info_ == *key2.type_info_)
95            return true;
96        return false;
97      }
98
(gdb) print key1.type_info_
$4 = (const std::type_info *) 0x7ffff6dadf61 <typeinfo for boost::asio::detail::typeid_wrapper<boost::asio::deadline_timer_service<boost::posix_time::ptime, boost::asio::time_traits<boost::posix_time::ptime> > >+1>
(gdb) print *key1.type_info_
$5 = {_vptr.type_info = 0x6000000000006906, __name = 0xd000007ffff6afbc <Address 0xd000007ffff6afbc out of bounds>}
(gdb) print *key2.type_info_
warning: can't find linker symbol for virtual table for `std::type_info' value
$6 = warning: can't find linker symbol for virtual table for `std::type_info' value
{_vptr.type_info = 0x6906d0 <_ZTVN10__cxxabiv117__class_type_infoE@@CXXABI_1.3+16>, 
  __name = 0x7ffff6afbc60 <typeinfo name for boost::asio::detail::typeid_wrapper<boost::asio::deadline_timer_service<boost::posix_time::ptime, boost::asio::time_traits<boost::posix_time::ptime> > >> "N5boost4asio6detail14typeid_wrapperINS0_22deadline_timer_serviceINS_10posix_time5ptimeENS0_11time_traitsIS5_EEEEEE"}
(gdb) print key2.type_info_
$7 = (const std::type_info *) 0x7ffff6dadf60 <typeinfo for boost::asio::detail::typeid_wrapper<boost::asio::deadline_timer_service<boost::posix_time::ptime, boost::asio::time_traits<boost::posix_time::ptime> > >>

我,为什么它的工作原理一样,唯一的理论,是应用程序由一个主二进制文件,这是静态链接到必要的libboost * .A,并且它可以加载.so文件作为插件,每一个也联系具有相同libboost * .A。这就是我可以在这一点上想最好的。

The only theory I have as to why it works like that, is that the application consists of a main binary, which is statically linked to necessary libboost*.a, and it can load .so files as plugins, each also linked with the same libboost*.a. That's the best I can guess at this point.

任何人有任何想法,为什么它没有这样的,并且可以请帮我呢?

Anybody has any idea as to why it fails like that, and could please help me with it?

推荐答案

貌似服务不是由typeid的查找服务对象。

Looks like the service is not finding the service object by typeid.

这意味着,该库的部分没有兼容编

This implies that parts of the library have not been compatibly compiled.

无论是包括所有的共享对象/你需要在运行时库(,并确保他们在加载,而不是系统的人的),或者重新编译你对目标系统上的库版本的应用程序

Either include all the shared objects/libraries that you require at runtime (and make sure they're loaded, and not the system ones) or recompile your application against the library versions on the target system.

(即使是在编译器标志不同的可能的原因在某些平台ABI不兼容)

(Even differences in compiler flags might cause ABI incompatibilities in some platforms)

这篇关于提高:: ASIO触发SIGSEGV中的std :: TYPE_INFO ::运算符==的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆