The entry of functions can be traced using the trace function entry (tfe) command:
tfe [depth] /* Trace function entry */Function entry tracing is used to determine flow of control in the kernel, and is implemented using the instruction trace capability of the 80386.
At each function entry, a line is printed showing the function called, and execution is suspended until the user gives an input character. If the user enters a quit character, the debugger prompt will appear. Otherwise, execution proceeds until the next function entry.
The following example illustrates setting a breakpoint at a function and then using tfe to trace function calls from that point:
debug0:1>Each line in the output is printed in the following format:
cat /etc/passwdBREAKPOINT: D007E053 open+3 open debug0:3>
tfe>-- open() <Space> >--- copen(1, 7FFFFE94) <Space> >---- ufalloc(0) <Space> >---- namei(D0011034, 0) <Space> >----- upath(D0011034, 0, E0001148) <Space> >------ rcopyfault+7C() <Space> ...
>dashes function name ( arguments )The current function is always printed first before tracing function entry. The ``>'' is printed to show that the line is output of tfe.
A number of dashes are printed, to show the depth of the function call in the stack. In the above example, copen( ) is at depth 3 in the stack; it was called by the open( ) function at depth 2, which was called by the systrap( ) function at depth 1, which was called by the sys_call( ) function at depth -. Any function that copen( ) calls would be a depth 4 function, and so would have four dashes, and so on.
Using the optional depth argument to tfe causes tfe to print only those functions of a level less than or equal to (current level + depth).
Note that execution is greatly slowed while using tfe, and that no breakpoints are in effect while using tfe.