Examining the Call Stack |
5 |
![]() |
This chapter is organized into the following sections:
Basic Concepts
The call stack represents all currently active routines--routines that have been called but have not yet returned to their respective caller. Finding Your Place on the Stack
Use the where command to find your current location on the stack.
where [-f] [-h] [-q] [-v] number id |
The where command is also useful for learning about the state of a program that has crashed and produced a core file. When a program crashes and produces a core file, you can load the core file into dbx.
Walking the Stack and Returning Home
Moving up or down the stack is referred to as "walking the stack." When you visit a function by moving up or down the stack, dbx displays the current function and the source line. The location you start from, home, is the point where the program stopped executing. From home, you can move up or down the stack using the up, down, or frame commands. Moving Up and Down the Stack
You can examine the local variables in functions other than the current one. To move up the call stack (toward main) number levels:
up [-h] number |
To move down the call stack (toward the current stopping point) number levels:
down [-h] number |
Moving to a Specific Frame
The frame command is similar to the up and down commands. It allows you to go directly to the frame as given by numbers printed by the where command.
frame frame -h |
The frame command without an argument prints the current frame number. With number, the command allows you to go directly to the frame indicated by the number. By including a + (plus sign) or - (minus sign), the command allows you to move an increment of one level up (+) or down (-). If you include a plus or minus sign with a number, you can move up or down the specified number of levels. The -h option includes any hidden frames in the count.
Command Reference
where
The where command shows the call stack for your current process. To print a procedure traceback:
where |
To print the number top frames in the traceback:
where number |
To start the traceback from frame number:
where -f number |
where -h |
where -q |
To include function args and line info:
where -v |
Any of the previous commands may be followed by a thread or LWP ID to view the call stack.
hide/unhide
Use the hide command to list the stack frame filters currently in effect.
[hide | unhide] regexp |
The regular expression matches either the function name, or the name of the loadobject, and is a sh or ksh file matching style regular expression.
unhide 0 |
unhide number |