Common TCL debug commands)

Source: Internet
Author: User

Tkcon Latest Version 2.5.

 

Debug the Tcl/OTCL script in NS2. To set a breakpoint, add debug 1 directly to the corresponding position in the script file. Some basic commands are as follows:
S one-step execution (entering the process)
N single-step execution (do not enter the process)
C continue
R continues execution until it returns
U to upper-level scope
D. Go to the lower-level scope.
W. List call stacks
B. Set, clear, or display breakpoints.
H help

When you run the script, it stops at the corresponding breakpoint. You can use the puts command to print the values of various variables. Info is also a common command.
Info exists <variable>
<Variable> info class // query the class name of an object
<Variable> info instances // query all instances of a class
<Variable> info instprocs // query all instance processes of a class
<Variable> info vars
<Variable> info superclass/subclass // query the superclass/subclasses of A Class

 

If you think that the error lies in the C/C ++ code (usually this is the case), you need to use GDB for debugging. Generally, GDB is available in both UNIX and Linux and can be used directly. However, you must modify the MAKEFILE file, recompile the code, and generate a program containing debugging information before debugging. The method is to add the-G option on the ccopt macro. The debugging process is as follows:
First, input the gdb NS (for debugging), and the display should be (GDB)
Set breakpoint: B file name (XXXX. cc or XXX. h): number of rows
Run the Tcl Script: R file name (XXX. TCL)
DEBUG command: N, S
Show variable: P variable name
Delete the breakpoint D Checkpoint number
View breakpoint information: I B
There are many other commands that can be viewed with the help of H.

 

For example:

. GDB NS
. (GDB) set ARGs myscript. TCL
. (GDB) B myclass: myfunction
# This line set breakpoint
. Run

 

Reference: http://hi.baidu.com/cxh198412/blog/item/08f5342fc1eaab3d1e308917.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.