This is the mail archive of the cygwin mailing list for the Cygwin 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]

RE: [BUG] try..catch does not work if compiled with clang 8.0


 Hello! I've done some more research on this particular bug.

> > > I have an impression that it has to do with the bug I previously reported
> > > (and someone here claimed he could reproduce it)
> >
> > Please provide a link to the Cygwin ML message; is it this, confirmed by Takashi
> > Yano:
> >
> > 	https://cygwin.com/ml/cygwin/2019-10/msg00038.html
> 
>  Yes, that one.

 So, first of all, _GCC_specific_handler() inside libgcc never returns anything but ExceptionContinueSearch . However it's clear from __cxa_throw() code that the control must go past RaiseException() in order to reach std::terminate(). Study of 32-bit version behavior with gdb confirms that indeed this is the expected control flow.
 So, i conclude that ExceptionContinueExecution should be issued somewhere else. Again, with gdb and grep i've figured out that exception::handle() inside cygwin1.dll is responsible for it. Here is where behavior significantly differs between 64 and 32-bit versions. With 32-bit version the exception handling ends here:
--- cut ---
#ifdef __i386__
  if (me.andreas)
    me.andreas->leave ();	/* Return from a "san" caught fault */
#endif
--- cut ---
 leave() never returns, the exception gets re-thrown a couple of times (every time ending up in this leave()), then RaiseException() eventually returns and std::terminate() is called.

 With x68-64 version it seems to go through switch (e->ExceptionCode) and return ExceptionContinueSearch from "default" case. There are no more handlers, so the process is terminated. ExceptionCode is 0x20474343 (" GCC" ?)
 Apparently there's something missing and/or not working regarding this "san Andreas" trick. I don't know what it is and have no time to research since i'm leaving for vacation till January.So won't be responsive for some time, sorry. Hopefully my study will give you some hints.


Kind regards,
Pavel Fedin
Senior Engineer
Samsung Electronics Research center Russia



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


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