📄 trace.hlp
字号:
{smcl}
{* 16mar2005}{...}
{cmd:help trace}
{hline}
{title:Title}
{p2colset 5 18 20 2}{...}
{p2col :{hi:[P] trace} {hline 2}}Trace program execution{p_end}
{p2colreset}{...}
{title:Syntax}
{phang2}{cmd:set} {cmdab:tr:ace} {space 5} {c -(} {cmd:on} | {cmd:off} {c )-}
{phang2}{cmd:set} {cmdab:traced:epth}{space 2}{it:#}
{phang2}{cmd:set} {cmdab:tracee:xpand} {c -(} {cmd:on} | {cmd:off} {c )-}
[{cmd:,} {cmdab:perm:anently} ]
{phang2}{cmd:set} {cmdab:traces:ep} {space 2} {c -(} {cmd:on} |
{cmd:off} {c )-} [{cmd:,} {cmdab:perm:anently} ]
{phang2}{cmd:set} {cmdab:tracei:ndent} {c -(} {cmd:on} | {cmd:off} {c )-}
[{cmd:,} {cmdab:perm:anently} ]
{phang2}{cmd:set} {cmdab:tracen:umber} {c -(} {cmd:on} | {cmd:off} {c )-}
[{cmd:,} {cmdab:perm:anently} ]
{phang2}{cmd:set} {cmdab:traceh:ilite} {cmd:"}{it:pattern}{cmd:"}
[{cmd:,} {cmd:word} ]
{title:Description}
{pstd}
{cmd:set trace on} traces the execution of programs for debugging.
{cmd:set trace off} turns off tracing after it has been set on.
{pstd}{cmd:set tracedepth}, {cmd:set traceexpand}, {cmd:set tracesep},
{cmd:set traceindent}, and {cmd:set tracenumber} control details of the
program trace. See the discussion {help trace##trace:below}.
{pstd}
{cmd:set tracehilite} causes the specified {it:pattern} to be highlighted in
the trace output.
{title:Options}
{phang}
{cmd:permanently} specifies that, in addition to making the change right now,
the {cmd:traceexpand}, {cmd:tracesep}, {cmd:traceindent}, and
{cmd:tracenumber} settings be remembered and become the default
settings when you invoke Stata.
{phang}
{cmd:word} highlights only tokens that are delimited by nonalphanumeric
characters. These would include tokens at the beginning or end of each line
that are delimited by nonalphanumeric characters.
{marker trace}{...}
{title:Program tracing}
{pstd}
When {cmd:set trace} is {cmd:on}, {cmd:set tracedepth},
{cmd:set traceexpand}, {cmd:set tracesep}, {cmd:set traceindent},
{cmd:set tracenumber}, and {cmd:set tracehilite} control details of the
program trace.
{pstd}
{cmd:set tracedepth} indicates how many levels to descend in tracing nested
programs. If {cmd:tracedepth} were set to 2, the current program and any
subroutine it called would be traced, but any subroutines the subroutines called
would not be traced. The default {cmd:tracedepth} is 32000 (equivalent to
infinity).
{pstd}
{cmd:set traceexpand on}, the default, shows the lines both before and after
macro expansion. With {cmd:set traceexpand off}, only the line before macro
expansion is shown. (Note: when {cmd:traceexpand} is {cmd:on}, expanded
lines are preceded by an equal sign immediately following the unexpanded
line. The expanded line is not shown (1) if the expanded line is equal to the
original line or (2) the block of code in which the line appears is not being
executed.)
{pstd}
{cmd:set tracesep on}, the default, displays a horizontal separator line that
displays the name of the subroutine whenever a subroutine is entered or
exited.
{pstd}
{cmd:set traceindent on}, the default, indents displayed lines of code
according to the subroutine's nesting level. Lines in the main program are not
indented. All lines in the subroutine called by the main program are indented
2 spaces. All lines in subroutines called by first-level subroutines are
indented 4 spaces, etc. See also {cmd:set tracenumber}; some people prefer
{cmd:tracenumber} turned {cmd:on} and {cmd:traceindent} turned {cmd:off}.
{pstd}
{cmd:set tracenumber on} shows the nesting level numerically at the beginning
of the line. Lines in the main program are preceded with 01; lines in
subroutines called by the main program with 02; lines in subroutines called by
02-level subroutines with 03; and so on. The default is
{cmd:set tracenumber off}.
{pstd}
{cmd:set tracehilite} makes it easier to spot a particular {it:pattern} in the
program trace by highlighting it. The specified {it:pattern} may be any
combination of ASCII characters and should be enclosed in double quotes. By
default, {cmd:tracehilite} highlights every occurrence of {it:pattern}, even if
it is in the middle of another token or word. To prevent this, you must
specify the {cmd:word} option. The {cmd:word} option highlights only tokens
that are delimited by nonalphanumeric characters. These would include tokens
at the beginning or end of each line that are delimited by nonalphanumeric
characters.
{pstd}
See {hi:[P] trace} for additional details.
{title:Also see}
{psee}
Manual: {bf:[P] trace}
{psee}
Online: {helpb program}, {helpb query}; {helpb profiler}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -