Debugging ns2 with mannasim
Debugging ns2 is easy (or should be):
- go to ns-?.?? directory
- run ./configure –enable-debug
- make clean
- make
BUT here comes the big BUT:
for the –enable-debug option the compiler flag -WError is passed to gcc and will make it throw errors instead of warnings in many cases – for the (sometimes not too well written) Mannasim code, this is deadly: It won’t compile due to formalities.
If you get errors when compiling ns with Mannasim in order to debug: Edit the configure script and change the part where -WError is passed. It will compile like a charm (if you don’t run into compiler bugs).
You might want to pass arguments to the executable that you want to debug.
you can do this without problems:
gdb [gdbarguments] -args yourexecutable yourarguments
By calling a gdb-script, you can run the executable automatically and also quit gdb if everything went fine.
Create such a batch file by running
echo "run" > run.script
and execute it like this:
gdb [gdbarguments] -x run.script -args yourexecutable yourarguments
And all of a sudden you have the possibility to call gdb inside of scripts without having to type run all over again. Practical, huh?
Read on! Knowledge hurts.