SIGSEGV Error

239 views
Skip to first unread message

Ldong

unread,
Jan 12, 2016, 4:54:30 PM1/12/16
to ns-3-users
I ran my code in debugger:

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff483f503 in ns3::Ptr<ns3::Application>::Ptr (this=0x657220726f662065, o=...) at ./ns3/ptr.h:439
439  : m_ptr (PeekPointer (o))

Please see if I missed anything. I try to create 8 nodes on either side of a bottleneck router pair/link.
god.cc

Konstantinos

unread,
Jan 12, 2016, 5:06:33 PM1/12/16
to ns-3-users
Hi Ldong,

The error comes from here 
  ApplicationContainer t3target = t3Sink.Install (nodes.Get (18));

This could be more clear if after running with debugger, you did a backtrace:

#0  0x0000000103c79458 in ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::Ref (this=0x6000000000000000) at simple-ref-count.h:102

#1  0x0000000103c79430 in ns3::Ptr<ns3::Node>::Acquire (this=0x7fff5fbfdaf8) at ptr.h:710

#2  0x0000000103c793d0 in ns3::Ptr<ns3::Node>::Ptr (this=0x7fff5fbfdaf8, o=@0x10545f530) at ptr.h:741

#3  0x0000000103c7938d in ns3::Ptr<ns3::Node>::Ptr (this=0x7fff5fbfdaf8, o=@0x10545f530) at ptr.h:742

#4  0x0000000103df6191 in ns3::NodeContainer::Get (this=0x7fff5fbfede8, i=18) at ../src/network/helper/node-container.cc:90

#5  0x0000000100005ac3 in main (argc=1, argv=0x7fff5fbff978) at ../scratch/myfirst.cc:162



You try to install the packet sink on nodes.Get(18) which is the 19th node.
You only have 18. You should start counting from 0.

Regards,
K.

Tommaso Pecorella

unread,
Jan 12, 2016, 5:10:53 PM1/12/16
to ns-3-users
  nodes.Create(18);
...

 
ApplicationContainer t3target = t3Sink.Install (nodes.Get (18));

I said enough, right ?

Also, please study one of the zillions manual about how to debug a program. Use gdb, lldb, a GUI to a a debugger (Eclipse, NetBeans, etc.). Use what you want, but use a debugger to find the errors. Simply launching the program in a debugger and seeing it hang is not much better than launching it from the command line and looking at it hang.
In other terms, learn the tools you need to use.

Thanks,

T.

Ldong

unread,
Jan 12, 2016, 5:17:08 PM1/12/16
to ns-3-users
Thanks a lot sir.

Ldong

unread,
Jan 12, 2016, 5:25:42 PM1/12/16
to ns-3-users
Thank you.
Reply all
Reply to author
Forward
0 new messages