This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

generating functions and eh region


Sorry to cross-post here because I have started this discussion on gcc-help
but since we are trying to interest people about seh exceptions it might be
better
to do it here.
I first asked how to take some instructions and generate a function with
them,
so I wanted to know if start_function was the right way of doing it.
I have been told(thanks Ian) that if the function is only reached through
exceptions I would need to
look at eh region and here is the following question : 

 
Actually you are right the only way the function is called is through
exception.
When exception is raised OS will look for some exception information stored
inside specific sections and
jump to that filter function.
Now the question is can we declare a function with an eh region and will it
construct prologue and epilogue ?
Actually the __except keyword can be declared with two flavors :

1) __except( INSA, INSSB, ...) where INSX are instructions 

2) __except( FILTER_FUNC ) where FILTER_FUNC is a function 
    with the following prototype : int (*ptFilter)(unsigned int code,
struct _EXCEPTION_POINTERS *ep);

So in case 1) we need to take instructions inside __except() and to put
them in a
function, it means we need gcc
to construct prologue and epilogue. I suppose eh_region is only used to
mark code and prevent it to be optimized
and discarded but it doesn't solve the fact we need to construct a
function.
So we may need to call start_function
anyway, what do you think ?

In the second case we can pass directly a function so this time I suppose
we only need to declare it as
a eh_region. Could you confirm I am understanding well the purpose of
eh_region and tell us 
if  we are looking in the right direction.

Thanks


Vincent R.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]