[ns] Helpful Info regarding GDB / DDD and NS2

|
how to debug ns2 code using gdb or ddd

Thanks to  SamanaSrikanth and ameya. I found this on
orkut.
May be Pedro Estrela Should add this to his C++
debugging.

********************************************
ns - debug
how to debug ns2 code using gdb or ddd?

ok, so to enable debug information in ns, you need to
do the following:

in your ns-allinone directory, edit the install file.
Look for the line :

# Build Tcl8.3.2 (should be around line 173)

In this section you need to add the option
--enable-symbols to the line :
./configure --enable-gcc --disable-shared
--prefix=$CUR_PATH || ....

so it becomes:
./configure --enable-gcc --enable-symbols
--disable-shared --prefix=$CUR_PATH || ....

Now, still in the ns-allinone/install file, look for
the tclcl section.

# Build tclcl (should be around line 260)

in this section, you need to add --enable-debug to
your configure line, such
that:

./configure || ...

becomes

./configure --enable-debug || ...

ok, we're done with this one. save and close.

now, go into your ns-allinone/ns directory, and open
your Makefile.in. Search
for CFLAGS (should be around line 90), and change it
from

CFLAGS = $(CCOPT) $(DEFINE)

to

CFLAGS = -g $(CCOPT) $(DEFINE)

ok, we're done with the editing. now go to your
ns-allinone and type

./install.

after everything is done, you should have debugging
symbols enabled. so, now
you recompile your code into ns, and open ns in gdb
(gdb ns) and set the
appropriate parameters to ns (e.g. your .tcl
simulation file), and type run.
When the app crashes, type bt to see the stack. you
should see plenty of debug
information now.

let me know how it goes.
********************************************

 the way I prefer the most is just add the -g flag
information in the make file.
That should add the debug symbols and then while
running do following

>> ddd ns

once ur in graphical debugger,
say
>>set args filename (& any other args)
>> run example.tcl

that should give you a good graphical display of your
code. debugging becomes easy and faster
********************************************


 
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com


 
____________________________________________________________________________________
Get your own web address.  
Have a HUGE year through Yahoo! Small Business.
http://smallbusiness.yahoo.com/domains/?p=BESTDEAL

'Computer_language > Debug' 카테고리의 다른 글

The Network Simulator ns-2: Debugging Tips  (0) 2009.01.18
Debugging with DDD  (1) 2009.01.12
gdb 사용법  (0) 2009.01.12
[ns] re:how to debug TCL  (0) 2009.01.12
The Network Simulator ns-2: Debugging Tips  (0) 2009.01.12
And