Re: Declaring a function from gcc internals

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 31 Mar 2009 13:35:43 +0200, "Vincent R." <forumer@xxxxxxxxxxxxxxx>
wrote:
> Hi,
> 
> We are always working on implementing SEH exceptions on a arm
> cross-compiler so we have started to add parser recognition for __try
> ,__except __finally keyword (resp. RID_SEH_TRY, RID_SEH_EXCEPT,
> RID_SEH_FINALLY)
> 
> We have also declared the following new functions :
> extern void c_begin_seh_try_stmt (location_t, tree);
> extern tree c_finish_seh_try_stmt (void);
> extern void c_begin_except_clause (tree);
> extern void c_finish_except_clause (void);
> 
> Now let's consider the following sample code :
> 
> int _tmain(int argc, _TCHAR* argv[])
> {
>   DWORD* ptr = NULL;   // NULL pointer
> 
>       __try
>       {
>             puts("in try");
>             *ptr = 0x4242;    // causes an access violation exception;
>       }
>       __except(puts("in filter"), EXCEPTION_EXECUTE_HANDLER)
>       {
>             puts("in except");
>       }
>       return 0;
> }
> 
> What we need now is to parse the __except (easy)
Sorry didn't finish my sentence :

so I was saying we need to parse the __except(easy) and then declare an
anonymous function
with the instructions hold in the parenthesis and with the return value
defined by the last
argument in list :

so the original code should be parsed as it was writtent like that :

 int _tmain(int argc, _TCHAR* argv[])
 {
   DWORD* ptr = NULL;   // NULL pointer
 
       {
             puts("in try");
             *ptr = 0x4242;    // causes an access violation exception;
       }
       goto AEB; 
       {
             puts("in except");
AEB:   }

       return 0;
 }

int anonymous_func()
{
  puts("in filter");
  return EXCEPTION_EXECUTE_HANDLER;
}
  


So for now we use wondering if we need to use the start_function method or
if there is another way.
We need some advice.

Thanks
  

 








[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux