Previous Next Contents Index Doc Set Home

Examining the Call Stack


This chapter discusses how dbx uses the call stack, and how to use the where, hide, and unhwide commands when working with the call stack.

This chapter is organized into the following sections:

Basic Concepts

page 47

Command Reference

page 49

Basic Concepts

The call stack represents all currently active routines--routines that have been called but have not yet returned to their respective caller.

Because the call stack grows from higher memory to lower memory, up means going up the memory to the caller's frame and down means going down the memory. The current program location--the routine executing when the program stopped at a breakpoint, after a single-step, or when it faults producing a core file--is in higher memory, while a caller routine, such as main(), is located lower in memory.

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.

The dbx commands up and down both accept a number argument that instructs dbx to move some number of frames up or down the stack from the current frame. If number is not specified, the default is one. The -h option includes all hidden frames in the count.

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 -h
[-h] number
frame [-h] +number
frame [-h] -number

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


The where command shows the call stack for your current process. To print a procedure traceback:


To print the number top frames in the traceback:

where number

To start the traceback from frame number:

where -f number

To include hidden frames:

where -h

To print only function names:

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.


Use the hide command to list the stack frame filters currently in effect.

To hide or delete all stack frames matching a regular expression:

[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.

Use unhide to delete all stack frame filters:

unhide 0

Because the hide command lists the filters with numbers, you can also use the unhide command with the filter number:

unhide number

Previous Next Contents Index Doc Set Home