我試圖從我的ns-3(網絡模擬軟件)程序中獲取一個錯誤。使用GDB進行調試
我在gdb下運行它:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff4850195 in ns3::MpTcpBulkSendApplication::StartApplication (this=0x706850) at ../src/applications/model/mp-tcp-bulk-send-application.cc:170
170 m_socket->Bind();
(gdb) bt
#0 0x00007ffff4850195 in ns3::MpTcpBulkSendApplication::StartApplication (this=0x706850) at ../src/applications/model/mp-tcp-bulk-send-application.cc:170
#1 0x00007ffff09f9b45 in ns3::EventImpl* ns3::MakeEvent<void (ns3::Application::*)(), ns3::Application*>(void (ns3::Application::*)(), ns3::Application*)::EventMemberImpl0::Notify() (this=0x62f440) at ./ns3/make-event.h:94
#2 0x00007ffff02e90ef in ns3::EventImpl::Invoke (this=0x62f440) at ../src/core/model/event-impl.cc:45
#3 0x00007ffff02ee3a9 in ns3::DefaultSimulatorImpl::ProcessOneEvent (this=0x6d2d00) at ../src/core/model/default-simulator-impl.cc:141
#4 0x00007ffff02ee7ac in ns3::DefaultSimulatorImpl::Run (this=0x6d2d00) at ../src/core/model/default-simulator-impl.cc:194
#5 0x00007ffff02e9ff5 in ns3::Simulator::Run() at ../src/core/model/simulator.cc:161
#6 0x0000000000410640 in main (argc=1, argv=0x7fffffffdc58) at ../scratch/doordi3.cc:188
我不明白髮生了什麼,是什麼給了錯誤。任何幫助將受到歡迎。
謝謝。
這個功能是從哪兒錯誤快到地方:
// Application Methods
void MpTcpBulkSendApplication::StartApplication (void) // Called at time specified by Start
{
NS_LOG_FUNCTION (this);
//NS_LOG_UNCOND(Simulator::Now().GetSeconds() << " StartApplication -> Node-FlowId: {" << GetNode()->GetId() <<"-" << m_flowId<< "} MaxBytes: " << m_maxBytes << " F-Type: " << m_flowType << " S-Time: " << m_simTime);
// Create the socket if not already
if (!m_socket)
{ cout<<"Going to Bind"<<endl;
//m_socket = CreateObject<MpTcpSocketBase>(GetNode()); //m_socket = Socket::CreateSocket (GetNode(), m_tid);
m_socket = DynamicCast<MpTcpSocketBase>(Socket::CreateSocket (GetNode(), m_tid));
m_socket->Bind();
//m_socket->SetMaxSubFlowNumber(m_subflows);
m_socket->SetFlowType(m_flowType);
m_socket->SetOutputFileName(m_outputFileName);
int result = m_socket->Connect(m_peer);
if (result == 0)
{
m_socket->SetFlowId(m_flowId);
m_socket->SetDupAckThresh(m_dupack);
m_socket->SetConnectCallback(MakeCallback(&MpTcpBulkSendApplication::ConnectionSucceeded, this),MakeCallback(&MpTcpBulkSendApplication::ConnectionFailed, this));
m_socket->SetDataSentCallback(MakeCallback(&MpTcpBulkSendApplication::DataSend, this));
m_socket->SetCloseCallbacks (MakeCallback (&MpTcpBulkSendApplication::HandlePeerClose, this),MakeCallback (&MpTcpBulkSendApplication::HandlePeerError, this));
//m_socket->SetSendCallback(MakeCallback(&MpTcpBulkSendApplication::DataSend, this));
}
else
{
NS_LOG_UNCOND("Connection is failed");
}
}
if (m_connected)
{
SendData();
}
}
GDB爲您提供了分段錯誤的代碼行。沒有更多的線索,我們無法給你更多的東西。如果你想了解更多細節,你可以嘗試使用Valgrind。 – Aracthor
你能提供你寫的完整代碼嗎? – user2277550
@ user2277550它需要與ns3的mptcp代碼才能工作。所以,我沒有發佈。它會有幫助嗎? – ferrer