[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] Segment Fault while using NAM



Hi All,
        I'm a beginner trying out tutorials at 
http://www.isi.edu/nsnam/ns/tutorial/index.html.Every thing was installed 
with out any problems.I was able to create out.nam using ns-2.
But when I try to use nam on out.nam, I' getting segment fault.I'm using
Redhat 7.0.pakeges Tcl/Tk ,otcl ,TclCL,ns-2,nam-1 are of latest versions.I 
was able to locate a patch at NAM FAQ.But I'm not able to figureout what 
parts I've to change in trace.cc in ns-2.Please help me.
I already spent one day tweaking the code in trace.cc file.
Thanks in advance
Bala

Problem: namtrace-all causes segmentation fault on Linux and Solaris 2.6. 
It's caused by sprintf's inability to handle null pointers in those systems.
Solution: Apply the following patch to ~ns-2/trace.cc:

--- trace.cc~    1998/07/17 22:37:25
+++ trace.cc     1998/07/20 18:07:53
@@ -185,7 +185,7 @@
        hdr_rtp *rh = (hdr_rtp*)p->access(off_rtp_);

        hdr_srm *sh = (hdr_srm*)p->access(off_srm_);
-       const char* sname = 0;
+       const char* sname = "null";

        int t = th->ptype();
        const char* name = pt_names[t];
@@ -413,7 +413,7 @@
                hdr_cmn *th = (hdr_cmn*)p->access(off_cmn_);
                hdr_ip *iph = (hdr_ip*)p->access(off_ip_);
                hdr_srm *sh = (hdr_srm*)p->access(off_srm_);
-               const char* sname = 0;
+               const char* sname = "null";

                int t = th->ptype();
                const char* name = pt_names[t];


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com