Are there static stack analysis tools for MIPS?

Nicholas Sherlock n.sherlock@gmail.com
Fri Jul 4 03:56:00 GMT 2008


PRC wrote:
> Hi All,
>
> I'd like to know whether there're some static stack analysis tools for MIPS, which can analyze the ELF binaries for MIPS and report run-time stack usage of the programs. 
I don't know whether such static analysis tools exist on any platform.
How much stack does this program use?

void doStuff(int a) {
if (a>0) {
int arr[300];
arr[0]=a;

doStuff(a-1);
}
}

void main(int argc, char ** args) {
doStuff(atoi(args[1]));
}

On my system, the answer is "At most 2147483647 * (300 + c) + d bytes",
where c and d are some small numbers. This is not a particularly useful
answer. You could actually execute the program on a test workload, and
monitor the stack usage, though, just not statically.


Cheers,
Nicholas Sherlock



More information about the Gcc-help mailing list