Sun Studio 12: Debugging a Program With dbx

Changing the Visiting Scope

The following commands are the most common ways of changing the visiting scope:

The debug command and the attach command set the initial visiting scope.

When you hit a breakpoint, dbx sets the visiting scope to the current location. If the stack_find_source environment variable (see Setting dbx Environment Variables) is set to ON, dbx attempts to find and make active a stack frame that has source code.

When you use the up command (see up Command), the down command (down Command), the frame number command (see frame Command), or the pop command (see pop Command)to change the current stack frame, dbx sets the visiting scope according to the program counter from the new stack frame.

The line number location used by the list command (see list Command) changes the visiting scope only if you use thelist function orlist file command. When the visiting scope is set, the line number location for the list command is set to the first line number of the visiting scope. When you subsequently use the list command, the current line number location for the list command is updated, but as long as you are listing lines in the current file, the visiting scope does not change. For example, if you type the following, dbx lists the start of the source for my_func, and changes the visiting scope to my_func.

(dbx) list my_func

If you type the following, dbx lists line 127 in the current source file, and does not change the visiting scope.

(dbx) list 127

When you use the file command or the func command to change the current file or the current function, the visiting scope is updated accordingly.