This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: __attribute__((cleanup(function)) versus try/finally
- From: Richard Henderson <rth at redhat dot com>
- To: Ranjit Mathew <rmathew at hotmail dot com>
- Cc: jason at redhat dot com, gcc at gcc dot gnu dot org
- Date: Wed, 7 May 2003 11:20:57 -0700
- Subject: Re: __attribute__((cleanup(function)) versus try/finally
- References: <3EB8DD9A.2050100@hotmail.com>
On Wed, May 07, 2003 at 03:49:06PM +0530, Ranjit Mathew wrote:
> The same issue was pointed out (albeit in passing)
> when Aldy Hernandez had submitted his __try/__finally
> patch to GCC for C.
And I responded at the time claiming that the semantics of
the two extensions are identical.
> Since the Win32 API stack does not have DW2 EH
> unwind information, the program just terminates
> when an exception is thrown (if using DW2 EH).
>
> SJLJ does not have any such problems.
>
> In fact, this seems to be a fundamental limitation
> of the DW2 EH mechanism and not just on Windows.
Yes. Such is the price you pay for not saving all of the
registers up front when an exception is *not* thrown.
> MD_FALLBACK_FRAME_STATE_FOR looks a bit promising
> but how do we generalise it to any "foreign" caller?
Eh, MD_FALLBACK_FRAME_STATE_FOR isn't really generalizable.
You could perhaps hack it to parse SEH unwind data, but...
Another possibility is to give up on unwind-dw2.c entirely
and write a new unwinder that uses the SEH bits in the Win32
API directly, all the time. Then (1) you'd be able to unwind
through Windows routines and (2) there'd be no "confusion"
about the supposed "differences" in try/finally.
r~