Am 07.07.2016 um 14:59 schrieb E. G. Patrick Bos:
> I'm using callgrind to analyse a c++ program (roofit) which builds a
> large tree of many interdependent objects of a few classes. Ideally, I
> would like to track not only the function calls, but also from (and to)
> which object they are called, so for instance including the address of
> the passed `this` pointer.
>
> Is such a thing possible and/or has it been tried before? And if not,
> would it be difficult to implement?

Not really.

When a new function is called, you can make up a new fn_node struct
whose name can embed the address of the 'this' pointer. However, you
would get a separate function called for every object. Not sure this
scales well.

Quite some time ago I had a patch doing similar stuff, but looking
up the stack or registers for parameter values depends on the calling
convention/ABI which is architecture/OS specific. I only did this for
amd64, and it was working nice, but it never went in.

I can search for the patch and send it to you.

Josef


> The alternative would be to build some kind of accounting system into
> the base classes in my code itself, but if it's easy in valgrind, that
> would be far preferable, since others can then also use it and I
> wouldn't have to mess up my own code :)
>
> Without having any knowledge of the valgrind source, I would imagine
> that it could be implemented similarly or as a generalization of the
> seperate-callers options.
>
> Cheers,
> Patrick
>
> ------------------------------------------------------------------------------
> Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
> Francisco, CA to explore cutting-edge tech and listen to tech luminaries
> present their vision of the future. This family event has something for
> everyone, including kids. Get more information and register today.
> http://sdm.link/attshape
> _______________________________________________
> Valgrind-users mailing list
> Valgrind-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/valgrind-users
>

------------------------------------------------------------------------------
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to