The gstack Utility Program

The gstack Utility Program analyzes a program to report the maximum stack size each task may need during execution and the call chain which would produce this maximum stack size.

The gstack utility relies on information produced by the Green Hills compilers and by the mtrans program. See the MULTI Reference Manual for a description of mtrans.

To produce the information required for gstack, all files comprising the program must be compiled with -G.

Usage

To use gstack, enter:

gstack [prog | prog.sym | prog.dnm]

where

prog

prog.sym

prog.dnm Name of the executable file.

The gstack options include:

-a Add functions or connections to the call graph. -a fun1:fun2, fun3 adds fun1, fun2, fun3 to the call graph with fun2 and fun3 being callers of fun1.

-c func Print all callers of func.

-f func=size Specify or change function stack frame size.

-g Print the call graph.

-j Print all functions and frame sizes.

-s func Print the maximum stack size for the program starting with func.

-u Print all functions who have no callers.

-help Print information on all options.

Example

For the file test.c:

main() { int arr[1000];fun1();fun0();fun2();
fun3(); }
fun0() { fun1(); fun3(); }
fun1() { int arr[20]; fun2(); fun3(); }
fun2() { int arr[10]; fun3 (); }
fun3() { }

% ccmcore test.c -G -Xstaticcalls
% gstack a.out main

Task main 4136 byte stack produced by the call chain of:

Framesize Function
4004 main
4 fun0
84 fun1
44 fun2

Caveats


Previous

Next



Copyright © 1999, Green Hills Software. All rights reserved.