error while adding ports to custom device

30 views
Skip to first unread message

shin...@gmail.com

unread,
Jan 23, 2015, 11:25:58 AM1/23/15
to ns-3-...@googlegroups.com
Hello all,

I am trying to create a simple network device (that extends from class object).
When I try to add the ports (at the point when I try to push_back the channel) I get an error (terminated with signal SIGSEGV).
 
I spend a whole day debugging it but no success. I am not sure what I am missing.  I have attached my source code for your reference.

I ran the debugger (with backtrace) ,I got the following results.

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff355b240 in std::vector<ns3::Ptr<ns3::Channel>, std::allocator<ns3::Ptr<ns3::Channel> > >::push_back (this=0x20, __x=...) at /usr/include/c++/4.6/bits/stl_vector.h:828
828        if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage)
(gdb) bt
#0  0x00007ffff355b240 in std::vector<ns3::Ptr<ns3::Channel>, std::allocator<ns3::Ptr<ns3::Channel> > >::push_back (this=0x20, __x=...)
    at /usr/include/c++/4.6/bits/stl_vector.h:828
#1  0x00007ffff01930c7 in ns3::mamiChannel::AddChannel (this=0x0, mamidChannel=...) at ../src/mami/model/mami-channel.cc:62
#2  0x00007ffff01910d9 in ns3::mami::AddSwitchPort (this=0x707000, switchport=...) at ../src/mami/model/mami.cc:37
#3  0x000000000040a803 in main (argc=2, argv=0x7fffffffdc18) at ../scratch/tmami.cc:106


Any help is greatly appreciated.

Thanks,
Neels
tmami.cc
mami.tar.gz

shin...@gmail.com

unread,
Jan 23, 2015, 12:20:00 PM1/23/15
to ns-3-...@googlegroups.com
I solved it. .I forgot to initialize the constructor.

Thanks,
Neels
Reply all
Reply to author
Forward
0 new messages