User`s guide

Examining the Stack
51
The syntax for the func command is:
func {activation_level | procedure}
Changes the current activation level. If you specify an
activation level by number, dbx changes to that activation
level. If you specify a procedure, dbx changes to the
activation level of that procedure. If you specify a procedure
name and that procedure has called itself recursively, dbx
changes to the most recently called instance of that
procedure.
func Displays the name of the procedure corresponding to the
current activation level.
When you change your activation level, your scope changes. For example,
unless you qualify a variable as described in “Qualifying Variable Names”
on page 39, dbx assumes that variables you reference are local to the current
activation level. Also, dbx changes the current source file to the one
containing the procedure’s source and the current line to the first line of the
procedure.
You can also give the func command the name of a procedure that is not on
the activation stack, even when your program is not executing. In this case,
dbx has no corresponding activation level to make current. However, dbx still
changes the current source file to the one containing the procedure’s source
and the current line to the first line of the procedure.
For example, consider the following activation stack:
(dbx) where
> 0 foo2(i = 5) [“/usr/var/tmp/dbx_examples/foo.c”:46, 0x10001214]
1 foo(i = 4) [“/usr/var/tmp/dbx_examples/foo.c”:40, 0x100011d4]
2 main(argc = 1, argv = 0xffffffad78) [“/usr/var/tmp/dbx_examples/
test4.c”:25, 0x10000fa0]
3 __start() [“/shamu/lib/libc/libc_64/csu/crt1text.s”:137, 0x10000f34]
In this case, you can go to the main activation stack by entering:
(dbx) func main
main: 25 j = foo(j);
This command changes the current activation level to “2” and changes the
current source file to test4.c.