On Tuesday 17 February 2009, Nicholas Nethercote wrote:
> On Tue, Feb 17, 2009 at 11:00 PM, Chengnian Sun <[email protected]> 
> wrote:
> >
> > Is it possible to get the types and values of arguments with Valgrind?
> 
> It's difficult to do at the binary level.  You probably need debug
> info to know what args a function is expecting, you probably can't
> just tell from the instruction stream.
> 
> > I would like to instrument applications to get the execution trace including
> > the functions called and their argument values and types.
> 
> The Callgrind tool is able to trace function entry/exit.  And the
> --read-var-info option causes debug info for stack variables to be
> read.  It might be possible to combine the two to get what you want,
> but it would require non-trivial effort.

There was some interest in the past regarding the debug output which callgrind
prints out with "--ct-verbose=1"; something like

...
   .   .  > memcpy(0x8062c0d, 0xbefda9d4, ...) [libc-2.9.so / 0x75c40]
   .   .  > memcpy(0x8062c13, 0xbefda9db, ...) [libc-2.9.so / 0x75c40]
   .   .  > fgets_unlocked(0xbefda9d4, 0x190, ...) [libc-2.9.so / 0x67380]
   .   .   > 0x0001653f(0x8062518, 0xbefda9d4, ...) [libc-2.9.so / 0x1653f]
   .   .   > _IO_getline(0x8062518, 0xbefda9d4, ...) [libc-2.9.so / 0x5deb0]
   .   .   .> 0x0001653f(0x8062518, 0xbefda9d4, ...) [libc-2.9.so / 0x1653f]
   .   .   .> _IO_getline_info(0x8062518, 0xbefda9d4, ...) [libc-2.9.so / 
0x5df00]
   .   .   . > 0x0001653f(0xbefda9d4, 0x4024793, ...) [libc-2.9.so / 0x1653f]
   .   .   . > memchr(0x40247a6, 0xa, ...) [libc-2.9.so / 0x752f0]
   .   .   . > memcpy(0xbefda9d4, 0x40247a6, ...) [libc-2.9.so / 0x75c40]
   .   .  > index(0xbefda9d4, 0xa, ...) [libc-2.9.so / 0x73460]
...

If somebody can derive enough information from debug info to allow for output 
similar
to "strace" or "ltrace", this for sure is welcome, and probably would rectify 
its own
tool "vtrace".

Josef



------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to