Re: [Cegcc-devel] C++ exceptions

2007-07-04 Thread Kevin O'Connor
On Mon, Jul 02, 2007 at 12:38:48AM +0100, Pedro Alves wrote: > Kevin O'Connor escreveu: > > Is it safe to enter an exception handler using the calling program's > > stack? That is, if you set the pc to a handler and call > > EXCEPTION_CONTINUE_EXECUTION that handler will alter the stack and > > re

Re: [Cegcc-devel] C++ exceptions

2007-07-04 Thread Kevin O'Connor
On Tue, Jul 03, 2007 at 09:55:15PM +0100, Pedro Alves wrote: > Perhaps. Did you look closely? I've registered the .pdata stuff and > the data just before the function directly in the source file that > uses it. That means we can probably hide it in > more-or-less-easy-to-use macros in any functi

Re: [Cegcc-devel] C++ exceptions

2007-07-04 Thread Danny Backx
On Tue, 2007-07-03 at 21:55 +0100, Pedro Alves wrote: > Danny Backx wrote: > > On Tue, 2007-07-03 at 03:14 +0100, Pedro Alves wrote: > >>> Let me see if I can come up with something in the following days. > >> OK, here is my take. See/try attached. > >> > >> - It shows that it is possible to have

Re: [Cegcc-devel] C++ exceptions

2007-07-04 Thread Pedro Alves
Kevin O'Connor wrote: >> DWORD* sp = (DWORD*)ContextRecord->Sp; >>*--sp = ContextRecord->Pc; > [...] > > Sp is the stack of the main code, and the exception handler writes to > that stack space. Are we guarenteed that if we longjmp back to the > main code that it wont corrupt anything? (In

Re: [Cegcc-devel] C++ exceptions

2007-07-04 Thread Pedro Alves
Danny Backx wrote: > I'd like to have two discussions. We're already having them both, that's > very good. I'd like to discuss design goals, and implementation. Both > are important. You'll find I might change the topic from one to the > other at times. > > Maybe I'm too vague, allow me to clarify

Re: [Cegcc-devel] C++ exceptions

2007-07-04 Thread Pedro Alves
Kevin O'Connor wrote: > On Tue, Jul 03, 2007 at 09:55:15PM +0100, Pedro Alves wrote: >> Perhaps. Did you look closely? I've registered the .pdata stuff and >> the data just before the function directly in the source file that >> uses it. That means we can probably hide it in >> more-or-less-easy

Re: [Cegcc-devel] C++ exceptions

2007-07-04 Thread Kevin O'Connor
On Wed, Jul 04, 2007 at 11:31:30PM +0100, Pedro Alves wrote: > Kevin O'Connor wrote: > > I think future versions of gcc wont guarantee function placement > > relative to top-level asm statements. > > > > Ah, you're paying attention. :) It will certainly fail today if > we use -ffunction-sections

Re: [Cegcc-devel] C++ exceptions

2007-07-04 Thread Pedro Alves
This is the part I was trying to get right with the macros: > __asm__( > // Data to be placed at start of .text section > "\t.section .init\n" > "\t.word eh_handler\n" > "\t.word 0\n" > "start_eh_text:\n" > This is documented to having to be placed immediately before the func

Re: [Cegcc-devel] C++ exceptions

2007-07-04 Thread Kevin O'Connor
On Thu, Jul 05, 2007 at 01:46:30AM +0100, Pedro Alves wrote: > This is the part I was trying to get right with the macros: > > > __asm__( > > // Data to be placed at start of .text section > > "\t.section .init\n" > > "\t.word eh_handler\n" > > "\t.word 0\n" > > "start_eh_text:

Re: [Cegcc-devel] C++ exceptions

2007-07-04 Thread Pedro Alves
Kevin O'Connor wrote: > On Thu, Jul 05, 2007 at 01:46:30AM +0100, Pedro Alves wrote: >> This is the part I was trying to get right with the macros: >> >>> __asm__( >>> // Data to be placed at start of .text section >>> "\t.section .init\n" >>> "\t.word eh_handler\n" >>> "\t.word 0\n

Re: [Cegcc-devel] C++ exceptions

2007-07-04 Thread Kevin O'Connor
On Thu, Jul 05, 2007 at 02:54:33AM +0100, Pedro Alves wrote: > #define TRY_EXCEPTION_HANDLER \ > struct eh_data __ehd; \ > int __ret = setjmp(__ehd.env); \ > if (!__ret) { \ > start_ehandling(&__e