Sunday, February 28, 2010

Tcl Error Message in NS2

Tcl error messages in NS2 can be pretty scary. You can see an example at the end of the post. But it's not that hard to deal with it. Here is what you should do.

1. Relax.... Breath....
2. Go lines by lines following the error reporting structure:

invoked from within
"code"
(location)

From top to bottom, these three line blocks repeat themselves from the erroneous code to the file from which the error is initiated.

invoked from within

Error is usually caused by calling another procedure. NS2 provided a mechanism to drill down the error levels by levels until the real erroneous code is found. Each level is separated by the line with the phrase "invoked from within". This is to say that the upper line is "invoked from within" the lower line.

"code"

This is the quote on the exact NS2 codes, which cause the error. The location of this part is indicated in the next line.

(location)

Enclosed in (...) are the location where the error occurs. The format of location is

category [argument] line number

  • category is the location category. It can be file, procedure, classname (e.g., SplitObject), etc.
  • argument (optional) specifies the scope of the location category. Examples are filename (e.g., "smcc.tcl"), instproc name (e.g., unknown).
  • line number shows the exact location within the above scope.

---------- Example Code -------------------------
"_o3 cmd queue-parameter _o17 _o24 2 6"
invoked from within
"catch "$self cmd $args" ret"
invoked from within
"if [catch "$self cmd $args" ret] {
set cls [$self info class]
global errorInfo
set savedInfo $errorInfo
error "error when calling class $cls: $args" $..."
(procedure "_o3" line 2)
(SplitObject unknown line 2)
invoked from within
"$ns queue-parameter $n3 $n4 2 6"
(file "smcc.tcl" line 94)


For more information about Tcl, see Chapter 3 and Appendix A in the following book from Springer.

You may also find lecture notes and other resource at the following website: http://www.ece.ubc.ca/~teerawat/NS2.htm

No comments: