Ok so after spending a lot of time on trying to debug ns in eclipse, I found
the solution!
to give a step by step guide:
after installing ns2 and eclipse, first take the steps given in the
following site : http://blog.karthiksankar.com/ns2-eclipse/ except that
don't change the make file

after doing this you should be able to build and run your ns and tcl file
without error seeing the % command or the output of your tcl

now to be able to debug ns in eclipse, go to your
.../ns-allinone/ns-2.3x/Makefile.in file and change the following:

1. change CCOPT    = @V_CCOPT@
to CCOPT    = @V_CCOPT@ -g

2. add -DNDEBUG -DDEBUG to the end of
DEFINE    = -DTCP_DELAY_BIND_ALL -DNO_TK @V_DEFINE@ @V_DEFINES@
@DEFS@-DNS_DIFFUSION -DSMAC_NO_SYNC
-DCPP_NAMESPACE=@CPP_NAMESPACE@-DUSE_SINGLE_ADDRESS_SPACE -Drng_test

that is:

DEFINE    = -DTCP_DELAY_BIND_ALL -DNO_TK @V_DEFINE@ @V_DEFINES@
@DEFS@-DNS_DIFFUSION -DSMAC_NO_SYNC
-DCPP_NAMESPACE=@CPP_NAMESPACE@-DUSE_SINGLE_ADDRESS_SPACE -Drng_test
-DNDEBUG -DDEBUG

now navigate to .../ns-allinone/ns2.3x and run ./configure and after that
"make clean" and then "make"

now you will be getting a few errors in some files (I only got 2!) regarding
debug, go to the line numbers of those files and comment what is causing the
error (probably puts)

thats it! now you can go to your eclipse and define some breakpoints and hit
the debug button and lean back and enjoy what you see!

Good Luck and have fun

Ella

On Tue, Jun 14, 2011 at 10:47 AM, ÞÕÇÏ Úíäì Ýì ßá ãßÇä mohammed <
teto...@yahoo.com> wrote:

> unfortunalety, i dont know how to debug c++ , please if you know inform me
> , thanks alot
>
>
> --- On *Sun, 6/12/11, Ella Taha <ella.t...@gmail.com>* wrote:
>
>
> From: Ella Taha <ella.t...@gmail.com>
> Subject: Re: [ns] debugging ns-2.33 in eclipse
> To: "ÞÕÇÏ Úíäì Ýì ßá ãßÇä mohammed" <teto...@yahoo.com>
> Date: Sunday, June 12, 2011, 9:11 AM
>
>
> go to run --> run configurations and then choose the arguments tab and
> inside the program arguments add the address of your tcl file for example:
> /home/ns-allinone2-33/ns2-33/aodv/file.tcl
>
> do you know how I can debug the C++ files?
>
> On Sun, Jun 12, 2011 at 2:06 PM, ÞÕÇÏ Úíäì Ýì ßá ãßÇä mohammed <
> teto...@yahoo.com<http://us.mc305.mail.yahoo.com/mc/compose?to=teto...@yahoo.com>
> > wrote:
>
>
> please could you help me how to run tcl file inside eclips
> --- On *Sun, 6/12/11, Ella Taha 
> <ella.t...@gmail.com<http://us.mc305.mail.yahoo.com/mc/compose?to=ella.t...@gmail.com>
> >* wrote:
>
>
> From: Ella Taha 
> <ella.t...@gmail.com<http://us.mc305.mail.yahoo.com/mc/compose?to=ella.t...@gmail.com>
> >
> Subject: [ns] debugging ns-2.33 in eclipse
> To: "ns users" 
> <ns-users@ISI.EDU<http://us.mc305.mail.yahoo.com/mc/compose?to=ns-users@ISI.EDU>
> >
> Date: Sunday, June 12, 2011, 5:05 AM
>
>
>
> Dear friends
> I am trying to debug ns-2.33 with eclipse CDT(Helios Service Release 2). I
> have added the ns folder as a new project to the eclipse. the build runs
> without error and I have set my tcl file as an argument to the run
> configuration. when I run, I can see the tcl file running with no problem
> and the output is displayed. However, when I set some breakpoints and hit
> the debug, it doesn't stop at those points and what happens, is exactly the
> same as when running the project resulting in no debug outputs!
> I would really appreciate if anyone can help me!
> thanks
>
> p.s I have already added the following lines to the makefile:
> CCOPT = -g
> DEFINE = -DNDEBUG
> DEFINE = -DDEBUG
>
>
> Ella
>
>
>

Reply via email to