This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: On strategies for function call instrumentation
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Derrick Coetzee <dc at moonflare dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 24 Nov 2009 08:08:11 -0800
- Subject: Re: On strategies for function call instrumentation
- References: <bff535ec0911231944i450bacckedb3c5a317e1fdb9@mail.gmail.com>
Derrick Coetzee wrote:
> 1. We have a C/C++ source-to-source translation framework. We could
> translate each function call "f(a,b,c)" to something like "({ _asm {
> ... }; typeof(f(a,b,c)) result = f(a,b,c); _asm { ... }; result; })"
> 2. We could modify the code generation of gcc in a private fork.
I think you will need to do (2). The source-to-source approach probably
isn't robust enough for what you need to do. You *might* be able to do
it if you pull all calls out of the arguments, but then you have to do
things like:
f(g()) -> temp = g(), f(temp)
before you put in your asm, and if you're in C++ land, you're now
doomed, since creating named temporaries can change the semantics of
programs.
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713