|
From: Chengnian S. <che...@ya...> - 2009-02-19 07:41:04
|
I have a question. How much information I could get from the debug-info ?
Is it enough to get argument type?
Thanks.
Best regards.
Chengnian Sun.
________________________________
From: Josef Weidendorfer <Jos...@gm...>
To: val...@li...
Cc: Nicholas Nethercote <n.n...@gm...>; Chengnian Sun <che...@ya...>
Sent: Thursday, February 19, 2009 3:36:11 AM
Subject: Re: [Valgrind-users] get the types and values of arguments
On Tuesday 17 February 2009, Nicholas Nethercote wrote:
> On Tue, Feb 17, 2009 at 11:00 PM, Chengnian Sun <che...@ya...> 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
|