stacktool (tool command)

A static stack analysis tool for the N64 development system

Syntax

stacktool [-s segname] [-f resfile] [-r] filename

Description

stacktool is a utility that analyzes the stack usage of the target executable file, specified by filename (the binary file). It lists the stack usage of each known function and its descendants in terms of bytes. However, all functions are not fully analyzable at this stage.

If there are recursive calls inside a function or its descendants, an asterisk (*) is attached at the end. If there are unknown jal targets, an at sign (@) is attached. If there are unknown jalr targets, a pound sign (#) is attached.

If the target file is generated by the makerom tool, and there is only one text segment, the option [-s segname] need not be specified explicitly.

The -r option tells stacktool to list the parent-child relationship in addition to the stack usage.

The -f option is for the user to provide external information regarding the parent-child relationship. For example, if the program uses pointers to functions, the compiler will generate jalr when the pointer is dereferenced.

The syntax of the statements in the resolution file is: <type> <parent> <children>. where <type> is either an at sign (@) for an unknown jal or a pound sign (#) for an unknown jalr, <parent> is the name of the function in question, and <children> is the name list of the unknown children of the function. A sample resolution file is provided in the distribution for resolving some jalr problems in the OS.

Command Line Options

-s segname
The text segment name is specified by segname. For executables generated by the makerom tool, it should be something like .codesegment. The default is the name of the first text segment that contains code.

-f resfile
The resolution file name is specified by resfile. A sample resolution file for resolving unknown jalr in the OS is provided in the distribution.

-r
Shows parent-child relationship by indentation.

Note

This tool is only trying its best to analyze the static stack usage. If the target contains a lot of recursive calls, uses pointers to functions, or is linked with shared option, stacktool may not be able to provide much help. For thread stack size determination, you need to add 16 to the size reported by the corresponding function due to the calling convention of the MIPS compiler.

See Also

makerom

Revision History

1999/04/30 Changed Format