Installing tcl-debug for ns-allinone-2.31

From Nsnam

Jump to: navigation, search

installing tcl-debug-2.0 on ns-2.31 (tested in ubuntu 7.04)

Contents

Step 1. Prepare installing tcl-debug

Download the tcl-debug from http://expect.nist.gov/tcl-debug/tcl-debug.tar.gz This tar.gz file is a compressed file.

$ mv tcl-debug.tar.gz ~/ns-allinone-2.31
$ cd ~/ns-allinone-2.31
$ tar zxvf tcl-debug.tar.gz

Step 2. Compile tcl-debug

$ cd ~/ns-allinone-2.31/tcl-debug-2.0
$ ./configure

If you see the following error message:

loading cache ./config.cache
checking for Tcl configuration... configure: warning: Can't find Tcl configuration definitions
./configure: line 630: #: No such file or directory

try using a optional argument to the configure script and point it to your specific tclConfig.sh:

$ ./configure --with-tcl=~/ns-allinone-2.31/tcl8.4.13/unix/

If that does not work, alter the configer script manually. To do this, insert the paths as follows:

$ gedit configure &
line628 # ***
line629 TCLCONFIG="../tcl8.4.14/unix/tclConfig.sh"
line630 . $TCLCONFIG
...
line1360          # ***
line1361          ac_cv_c_tclh="../tcl8.4.14/generic"
line1362          # see if one is installed

Type in the command “./configure” again, then followed by "make" if success.

$ ./configure
$ make

Step 3. Compile the NS

$ cd ~/ns-allinone-2.31/ns-2.31
$ ./configure --enable-debug --with-tcldebug=../tcl-debug-2.0-pmsrve
$ make clean
$ make

Note: Be careful when enabling the C++ debug level with --enable-debug. This sets the -g as well as the -Wall and -Werror flags for compiling.

One might want to alter the ns2 configure script to exclude the -Werror flag in order to see all the compiler warnings but still compile successfully. The corresponding line in the configure script can be commented out and an altered version is inserted below (around line 3780 in the configure script):

if test "$enable_debug" = "yes" ; then
	V_CCOPT="-g"
	if test "$CC" = gcc ; then
#		V_CCOPT="$V_CCOPT -Wall -Werror"
		V_CCOPT="$V_CCOPT -Wall"
		V_DEFINE="$V_DEFINE -fsigned-char -fno-inline"
	fi
else
	V_CCOPT="$OonS"
	V_DEFINE="$V_DEFINE -DNDEBUG"
fi

Step 4. Check if the tcl-debug works

$ cd ~/ns-allinone-2.31/ns-2.31/tcl/ex/
$ gedit wireless-test.tcl &

Put in a line "debug 1;" wherever you want to launch tcl-debug. In this manual, we insert this line between lines 213 and 214.

       set ns_ [new Simulator]
       debug 1;          # this line calls the tcl-debug
       set chan [new $opt(chan)]

Run the script:

$ ns wireless-test.tcl

If tcl-debug works, then you will see a line similar to the following line:

          2: lappend auto_path $dbg_library
          dbg2.0>

Press Ctrl+C or type in the exit command to return to the original shell, and then you will see $.

          dbg2.0> exit
          $

Further steps on how to use tcl-debug

Installation is completed. Congratulations if your tcl-debug installation is successful. Your next step is to learn how to “use” tcl-debug. Pedro Vale Estrela’s website is an invaluable source for this purpose. You may find his website at:

http://inesc-0.tagus.ist.utl.pt/~pmsrve/ns2/

Don Libe’s tutorial “A Debugger for Tcl Applications” is the first tutorial written by the developer of tcl-debug. The pdf version is available at

http://www.ntu.edu.sg/home5/PG01053788/doc/tcl-debug.pdf

References

[1]http://mailman.isi.edu/pipermail/ns-users/2006-January/053760.html [2]http://web.umr.edu/~tk424/CpE_EE401_1A_Spring_2007/Handouts/Programs/tclDebugger/tcl-debug_installation_manual.pdf

Personal tools