need help

82 views
Skip to first unread message

Hamza Kh

unread,
Oct 7, 2014, 7:08:21 AM10/7/14
to ns-3-...@googlegroups.com

Hi

I have integrate a C++ code in ns3, it's build successfully but there is a message bellow, please what does it mean that? and how can i resolve this problem?

thanks

Waf: Entering directory `/workspaces/ns-allinone-3.17/ns-3.17/build'
Waf: Leaving directory `/workspaces/ns-allinone-3.17/ns-3.17/build'
'build' finished successfully (29.559s)
Command ['/workspaces/ns-allinone-3.17/ns-3.17/build/scratch/myfirst'] terminated with signal SIGSEGV. Run it under a debugger to get more information (./waf --run <program> --command-template="gdb --args %s <args>").



Konstantinos

unread,
Oct 7, 2014, 7:20:56 AM10/7/14
to ns-3-...@googlegroups.com

Hamza Kh

unread,
Oct 8, 2014, 6:43:58 AM10/8/14
to ns-3-...@googlegroups.com
after applying the folowing command 

root@bt:/workspaces/ns-allinone-3.17/ns-3.17# ./waf --run scratch/myfirst


Waf: Entering directory `/workspaces/ns-allinone-3.17/ns-3.17/build'
Waf: Leaving directory `/workspaces/ns-allinone-3.17/ns-3.17/build'
'build' finished successfully (21.292s)
Command ['/workspaces/ns-allinone-3.17/ns-3.17/build/scratch/myfirst'] terminated with signal SIGSEGV. Run it under a debugger to get more information (./waf --run <program> --command-template="gdb --args %s <args>").


then after applying your suggestion, the output was: 

root@bt:/workspaces/ns-allinone-3.17/ns-3.17# ./waf --run scratch/myfirst --command-template="gdb --args %s"

Waf: Entering directory `/workspaces/ns-allinone-3.17/ns-3.17/build'
Waf: Leaving directory `/workspaces/ns-allinone-3.17/ns-3.17/build'
'build' finished successfully (3.229s)
Traceback (most recent call last):
  File "/workspaces/ns-allinone-3.17/ns-3.17/.waf-1.7.10-4f6df1d839dc35640834d81573053140/waflib/Scripting.py", line 97, in waf_entry_point
    run_commands()
  File "/workspaces/ns-allinone-3.17/ns-3.17/.waf-1.7.10-4f6df1d839dc35640834d81573053140/waflib/Scripting.py", line 155, in run_commands
    run_command('shutdown')
  File "/workspaces/ns-allinone-3.17/ns-3.17/.waf-1.7.10-4f6df1d839dc35640834d81573053140/waflib/Scripting.py", line 146, in run_command
    ctx.execute()
  File "/workspaces/ns-allinone-3.17/ns-3.17/.waf-1.7.10-4f6df1d839dc35640834d81573053140/waflib/Context.py", line 87, in execute
    self.recurse([os.path.dirname(g_module.root_path)])
  File "/workspaces/ns-allinone-3.17/ns-3.17/.waf-1.7.10-4f6df1d839dc35640834d81573053140/waflib/Context.py", line 128, in recurse
    user_function(self)
  File "/workspaces/ns-allinone-3.17/ns-3.17/wscript", line 913, in shutdown
    visualize=Options.options.visualize)
  File "/workspaces/ns-allinone-3.17/ns-3.17/wutils.py", line 215, in run_program
    return run_argv(execvec, env, cwd=cwd)
  File "/workspaces/ns-allinone-3.17/ns-3.17/wutils.py", line 132, in run_argv
    retval = subprocess.Popen(argv, env=proc_env, cwd=cwd).wait()
  File "/usr/lib/python2.6/subprocess.py", line 633, in __init__
    errread, errwrite)
  File "/usr/lib/python2.6/subprocess.py", line 1139, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory


the same output was for the following command:

root@bt:/workspaces/ns-allinone-3.17/ns-3.17# ./waf --run scratch/myfirst --command-template="valgrid %s"

Waf: Entering directory `/workspaces/ns-allinone-3.17/ns-3.17/build'
Waf: Leaving directory `/workspaces/ns-allinone-3.17/ns-3.17/build'
'build' finished successfully (3.382s)
Traceback (most recent call last):
  File "/workspaces/ns-allinone-3.17/ns-3.17/.waf-1.7.10-4f6df1d839dc35640834d81573053140/waflib/Scripting.py", line 97, in waf_entry_point
    run_commands()
  File "/workspaces/ns-allinone-3.17/ns-3.17/.waf-1.7.10-4f6df1d839dc35640834d81573053140/waflib/Scripting.py", line 155, in run_commands
    run_command('shutdown')
  File "/workspaces/ns-allinone-3.17/ns-3.17/.waf-1.7.10-4f6df1d839dc35640834d81573053140/waflib/Scripting.py", line 146, in run_command
    ctx.execute()
  File "/workspaces/ns-allinone-3.17/ns-3.17/.waf-1.7.10-4f6df1d839dc35640834d81573053140/waflib/Context.py", line 87, in execute
    self.recurse([os.path.dirname(g_module.root_path)])
  File "/workspaces/ns-allinone-3.17/ns-3.17/.waf-1.7.10-4f6df1d839dc35640834d81573053140/waflib/Context.py", line 128, in recurse
    user_function(self)
  File "/workspaces/ns-allinone-3.17/ns-3.17/wscript", line 913, in shutdown
    visualize=Options.options.visualize)
  File "/workspaces/ns-allinone-3.17/ns-3.17/wutils.py", line 215, in run_program
    return run_argv(execvec, env, cwd=cwd)
  File "/workspaces/ns-allinone-3.17/ns-3.17/wutils.py", line 132, in run_argv
    retval = subprocess.Popen(argv, env=proc_env, cwd=cwd).wait()
  File "/usr/lib/python2.6/subprocess.py", line 633, in __init__
    errread, errwrite)
  File "/usr/lib/python2.6/subprocess.py", line 1139, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory


please advice


--
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/NEXVKW091Zk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.



--
LCPTS Lab
Hamza KHEDDAR

Konstantinos

unread,
Oct 8, 2014, 2:37:20 PM10/8/14
to ns-3-...@googlegroups.com
Please refrain from double posting.

Have you installed all required libraries for gdb or valgrind? 

Also try another method:
  • First, setup your environment variables: ./waf --shell
  • Then, run your program with gdb: gdb ./build/scratch/myfirst
To unsubscribe from this group and all its topics, send an email to ns-3-users+unsubscribe@googlegroups.com.

To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

Hamza Kh

unread,
Oct 9, 2014, 10:55:16 AM10/9/14
to ns-3-...@googlegroups.com
I check the installation of gdb, i didn't find it. i download and install gdb 7.8, the OS [error 2] disappear. thanks so much

Now we return to our original problem:

root@bt:/workspaces/ns-allinone-3.17/ns-3.17# ./waf --run myfirst --command-template="gdb --args %s"

Waf: Entering directory `/workspaces/ns-allinone-3.17/ns-3.17/build'
Waf: Leaving directory `/workspaces/ns-allinone-3.17/ns-3.17/build'
'build' finished successfully (4.423s)


(gdb) run
Starting program: /workspaces/ns-allinone-3.17/ns-3.17/build/scratch/myfirst
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0xb567bf20 in ?? () from /lib/tls/i686/cmov/libc.so.6


This is the output message after debugging the program, please help to analyze the problem.

thanks

To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.

To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

Konstantinos

unread,
Oct 9, 2014, 11:40:54 AM10/9/14
to ns-3-...@googlegroups.com
Now you need to use the GDB to debug your code.
Follow the tutorial http://www.cs.cmu.edu/~gilpin/tutorial/ or any other gdb tutorial online to learn how to use the debugger.
If you are using Eclipse or any other IDE for your development, you can debug your code there which is easier (graphical environment).

Hamza Kh

unread,
Oct 9, 2014, 1:44:44 PM10/9/14
to ns-3-...@googlegroups.com
after debugging

(gdb) backtrace
#0  0xb567bf20 in ?? () from /lib/tls/i686/cmov/libc.so.6

#1  0xb6801d5d in std::__copy_move<false, true, std::random_access_iterator_tag>::__copy_m<char> (
    __first=0x1 <error: Cannot access memory at address 0x1>, __last=0x0, __result=0x0)
    at /usr/include/c++/4.4/bits/stl_algobase.h:378
#2  0xb6800940 in std::__copy_move_a<false, char*, char*> (__first=0x1 <error: Cannot access memory at address 0x1>,
    __last=0x0, __result=0x0) at /usr/include/c++/4.4/bits/stl_algobase.h:397

#3  0xb67fe571 in std::__copy_move_a2<false, __gnu_cxx::__normal_iterator<char*, std::vector<char, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char*, std::vector<char, std::allocator<char> > > > (__first=..., __last=..., __result=...)
    at /usr/include/c++/4.4/bits/stl_algobase.h:436

#4  0xb67fbb33 in std::copy<__gnu_cxx::__normal_iterator<char*, std::vector<char, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char*, std::vector<char, std::allocator<char> > > > (__first=..., __last=..., __result=...)
    at /usr/include/c++/4.4/bits/stl_algobase.h:468

#5  0xb67f821a in std::vector<char, std::allocator<char> >::erase (this=0xbfffdb70, __position=...)
    at /usr/include/c++/4.4/bits/vector.tcc:137



/////////////////////////////// THIS PART CONCERN MY PROGRAM //////////////////////////////////////////////////////////////////////////////////

#6  0xb67e711f in ns3::Ipv4L3Protocol::BuildHeader (this=0x80b2888, source=..., destination=..., protocol=17 '\021',
    payloadSize=1032, ttl=64 '@', tos=0 '\000', mayFragment=true) at ../src/internet/model/ipv4-l3-protocol.cc:752


#7  0xb67e5ce3 in ns3::Ipv4L3Protocol::Send (this=0x80b2888, packet=..., source=..., destination=..., protocol=17 '\021',
    route=...) at ../src/internet/model/ipv4-l3-protocol.cc:651

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



#8  0xb681839e in ns3::MemPtrCallbackImpl<ns3::Ptr<ns3::Ipv4>, void (ns3::Ipv4::*)(ns3::Ptr<ns3::Packet>, ns3::Ipv4Address, ns3::Ipv4Address, unsigned char, ns3::Ptr<ns3::Ipv4Route>), void, ns3::Ptr<ns3::Packet>, ns3::Ipv4Address, ns3::Ipv4Address, unsigned char, ns3::Ptr<ns3::Ipv4Route>, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator() (this=0x80b35a8,
    a1=..., a2=..., a3=..., a4=17 '\021', a5=...) at ./ns3/callback.h:235

#9  0xb74a04bf in ns3::Callback<void, ns3::Ptr<ns3::Packet>, ns3::Ipv4Address, ns3::Ipv4Address, unsigned char, ns3::Ptr<ns---Type <return> to continue, or q <return> to quit---

#10 0xb6813587 in ns3::UdpL4Protocol::Send (this=0x80b3318, packet=..., saddr=..., daddr=..., sport=49153, dport=9,
    route=...) at ../src/internet/model/udp-l4-protocol.cc:453

#11 0xb6848ffa in ns3::UdpSocketImpl::DoSendTo (this=0x80b70c8, p=..., dest=..., port=9)
    at ../src/internet/model/udp-socket-impl.cc:601

#12 0xb68470d4 in ns3::UdpSocketImpl::DoSendTo (this=0x80b70c8, p=..., address=...)
    at ../src/internet/model/udp-socket-impl.cc:422

#13 0xb684676c in ns3::UdpSocketImpl::DoSend (this=0x80b70c8, p=...) at ../src/internet/model/udp-socket-impl.cc:386

#14 0xb6846114 in ns3::UdpSocketImpl::Send (this=0x80b70c8, p=..., flags=0)
    at ../src/internet/model/udp-socket-impl.cc:355

#15 0xb5f08048 in ns3::Socket::Send (this=0x80b70c8, p=...) at ../src/network/model/socket.cc:137

#16 0xb6eea02d in ns3::UdpEchoClient::Send (this=0x80b4bd8) at ../src/applications/model/udp-echo-client.cc:310

#17 0xb6eebccd in ns3::EventMemberImpl0::Notify (this=0x80b1f90) at ./ns3/make-event.h:94

#18 0xb5ce1cbe in ns3::EventImpl::Invoke (this=0x80b1f90) at ../src/core/model/event-impl.cc:45

#19 0xb5ce739b in ns3::DefaultSimulatorImpl::ProcessOneEvent (this=0x80b1b08)
    at ../src/core/model/default-simulator-impl.cc:140

#20 0xb5ce774c in ns3::DefaultSimulatorImpl::Run (this=0x80b1b08) at ../src/core/model/default-simulator-impl.cc:193

#21 0xb5ce2a83 in ns3::Simulator::Run () at ../src/core/model/simulator.cc:160

#22 0x0804f5f6 in main (argc=1, argv=0xbffff104) at ../scratch/myfirst.cc:69


////////////////////////////// BREAK POINT for #6 and #7 ///////////////////////////////////////////////////////////

(gdb) break ns3::Ipv4L3Protocol::BuildHeader
Breakpoint 1 at 0xb67ad484 (2 locations)

(gdb) break ns3::Ipv4L3Protocol::Send
Breakpoint 2 at 0xb67e473e: file ../src/internet/model/ipv4-l3-protocol.cc, line 572.

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

PLEASE ADVICE

PS: before i integrate my program as a part of existing program: Ipv4L3Protocol, i tested this part via IDE it's work well  !

To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.

To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

Tommaso Pecorella

unread,
Oct 9, 2014, 1:53:14 PM10/9/14
to ns-3-...@googlegroups.com
Hi,

mind trying to use 3.21 ? Perhaps it was a bug in 3.19 and it's now fixed.

Thanks,

T.
Reply all
Reply to author
Forward
0 new messages