- 论坛徽章:
- 0
|
本帖最后由 skybyte 于 2013-03-26 18:38 编辑
请教一个gdb 抓获的错误 找不到屏蔽的方法 在哪里增加检查才能避免出错呢。- #0 0x000000000082007d in std::__niter_base<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, true>:: (__it=...) at /usr/include/c++/4.4/bits/stl_algobase.h:278
- #1 0x000000000081fba0 in std::__copy_move_a2<false, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*> (__first=..., __last=..., __result=0x7fe5b96f4090 "") at /usr/include/c++/4.4/bits/stl_algobase.h:436
- #2 0x000000000081f1c7 in std::copy<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*> (__first=..., __last=..., __result=0x7fe5b96f4090 "") at /usr/include/c++/4.4/bits/stl_algobase.h:468
- #3 0x000000000081cec2 in std::__uninitialized_copy<true>::uninitialized_copy<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*> (__first=..., __last=..., __result=0x7fe5b96f4090 "") at /usr/include/c++/4.4/bits/stl_uninitialized.h:93
- #4 0x000000000081b035 in std::uninitialized_copy<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*> (__first=..., __last=..., __result=0x7fe5b96f4090 "") at /usr/include/c++/4.4/bits/stl_uninitialized.h:117
- #5 0x0000000000819d54 in std::__uninitialized_copy_a<__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char> > >, unsigned char*, unsigned char> (__first=..., __last=..., __result=0x7fe5b96f4090 "") at /usr/include/c++/4.4/bits/stl_uninitialized.h:257
- #6 0x000000000081891d in std::vector<unsigned char, std::allocator<unsigned char> >::vector (this=0x7fe5a91479b0, __x=...)
- at /usr/include/c++/4.4/bits/stl_vector.h:243
- #7 0x0000000000a59261 in ByteBuffer::ByteBuffer (this=0x7fe5a91479a0, buf=...) at shared/ByteBuffer.h:72
- #8 0x0000000000a59427 in WorldPacket::WorldPacket (this=0x7fe5a91479a0, packet=...) at shared/WorldPacket.h:37
- #9 0x0000000000a562d7 in WorldSocket::SendPacket (this=0x7fe5da263d80, pct=...) at game/WorldSocket.cpp:149
- WorldSocket.cpp:149 这行的上下文是
- if (iSendPacket (pct) == -1)
- {
- WorldPacket* npct;
- ACE_NEW_RETURN (npct, WorldPacket (pct), -1); //这是149行
- // NOTE maybe check of the size of the queue can be good ?
- // to make it bounded instead of unbounded
- if (m_PacketQueue.enqueue_tail (npct) == -1)
- {
- delete npct;
- sLog.outError ("WorldSocket::SendPacket: m_PacketQueue.enqueue_tail failed");
- return -1;
- }
- }
- shared/WorldPacket.h:37 的上下文是
- class WorldPacket : public ByteBuffer
- {
- public:
- // just container for later use
- WorldPacket() : ByteBuffer(0), m_opcode(0)
- {
- }
- explicit WorldPacket(uint16 opcode, size_t res=200) : ByteBuffer(res), m_opcode(opcode) { }
- // copy constructor
- /* 下面这行是37行 */
- WorldPacket(const WorldPacket &packet) : ByteBuffer(packet), m_opcode(packet.m_opcode)//37行
- {
- }
- void Initialize(uint16 opcode, size_t newres=200)
- {
- clear();
- _storage.reserve(newres);
- m_opcode = opcode;
- }
- uint16 GetOpcode() const { return m_opcode; }
- void SetOpcode(uint16 opcode) { m_opcode = opcode; }
- protected:
- uint16 m_opcode;
- };
- #endif
- shared/ByteBuffer.h:72 的上下文是
- // constructor
- ByteBuffer(): _rpos(0), _wpos(0)
- {
- _storage.reserve(DEFAULT_SIZE);
- }
- // constructor
- ByteBuffer(size_t res): _rpos(0), _wpos(0)
- {
- _storage.reserve(res);
- }
- // copy constructor
- ByteBuffer(const ByteBuffer &buf): _rpos(buf._rpos), _wpos(buf._wpos), _storage(buf._storage) { } //72行
复制代码 |
|