On Thursday 19 February 2009, Chengnian Sun wrote:
> I have a question. How much information I could get from the debug-info?

That depends on the debug info format used; I think you can concentrate
on DWARF. You can check out in the specifiation what is available in
principle, then look what a given compiler really provides, and then
check whether Valgrinds debug readers and core retrieval funtions are
enough for this task.

For callgrind, I never did anything with debug info about data types,
but that obviously whould be needed here. I always just used the service
functions for debug info which are available in Valgrind core.

AFAIK, Julian recently added some functions to get at variable name for
a given stack address. You need it the other way around: get information
about number of parameter and types, and how to access them.

Josef

> 
> Is it enough to get argument type?
> 
> Thanks.
> 
>  Best regards.
> 
> 
> Chengnian Sun.
> 
> 
> 
> 
> ________________________________
> From: Josef Weidendorfer <[email protected]>
> To: [email protected]
> Cc: Nicholas Nethercote <[email protected]>; Chengnian Sun 
> <[email protected]>
> 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 <[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