OS:Centos6.6
目的:使用gdb调通一条ns3程序
前提条件:预先编译了ns-3,netanim
方法:
./waf --run dumbbell-animation --command-template="gdb --args %s --animFile='dumb.xml'"
[root@gdc1000 ns-3.23]# ./waf --run dumbbell-animation --command-template="gdb --args %s --animFile='dumb.xml'"
不停的step fininish后,进入netanim
(gdb) s
std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string(char const*,std::allocator<char> const&) ()
at /root/g2/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:212
212 /root/g2/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc: No such file or directory.
in /root/g2/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc
(gdb) fin
Run till exit from #0 std::basic_string<char,std::allocator<char> const&) ()
at /root/g2/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:212
0x0000000000408e8a in main () at ../src/netanim/examples/dumbbell-animation.cc:99
99 anim.EnableIpv4RouteTracking ("tracking.xml",Seconds(0.0),Seconds(300.0),Seconds(0.5));
(gdb) s
ns3::AnimationInterface::EnableIpv4RouteTracking(std::basic_string<char,std::allocator<char> >,ns3::Time,ns3::Time) ()
at ../src/netanim/model/animation-interface.cc:184
184 SetOutputFile (fileName,true);
(gdb) bt
#0 ns3::AnimationInterface::EnableIpv4RouteTracking(std::basic_string<char,ns3::Time) () at ../src/netanim/model/animation-interface.cc:184
#1 0x0000000000408eac in main () at ../src/netanim/examples/dumbbell-animation.cc:99
(gdb)
(gdb) bt
#0 ns3::AnimationInterface::EnableIpv4RouteTracking(std::basic_string<char,ns3::Time) () at ../src/netanim/model/animation-interface.cc:184
#1 0x0000000000408eac in main () at ../src/netanim/examples/dumbbell-animation.cc:99
(gdb) b ../src/netanim/model/animation-interface.cc:2127
Breakpoint 2 at 0x7ffff7dc4ecc: file ../src/netanim/model/animation-interface.cc,line 2127.
(gdb) b ../src/netanim/model/animation-interface.cc:2138
Breakpoint 3 at 0x7ffff7dc51cf: file ../src/netanim/model/animation-interface.cc,line 2138.
(gdb) c
Continuing.
Breakpoint 2,ns3::AnimationInterface::WriteXmlRouting(unsigned int,std::basic_string<char,std::allocator<char> >) ()
at ../src/netanim/model/animation-interface.cc:2127
2127 AnimXmlElement element ("rt");
(gdb) bt
#0 ns3::AnimationInterface::WriteXmlRouting(unsigned int,std::allocator<char> >) ()
at ../src/netanim/model/animation-interface.cc:2127
#1 0x00007ffff7dc1c8d in ns3::AnimationInterface::TrackIpv4Route() () at ../src/netanim/model/animation-interface.cc:1891
#2 0x00007ffff7dcf739 in ns3::EventImpl* ns3::MakeEvent<void (ns3::AnimationInterface::*)(),ns3::AnimationInterface*>(void (ns3::AnimationInterface::*)(),ns3::AnimationInterface*)::EventMemberImpl0::Notify() () at ./ns3/make-event.h:323
#3 0x00007ffff2a565e7 in ns3::EventImpl::Invoke() () at ../src/core/model/event-impl.cc:51
#4 0x00007ffff2a5b2ac in ns3::DefaultSimulatorImpl::ProcessOneEvent() () at ../src/core/model/default-simulator-impl.cc:147
#5 0x00007ffff2a5b638 in ns3::DefaultSimulatorImpl::Run() () at ../src/core/model/default-simulator-impl.cc:200
#6 0x00007ffff2a57378 in ns3::Simulator::Run() () at ../src/core/model/simulator.cc:204
#7 0x0000000000408ef2 in main () at ../src/netanim/examples/dumbbell-animation.cc:104
(gdb)
发现m_ipv4RouteTrackElements是空,这个是AddSourceDestination添加的。
原文链接:https://www.f2er.com/xml/296669.html