Skip to main content

Posts

Showing posts from May, 2013

How to debug NS2 using gdb

1) Extract  NS2 tar file.
2) Modify Makefile.in from ns-allinone2.34/ns2.34/

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 at -DNS_DIFFUSION -DSMAC_NO_SYNC -DCPP_NAMESPACE=@CPP_NAMESPACE at -DUSE_SINGLE_ADDRESS_SPACE -Drng_test 
that is: 
DEFINE = -DTCP_DELAY_BIND_ALL -DNO_TK @V_DEFINE@ @V_DEFINES@ @DEFS at -DNS_DIFFUSION -DSMAC_NO_SYNC -DCPP_NAMESPACE=@CPP_NAMESPACE at -DUSE_SINGLE_ADDRESS_SPACE -Drng_test -DNDEBUG -DDEBUG 
now browse to .../ns-allinone/ns2.3x and run ./configure and after that "make clean" and then "make"
2) Open terminal and type in "gdb ns"
3)then " run tcl_file_name"

If there are errors gdb will stop at respective location.