At 10:08 AM 4/13/2005 -0400, Andrew Pinski wrote:

>On Apr 13, 2005, at 10:06 AM, Chris Kirby wrote:
>
>>We are trying to use -finstrument-functions to do some custom profiling on 
>>x86 and ppc.
>>
>>For normal code execution, it works fine, calling our entry and exit methods 
>>as expected.
>>
>>Unfortunately, we are running into problems related to exceptions.  If we 
>>exit a function because of an exception, no exit method is called.  
>>This greatly diminishes the usefulness of the instrumentation since we are no 
>>longer guaranteed to get matching entry and exit calls.
>
>It works the way you want to for the 4.0 release.

Unfortunately our next release will be using gcc 3.4.2.

Looking at the 4.0 code, I can see that the exit instrumentation is done by 
wrapping a try finally around the entire function.  Backporting this to 3.4.2 
isn't as straightforward as I hoped.  I think something similar could be done 
in tree-optimize.c's tree_rest_of_compilation() but it looks like some of the 
tree/RTL methods have changed in 4.0.

Are there any examples of wrapping a method with a try finally clause and 
calling a given method compatible with 3.4.2?

- Chris

Reply via email to