Re: pic18f4455 - call graph
Marko Kohtala <[email protected]> Thu, 9 Jun 2011 10:08:09 +0300
| Newsgroups | gmane.comp.hardware.microcontrollers.gnupic |
|---|---|
| Message-ID | <[email protected]> |
I do not remember seeing one. But I thought about it a while back. MPLAB C compiler records call tree, but I don't remember if the compiler does tail call optimization requiring some analysis to determine if stack is really used or if there is just a goto to next function. Assembly is more difficult because it does not enforce functions and therefore it requires some more analysis to find nested calls. From a call tree you could see the possibility for stack overflow, but it may not be real because a function may not always execute every call contained in it. Think about recursive calls. You need to have room for interrupts and they may not always be enabled and not always use the same amount of stack. And then are the programs that use dynamic calls through function pointers so it is hard to know which function is being called. It would be a fun utility to write. If there are no dynamic calls, it might work by analyzing the binary for basic blocks. For every block that is a target of a call it would find all reachable blocks until a return or loop with no return. It could build the tree from the calls in those basic blocks. It could use as the start of the tree the reset address and interrupt vectors. Marko On Wed, Jun 8, 2011 at 4:26 PM, Sivaram Gowkanapalli <[email protected]> wrote: > > Hello, > I am wondering if there is any functionality in gputils to see the call graph/call tree? > Given the limitation of the hardware stack being 31 levels deep, I want to ensurethat none of my call's are nested that deep. > Any thoughts, please? > ThanksSiva