Hi Geetha,

There is no "the" solution to *segmentation* *fault*s. From what I've seen
on this list and
in practice, there can be several causes:
1. you deleted a resource from within TCL, causing pointers in C++ to point
to
    memory regions no longer in use. Fix: be careful what you delete in TCL.
2. you added or modified the ns2 source code:
    a. there is a dependency problem and parts of your source have not been
        recompiled. fix: type "make clean" and "make" to make ultimately
sure
        that all code is within sync with each other
    b. your additions are the cause of the memory violation. fix: fix!

how to find the location of your error?
a. first you have to convince your shell to produce a coredump when a
    *segmentation* *fault* occurs. Usually this is done with the command
    "ulimit -c 100000" which sets the limit of coredumps to really huge
    so that they are allways produced.
b. add "-g" to the CFLAGS in the Makefile (and Makefile.in to make sure
    your change is not removed when you ./configure ns2). This flag says
that
    debugging code is compiled into the executable.
c. make clean & make to have the debugging code properly compiled in.

When a *segmentation* *fault* occurs, type: "gdb -c core", then in gdb tell
it that you want to load symbols from the ns executable with "file ns",
and then you can inspect the stack ("bt"), select a stack frame ("select 0")
and inspect the values of variables in that stack frame. Use the online
help of gdb to get familiar with it.

This link may be useful to you.

http://article.gmane.org/gmane.network.simulator.isi/2766/match=segmentation
+fault


Good luck debugging!

3. May be you are accessing the wrong memory location while declaring your
data structures like linked list, arrays etc

Regards

-- 
Mubashir Husain Rehmani

Mobile : 00 33 (0)6 32 00 89 35

Reply via email to