[Solved] [Solved] ns-3 uses FlowMonitor to report an error terminated with signal SIGSEG terminated with signal SIGSEGV

The code in question is as follows:

FlowMonitorHelper flowmon;
Ptr<FlowMonitor> monitor = flowmon.InstallAll();

Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier> (flowmon.GetClassifier());
std::map<FlowId, FlowMonitor::FlowStats> stats = monitor->GetFlowStats ();

It turns out that the command line error is as follows:
terminated with signal SIGSEGV. Run it under a debugger to get more information (./waf –run –command-template=”gdb –args %s “).

Until I found out when I saw the forum! !

It turns out that the location of instantiating FlowMonitor is wrong, he must bind IP to the node.

Then I put the code after Simulator::Run (), and the result is that the map content I get through monitor->GetFlowStats () is empty! !

Final solution! ! ! :
Still a code location issue. The final correct code is this: Declare FlowMonitorHelper before Simulator::Stop (Seconds (m_totalTime)); and install FlowMonitor on each node. After Simulator::Run (); Use them to get the information you want.

CreateNodes();
  CreateDevices(tr_name);
  SetupMobility();
  InstallInternetStack (tr_name);
  InstallApplications();

  std::cout << "\\
Starting simulation for " << m_totalTime << " s ...\\
";

  FlowMonitorHelper flowmon;
  Ptr<FlowMonitor> monitor = flowmon.InstallAll();

  CheckThroughput();

  Simulator::Stop(Seconds(m_totalTime));

  AnimationInterface anim("dsdv.xml");
  Simulator::Run();

  Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier> (flowmon.GetClassifier());
  std::map<FlowId, FlowMonitor::FlowStats> stats = monitor->GetFlowStats ();