gdb调试程序出错,正常运行却没有错误
两进程A和B通过网络连接,A先给B发送一个数据包,B收到后给A发回相应信息。现在B先启动,再启动A,接着马上把A杀掉,测试网络中断时程序的处理情况。如果用gdb调试B进程,发现B在给A发送数据时出现错误;但是如果不用gdb调试,直接运行B进程,就没有错误,网络中断导致发生数据错误,底层抛出异常,上层有正确捕捉到。不知道这是什么原因?用gdb调试时出错时的堆栈信息为:
(gdb) bt
#0 0xb7fa2410 in __kernel_vsyscall ()
#1 0xb7abf711 in send () from /lib/tls/i686/cmov/libc.so.6
#2 0x0805fb83 in SockBufferO<ListBuffer, RC4Filter>::write (this=0x8621588,
so=@0x8621148, msg=0x8b6d9e0 "\024\022\001", size=70164)
at SockBufferO.h:39
#3 0x0805eb49 in TcpSocket::SendBin (this=0x8621148, ip=421729196,
port=46339, pPkg=@0xbf83e260, uri=31003394) at TcpSocket.cpp:229
#4 0x0804dfca in DaemonManager::tcpSend (this=0x8075660, pSocket=0x8621148,
msg=@0xbf83e260, uri=31003394) at DaemonManager.cpp:275
#5 0x080500f5 in DaemonManager::handleNewRegs (this=0x8075660)
at DaemonManager.cpp:520
#6 0x0804bdbb in SelectorEPoll::TimerCheck (this=0x8075760, tNow=1353396986)
at TimerHandler.h:21
#7 0x0804c34a in SelectorEPoll::Run (this=0x8075760) at selector_epoll.cpp:121
#8 0x0804b3d8 in main (sz=2717, args=0x8b6d9e0) at main.cpp:115
求高人指点,感激不尽!