Hi all,
  I had earlier written a stack analysis tool for mspgcc compiled programs
for my own use.
Seeing the interest in the mailing list, I put it up on google code for
anyone to download and use.

Hopefully, you can also find bugs, and help improve it.

The link is http://code.google.com/p/stkchk/

What can it do?
Analyze the call tree of a program and report the stack usage of a function
(by default "main") and its children.
Distinguish between direct function calls and indirect function calls (via
function pointers). Indirect calls can be resolved if the user provides
addition information on the command line.
Detect recursion both direct (f() -> f()) and indirect (f()-> g()->f()).
For programs with recursion, stack usage reporting is not meaningful.


How does it work?
stkchk does not operate on C source code directly. It operates on the
"xxx.lst" file created by the mspgcc compiler after final compile and link.
The "xxx.lst" file contains comments, link information and the disassembly
of the program. By parsing this file, it can determine the call tree. Stack
usage is analyzed by detecting assembly instructions that modify the stack
pointer, R1.

Other notes:
It is written in the ruby scripting language.  To run the script, you will
need  a platform with ruby.
I have tested it on   Windows + cygwin + ruby.

Thanks all
------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to