This is the mail archive of the gcc-patches@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] |
Manually tested under pa-hpux, ia64-vms. Tested on i686-linux. Committed on mainline. The PC values the GCC unwinder sees when propagating an exception usually are call return addresses. At each step, we are interested in checking the EH region of the call itself, so the PC value at hand is adjusted to search for the right region. When unwinding through a signal handler, the PC value we get is most often the address of the faulting instruction. This is the the instruction of interest eh-region-wise to start with, so the unwinder's adjustment should be avoided in this case. The unwinder is not able to do that properly, though, so it always adjusts and we need to compensate for this. The scheme here is to tweak the PC value before the unwinder sees it, from the signal handler as achieved for Java. We are using __gnat_adjust_context_for_raise for that very purpose. In addition, provide user flexibility in the choice of VMS conditions to resignal, which used to be hardcoded and thus impossible to control. Test program (should display 'Got exception!' 10 times): with Ada.Text_IO; use Ada.Text_IO; with System; use System; procedure Simple is A : Integer; for A'Address use System.Null_Address; begin for K in 1 .. 10 loop begin A := 1; exception when others => Put_Line ("Got exception!"); end; end loop; end Simple; 2005-03-08 Olivier Hainque <hainque@adacore.com> * s-intman-posix.adb (Notify_Exception): Adjust signature, as handler for sigactions with SA_SIGINFO set. Call __gnat_adjust_context_for_raise before raising, to perform the potentially required adjustments to the machine context for the GCC unwinder. * raise.h (__gnat_adjust_context_for_raise): New prototype. * init.c (__gnat_adjust_context_for_raise) HPUX: Initial revision. Adjust PC by one in the provided machine context. (__gnat_install_handler) HPUX: Set SA_SIGINFO in the sigaction flags, so that the handler is passed the context structure to adjust prior to the raise. (__gnat_error_handler) HPUX: Adjust the signature to match what an SA_SIGINFO sigaction should look like. Call __gnat_adjust_context_for_raise before actually raising. (__gnat_adjust_context_for_raise): Default noop to help PC adjustments before raise from signal handlers. (__gnat_error_handler): Indirectly call a predicate function to determine if a condition should be resignaled or not. (__gnat_set_resignal_predicate): User interface to modify the predicate. (__gnat_default_resignal_p): Default GNAT predicate.
Attachment:
difs.4
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |