User`s guide

Examining the Stack
47
Printing Stack Traces
The where command prints stack traces. Stack traces show the current
activation levels (procedures) of a program.
For example, consider the following stack trace for a program called test:
(dbx) where
> 0 foo2(i = 5) [“/usr/var/tmp/dbx_examples/test.c”:44, 0x1000109c]
1 foo(i = 4) [“/usr/var/tmp/dbx_examples/test.c”:38, 0x1000105c]
2 main(argc = 1, argv = 0xffffffad78) [“/usr/var/tmp/dbx_examples/
test.c”:55, 0x10001104]
3 __start() [“/shamu/lib/libc/libc_64/crt1text.s”:137, 0x10000ee4]
This program has four activation levels. The most recent, a call of the
procedure foo2, is numbered 0. The currently selected activation level is 0,
indicated by the “>” character.
The stack trace also reports that foo2 was passed one argument: the value 5
was assigned to the local variable i. The trace indicates that the program was
stopped at line 44 of the file test.c, which translates to machine address
0x1000109c.
The stack trace reports similar information for the next two activation levels
in this example. You can see that the function foo called foo2 from line38 in
test.c. In turn, foo was called by main at line 55 of the file test.c. Finally, the
run-time start-up level was called at line 137 from the file ctrltext.s.
If you compile with g0 or with no g option, limited symbols are reported.
In cases such as this, where detailed symbolic information is not available,
the four hexadecimal values returned represent dbx’s guess that the function
has four integer arguments. The following example illustrates such a case:
(dbx) where
> 0 fooexample(0x300000000, 0x4000000ff, 0x5000000ff, 0x0)
[“/usr/var/tmp/dbx_examples/test3.c”:10, 0x10000cf8]
1 main(0x3, 0x4, 0x5, 0x0) [“/usr/var/tmp/dbx_examples/
test3.c”:5, 0x10000cbc]
2 __start() [“/shamu/lib/libc/libc_64/csu/
crt1text.s”:137, 0x10000c64]
(dbx) quit
Process 22582 terminated
int fooexample(int,int,int);
int main()