set breakpoints for gdb

654 views
Skip to first unread message

K

unread,
Apr 5, 2012, 1:50:15 AM4/5/12
to ns-3-users
Hi,

I am having problem to set break points for gdb. Here's the scenario:

ns3 is configured by
$ ./waf -d debug --enable-examples --enable-tests configure

I am running the aodv example in the path:
**/ns-allinone-3.12.1/ns-3.12.1/src/aodv/examples
by
$./waf --run aodv --command-template="gdb %s"

I can set break points in aodv.cc but when I tried to set bp in files
not in the current directory (v4ping.cc, for example, which is not in
the same directory), gdb printed info "No source file named
v4ping.cc".

Is there any way to get around this problem?

Thanks for any suggestions.
Kelly

Alessandro Russo

unread,
Apr 6, 2012, 9:36:15 AM4/6/12
to ns-3-...@googlegroups.com
Hi, 


You can even use the Eclipse debugger.

 Alessandro  R.



--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.


K

unread,
Apr 6, 2012, 2:20:57 PM4/6/12
to ns-3-...@googlegroups.com
Hi,

Thanks for the link. I tried something like
(gdb) break ns3::MacRxMiddle::Receive(Ptr<Packet>, const WifiMacHeader)

bug gdb gave me the following msg:
Function "ns3::MacRxMiddle::Receive(Ptr<Packet>, const WifiMacHeader)" not defined.

Still trying to work with gdb...

Kelly

On Friday, 6 April 2012 07:36:15 UTC-6, Trinacriax wrote:

You can even use the Eclipse debugger.

 Alessandro  R.


On Thu, Apr 5, 2012 at 7:50 AM, K wrote:
Hi,

I am having problem to set break points for gdb. Here's the scenario:

ns3 is configured by
$ ./waf -d debug --enable-examples --enable-tests configure

I am running the aodv example in the path:
**/ns-allinone-3.12.1/ns-3.12.1/src/aodv/examples
by
$./waf --run aodv --command-template="gdb %s"

I can set break points in aodv.cc but when I tried to set bp in files
not in the current directory (v4ping.cc, for example, which is not in
the same directory), gdb printed info "No source file named
v4ping.cc".

Is there any way to get around this problem?

Thanks for any suggestions.
Kelly

--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+unsubscribe@googlegroups.com.

Alessandro Russo

unread,
Apr 11, 2012, 11:56:26 AM4/11/12
to ns-3-...@googlegroups.com
Hi,
here what I've done

make libraries available to gdb
$ export  LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"PATH-TO-NS3/build/"

run gdb on AODV example
$ gdb /path-to-file/build/src/aodv/examples/aodv

set the break
(gdb) break ns3::MacRxMiddle::Receive(Ptr<Packet>, const WifiMacHeader)
Can't find member of namespace, class, struct, or union named "ns3::MacRxMiddle::Receive"
Hint: try 'ns3::MacRxMiddle::Receive(Ptr<Packet>, const WifiMacHeader)<TAB> or 'ns3::MacRxMiddle::Receive(Ptr<Packet>, const WifiMacHeader)<ESC-?>
(Note leading single quote.)
Make breakpoint pending on future shared library load? (y or [n]) 

type y 

Breakpoint 1 (ns3::MacRxMiddle::Receive(Ptr<Packet>, const WifiMacHeader)) pending.

now run
(gdb) r 
Starting program: /home/trinacriax/repos/ns-3-allinone/ns-3-dev/build/src/aodv/examples/aodv 
[Thread debugging using libthread_db enabled]
Creating 10 nodes 100 m apart.
Starting simulation for 10 s ...
PING  10.0.0.10 56(84) bytes of data.
Breakpoint 1, ns3::MacRxMiddle::Receive (this=0x6512a0, packet=..., hdr=0x7fffffffd470) at ../src/wifi/model/mac-rx-middle.cc:248
248  NS_LOG_FUNCTION (packet << hdr);
(gdb)

it seems to work ...now, v4ping...

 (gdb) break ns3::V4Ping::Receive
Breakpoint 3 at 0x7ffff6b999a2: file ../src/applications/model/v4ping.cc, line 102.
(gdb) r
Starting program: /home/trinacriax/repos/ns-3-allinone/ns-3-dev/build/src/aodv/examples/aodv 
[Thread debugging using libthread_db enabled]
Creating 10 nodes 100 m apart.
Starting simulation for 10 s ...
PING  10.0.0.10 56(84) bytes of data.

Breakpoint 3, ns3::V4Ping::Receive (this=0x6adc90, socket=...) at ../src/applications/model/v4ping.cc:102
102 {
(gdb) 

show breakpoints

(gdb) info  breakpoints 
Num     Type           Disp Enb Address    What
1       breakpoint     keep y   <PENDING>  ns3::MacRxMiddle::Receive(Ptr<Packet>, const WifiMacHeader)
2       breakpoint     keep y   <PENDING>  ns3::V4Ping::Receive
(gdb) 

let me disable the first break

(gdb) disable 1

run again...
 
(gdb) r
Starting program: /home/trinacriax/repos/ns-3-allinone/ns-3-dev/build/src/aodv/examples/aodv 
[Thread debugging using libthread_db enabled]
Creating 10 nodes 100 m apart.
Starting simulation for 10 s ...
PING  10.0.0.10 56(84) bytes of data.
Breakpoint 2, ns3::V4Ping::Receive (this=0x6adc90, socket=...) at ../src/applications/model/v4ping.cc:102
102 {
(gdb) 

enjoy

 Alessandro  R.


To view this discussion on the web visit https://groups.google.com/d/msg/ns-3-users/-/sVwQ7thtMu0J.

To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages