|
From: Nicholas N. <nj...@cs...> - 2006-10-04 22:09:58
|
On Wed, 4 Oct 2006, Janne Hellsten wrote:
> We do embedded development and have generally very limited amount of
> stack space available (4-8KB or so). Is it somehow possible to
> use valgrind to track how many bytes of stack is used during the
> execution of an application? Just getting the peak usage is enough
> for us. I remember trying to do it with massif, but IIRC I couldn't
> get fine-grained enough results out of it.
>
> Is this possible out of the box or should I look into patching say
> massif myself? If patching is the only option, what would be the best
> place to start?
Easier would be writing a new tool from scratch.
This probably sounds intimidating, but it shouldn't be. Use "nulgrind" (the
tool that does nothing) as the starting point, and have it register callback
functions for the "new_mem_stack" and "die_mem_stack" functions, which are
called every time the SP changes. See VG_(track_{new,die}_mem_stack) in
include/pub_tool_tooliface.h.
Nick
|