Hello ns users,I used to debug my C code using " fprintf(stderr," Test 
Test\n");" and "  fprintf(stdout," Test Test\n");" statements, every thing was 
fine, one day ago, as usual, i made some changes in dsragent.cc file then i  
added  some fprintf statement, when i tried to run a simple tcl script using 
DSR, i got a "segmentation fault" error!!Using GDB Debugger , i concluded  that 
these fprintf statements caused this error, & when i remove them from my code, 
every thing goes fine!!I want to know how can debug my code and avoid this 
error in the same time ?
I really appreciate any help you can provide.
Best Regards.
Dalia.
  
***********************************************************************Dalia@Dalia
 /usr/local/ns-allinone-2.35-RC7/ns-2.35$ ns dsrenergy5.tclnum_nodes is set 
5warning: Please use -channel as shown in tcl/ex/wireless-mitf.tclINITIALIZE 
THE LIST xListHeadStarting Simulation...channel.cc:sendUp - Calc 
highestAntennaZ_ and distCST_highestAntennaZ_ = 1.5,  distCST_ = 550.0SORTING 
LISTS ...DONE!Segmentation fault (core dumped)
Dalia@Dalia /usr/local/ns-allinone-2.35-RC7/ns-2.35$ gdb nsGNU gdb (GDB) 
7.6.50.20130508-cvs (cygwin-special)Copyright (C) 2013 Free Software 
Foundation, Inc.License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>This is free software: you are free to change 
and redistribute it.There is NO WARRANTY, to the extent permitted by law.  Type 
"show copying"and "show warranty" for details.This GDB was configured as 
"i686-cygwin".Type "show configuration" for configuration details.For bug 
reporting instructions, please 
see:<http://www.gnu.org/software/gdb/bugs/>...Reading symbols from 
/usr/local/ns-allinone-2.35-RC7/ns-2.35/ns...done.(gdb) set args 
dsrenergy5.tcl(gdb) runStarting program: 
/usr/local/ns-allinone-2.35-RC7/ns-2.35/ns dsrenergy5.tcl[New Thread 
1452.0x1514][New Thread 1452.0x1688][New Thread 1452.0x2d8]num_nodes is set 
5warning: Please use -channel as shown in tcl/ex/wireless-mitf.tclINITIALIZE 
THE LIST xListHeadStarting Simulation...channel.cc:send!
 Up - Calc highestAntennaZ_ and distCST_highestAntennaZ_ = 1.5,  distCST_ = 
550.0SORTING LISTS ...DONE!
Program received signal SIGSEGV, Segmentation fault.0x00000000 in ?? ()(gdb) 
bt#0  0x00000000 in ?? ()#1  0x779bf8b1 in ntdll!ZwWaitForSingleObject () from 
/cygdrive/c/Windows/system32/ntdll.dll#2  0x7663149d in WaitForSingleObjectEx 
() from /cygdrive/c/Windows/syswow64/KERNELBASE.dll#3  0x00000408 in ?? ()#4  
0x00000000 in ?? ()(gdb) 
********************************************************************************

                                          

Reply via email to