Debugging TCL scripts on ns2 – yes it works for ns 2.34!
As stated at http://www.isi.edu/nsnam/ns/ns-debugging.html ns2 is compatible with Don Libs’ Tcl debugger.
What that site doesn’t tell you is how to install it. There is a nice howto by tk424 here, but that wasn’t written for a recent version of ns2. All the same I recommend it, as it’s very useful. However I have contributed here a patch for the configure file of tcl-debug2 in order to make it compatible with recent versions of ns2. This was tested in ns2.34.
Ah, yes another thing. I am not going to go into as much detail as the howto above. Refer to it if you have questions. It’s totally fool proof.
The quick way is this.
- Download http://expect.nist.gov/tcl-debug/tcl-debug.tar.gz (apparently thats the most up-to-date version out there since dinosaurs populated the earth.) If that link does not work, try my mirror: http://www.box.net/shared/0fah87994s
- Untar it and move it to your ns-allinone-x.xx folder
- go into the ns-allinone-x.xx/tcl-debug-2.0 folder and try calling ./configure
- if that fails apply my patch from http://www.box.net/shared/20z8klbpjy and call ./configure again (applying the patch is as simple as calling “patch -p1 < tcl-debug-2.0-configure.patch”)
- call make
- you will get a file called “tcl-debug-2.0/libtcldbg.a” if everythings fine
- copy that to “ns-allinone-x.xx/ns-x.xx/lib”
- go to “ns-allinone-x.xx/ns-x.xx”
- do “./configure –with-tcldebug”
- call make (perhaps you have to make clean; make)
- insert the line “debug 1″ at the line of your script that you wish to debug
- follow this PostScript document for instructions how to use the debugger
So… that’s about it. And with that tool installed, you will finally know what your _o?? reference that is in the backtrace of ns2 really stands for. Plus know the type of the object simply by using its OTcl handle _o??. Cool, isn’t it. Happy debugging!
Read on! Knowledge hurts.
Your patch file for tcldebug is not working in my ns-2.34. when i patch it, it takes time so long and can’t forward. Any idea pls?
“little@little-laptop:~/ns/ns-allinone-2.34/tcl-debug-2.0$ patch -p1 > tcl-debug-2.0-configure.patch”
thanks in advance!
little - Saturday, 20. February 2010 at 19:58 |
That’s an easy one!
Your “>” should be a “<".
By using the wrong direction of the parenthesis, you have put the output of patch into tcl-debug-2.0-configure.patch but the patch program has been waiting for your input in order to use it to patch something.
Like that, you even have overwritten the patch file, so perhaps you'll have to redownload it before trying the corrected command…
Good Luck!
knowledgehurts - Saturday, 20. February 2010 at 21:00 |
Hi !
Thanks for your post. It is really helpful.
How to know what is _oXXX ? I’ve put “debug 1″ in my tcl script. Then I launched my simulation and dbg5 starts. I’ve got a Classifier::no-slot problem and I’d like to understand why with the debug. It writes _o31 no slot 90. How to know what is my _o31 ?
Thanks.
Jonathan.
Jonathan Petit - Friday, 26. February 2010 at 21:01 |
The _oXXX is called tcl handle.
When you are in the debug mode, you can run any TCL command you like on your _oXXX handle.
This can help you identifying the object by querying it until you are sure, what object it is.
First of all, you could find out what type your tcl object is by typing:
“_oXXX info class”
Then you could use TCL functions of this object to find out more about it.
For more information see also http://www.isi.edu/nsnam/ns/ns-debugging.html
knowledgehurts - Tuesday, 2. March 2010 at 14:04 |
hello , thanx for help ..
i was wondering if can i use this in cygwin ?
Jmone - Monday, 12. April 2010 at 20:26 |
I follow the instructions to install debugger, however I don’t know about the errors. Would anyone please help me
[root@Munsub ns-2.34]# make
make: *** No rule to make target `wpan/p802_15_4csmaca.o’, needed by `ns’. Stop.
[root@Munsub Desktop]# ns f2.tcl
warning: Script debugging disabled. Reconfigure with –with-tcldebug, and recompile.
The expression value is: 15 and content of m is: {I am SFU Student}
Thanks
Munsub Ali - Monday, 24. May 2010 at 5:09 |
This link http://expect.nist.gov/tcl-debug/tcl-debug.tar.gz does not work and there is no other source for the tcl-debugger as well.
Please upload the file if possible (coz the file that was once the most popular has become extinct like the dinosaur era), not getting even the first step right of the procedure mentioned is very frustrating.
Else if there is any other site hosting the file pls let me know.
Thanks .
Ashwini - Tuesday, 25. January 2011 at 13:28 |
yes if someone manages to find the file please let us know..
fivos - Wednesday, 9. February 2011 at 17:32 |
i finally found it here :
http://web.tagus.ist.utl.pt/~pedro.estrela/ns2/files/tcl-debug-2.0.tar.gz
(the aforementioned site was down for a couple of months , luckily it’s up again)
fivos - Wednesday, 9. February 2011 at 18:00 |
Thanks for taking the time for posting the link! I updated my article.
knowledgehurts - Wednesday, 2. March 2011 at 14:46 |
Hi, I cant understand how to add your site into my rss reader. Can you help me, please! Thanks.
baidu456 - Thursday, 8. September 2011 at 6:49 |
[...] http://knowledgehurts.wordpress.com/2010/01/18/debugging-tcl-scripts-on-ns2-yes-it-works-for-ns-2-34… [...]
Instalar tcl-debug para ns2.34 en ubuntu 10.10 « rovitor´s good and bad news - Tuesday, 27. September 2011 at 18:26 |
hi, I tried your steps to install tcldebug, all is Ok but when I use debug 1, I had a warning error : script debug disabled. reconfigure –with-tcldebug and recompile. please help me, I use ns-2.34.
thank’s.
lamia - Friday, 9. December 2011 at 4:27 |