One of the most common error you might have found when running NS2 is "Segmentation Fault". This is just a type of runtime error. If you run, the same program in Win32 console application, Windows will show a run-time error message and terminate the program. So don't be intimidated by it.
Example
Example of codes which causes segmentation fault is shown below:
int x[10];
x[20] = 0;
where you create an array x with 10 slots, but try to access 20th slot of x.
Suggestion?
Cause 1 (C++): Most segmentation fault errors are usually rooted in C++ domain. So, check your C++ codes. I can't help finding bugs in your codes. But, here is the guideline for debugging:
- Think carefully you have done before you see segmentation fault. The part which causes error is likely to be in that part.
- If you do not find error, go back even further. Try to remove as many new modules that you have added as you can. Do it until you no longer see segmentation fault. Then start adding your module one by one until you see segmentation fault again. The most recently added module is the module which is most likely to cause the problem.
- If you still do not find the error, you might have to reinstall NS2 and slowly added your modules one by one again. Use approach similar to step 2.
I know debugging is a boring and laborious job. But you've gotta do it to move on. Just don't give up.
Cause 2 (Misconfiuration in OTcl): Another common cause is in OTcl, where you do not attach NS2 components correctly. An example is that you may set the target of a link to an object which does not exist. So fix it!!
Note: The point where error occurs is still in C++, but it is caused by misconfiguration in OTcl.
========================================================
For more information about randomized scenarios, see Chapter 12 in the following book from Springer:
T. Issaraiyakul and E. Hossain, “Introduction to Network Simulator NS2”, Springer 2009. You may also find lecture notes and other resource at the following website: http://www.ece.ubc.ca/~teerawat/NS2.htm
No comments:
Post a Comment