【发布时间】:2010-11-14 01:44:45
【问题描述】:
我正在尝试在 MacOS X 上运行 blocking_udp_echo_client http://www.boost.org/doc/libs/1_35_0/doc/html/boost_asio/example/echo/blocking_udp_echo_client.cpp
我用参数'localhost 9000'运行它
但是程序崩溃了,这是源代码中崩溃的行: `udp::socket s(io_service, udp::endpoint(udp::v4(), 0));'
这是堆栈跟踪:
#0 0x918c3e42 在 __kill #1 0x918c3e34 在 kill$UNIX2003 #2 0x9193623a 在加注中 #3 0x91942679 中止 #4 0x940d96f9 在 __gnu_debug::_Error_formatter::_M_error #5 0x0000e76e 在 __gnu_debug::_Safe_iterator::op_base*> >, __gnu_debug_def::list::op_base*>, std::allocator::op_base*> > > >::_Safe_iterator at safe_iterator.h:124 #6 0x00014729 in boost::asio::detail::hash_map::op_base*>::bucket_type::bucket_type 在 hash_map.hpp:277 #7 0x00019e97 在 std::_Construct::op_base*>::bucket_type 中, boost::asio::detail::hash_map::op_base*>::bucket_type> 在 stl_construct.h:81 #8 0x0001a457 在 std::__uninitialized_fill_n_aux::op_base*>::bucket_type*, __gnu_norm::vector::op_base*>::bucket_type, std::allocator::op_base*>::bucket_type> > >,无符号长,boost::asio::detail::hash_map::op_base*>::bucket_type> 在 stl_uninitialized.h:194 #9 0x0001a4e1 在 std::uninitialized_fill_n::op_base*>::bucket_type*, __gnu_norm::vector::op_base*>::bucket_type, std::allocator::op_base*>::bucket_type> > >,无符号长,boost::asio::detail::hash_map::op_base*>::bucket_type> 在 stl_uninitialized.h:218 #10 0x0001a509 在 std::__uninitialized_fill_n_a::op_base*>::bucket_type*, __gnu_norm::vector::op_base*>::bucket_type, std::allocator::op_base*>::bucket_type> > >, unsigned long, boost::asio::detail::hash_map::op_base*>::bucket_type, boost::asio::detail::hash_map::op_base*>::bucket_type> 在 stl_uninitialized.h:310 #11 0x0001aa34 在 __gnu_norm::vector::op_base*>::bucket_type, std::allocator::op_base*>::bucket_type> >::_M_fill_insert 在vector.tcc:365 #12 0x0001acda 在 __gnu_norm::vector::op_base*>::bucket_type, std::allocator::op_base*>::bucket_type> >::插入 stl_vector.h:658 #13 0x0001ad81 在 __gnu_norm::vector::op_base*>::bucket_type, std::allocator::op_base*>::bucket_type> >::在 stl_vector.h:427 处调整大小 #14 0x0001ae3a 在 __gnu_debug_def::vector::op_base*>::bucket_type, std::allocator::op_base*>::bucket_type> >::在向量处调整大小:169 #15 0x0001b7be 在 boost::asio::detail::hash_map::op_base*>::rehash 中 hash_map.hpp:221 #16 0x0001bbeb 在 boost::asio::detail::hash_map::op_base*>::hash_map 中 hash_map.hpp:67 #17 0x0001bc74 在 boost::asio::detail::reactor_op_queue::reactor_op_queue 在 reactor_op_queue.hpp:42 #18 0x0001bd24 在 boost::asio::detail::kqueue_reactor::kqueue_reactor 在 kqueue_reactor.hpp:86 #19 0x0001c000 在 boost::asio::detail::service_registry::use_service > 在 service_registry.hpp:109 #20 0x0001c14d 在 boost::asio::use_service > 在 io_service.ipp:195 #21 0x0001c26d 在 boost::asio::detail::reactive_socket_service >::reactive_socket_service 在 reactive_socket_service.hpp:111 #22 0x0001c344 在 boost::asio::detail::service_registry::use_service >> at service_registry.hpp:109 #23 0x0001c491 在 boost::asio::use_service >> 在 io_service.ipp:195 #24 0x0001c4d5 在 boost::asio::datagram_socket_service::datagram_socket_service 在 datagram_socket_service.hpp:95 #25 0x0001c59e 在 boost::asio::detail::service_registry::use_service > 在 service_registry.hpp:109 #26 0x0001c6eb 在 boost::asio::use_service > 在 io_service.ipp:195 #27 0x0001c711 在 boost::asio::basic_io_object >::basic_io_object 在 basic_io_object.hpp:72 #28 0x0001c783 在 boost::asio::basic_socket >::basic_socket 在 basic_socket.hpp:108 #29 0x0001c865 在 boost::asio::basic_datagram_socket >::basic_datagram_socket 在 basic_datagram_socket.hpp:107 #30 0x000027bc 在 main.cpp:32这是 gdb 输出:
(gdb) 继续 /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/debug/safe_iterator.h:127: 错误:尝试从单一迭代器复制构造迭代器。 操作中涉及的对象: 迭代器“这个”@ 0x0x100420 { type = N11__gnu_debug14_Safe_iteratorIN10__gnu_norm14_List_iteratorISt4pairIiPN5boost4asio6detail16reactor_op_queueIiE7op_baseEEEEN15__gnu_debug_def4listISB_SaISB_EEEEE (可变迭代器); 状态=单数; } 迭代器“其他”@ 0x0xbfffe8a4 { type = N11__gnu_debug14_Safe_iteratorIN10__gnu_norm14_List_iteratorISt4pairIiPN5boost4asio6detail16reactor_op_queueIiE7op_baseEEEEN15__gnu_debug_def4listISB_SaISB_EEEEE (可变迭代器); 状态=单数; } 节目接收信号:“SIGABRT”。 (gdb) 继续 节目接收信号:“?”。有人知道为什么这个例子不能在 mac osx 上运行吗? 谢谢。
【问题讨论】: