aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/init.c
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2004-02-12 14:28:13 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2004-02-12 14:28:13 +0100
commit18c0ecbeb82efa35502754b4031214050f0483ce (patch)
tree3067241056d7811b5be0253db902c31399aabba2 /gcc/ada/init.c
parenta980dd9b54d1bdee4a331b307980b75857c3f9f1 (diff)
downloadgcc-18c0ecbeb82efa35502754b4031214050f0483ce.zip
gcc-18c0ecbeb82efa35502754b4031214050f0483ce.tar.gz
gcc-18c0ecbeb82efa35502754b4031214050f0483ce.tar.bz2
[multiple changes]
2004-02-12 Olivier Hainque <hainque@act-europe.fr> * decl.c (components_to_record): Don't claim that the internal fields we make to hold the variant parts are semantically addressable, because they are not. * exp_pakd.adb (Create_Packed_Array_Type): Rename Esiz into PASize and adjust the comment describing the modular type form when we can use it. (Install_PAT): Account for the Esiz renaming. * init.c (__gnat_error_handler for alpha-tru64): Arrange to clear the sc_onstack context indication before raising the exception to which the signal is mapped. Allows better handling of later signals possibly triggered by the resumed user code if the exception is handled. 2004-02-12 Arnaud Charlet <charlet@act-europe.fr> * 5zinit.adb: Removed, no longer used. 2004-02-12 Robert Dewar <dewar@gnat.com> * ali.adb: Remove separating space between parameters on R line. Makes format consistent with format used by the binder for Set_Globals call. * atree.ads, atree.adb: Minor reformatting (new function header format) * bindgen.adb: Add Run-Time Globals documentation section containing detailed documentation of the globals passed from the binder file to the run time. * gnatls.adb: Minor reformatting * init.c (__gnat_set_globals): Add note pointing to documentation in bindgen. * lib-writ.ads, lib-writ.adb: Remove separating space between parameters on R line. Makes format consistent with format used by the binder for Set_Globals call. * osint.ads: Add 2004 to copyright notice Minor reformatting * snames.ads: Correct capitalization of FIFO_Within_Priorities Noticed during code reading, documentation issue only * usage.adb: Remove junk line for obsolete C switch Noticed during code reading 2004-02-12 Vincent Celier <celier@gnat.com> * bld.adb (Process_Declarative_Items): For Source_Dirs call gprcmd extend for each directory, so that multiple /** directories are extended individually. (Recursive_Process): Set the default for LANGUAGES to ada * gprcmd.adb: Define new command "ignore", to do nothing. Implement new comment "path". * Makefile.generic: Suppress output when SILENT is set Make sure that when compiler for C/C++ is gcc, the correct -x switch is used, so that the correct compiler is invoked. When compiler is gcc/g++, put search path in env vars C_INCLUDE_PATH/ CXX_INCLUDE_PATH, to avoid failure with too long command lines. 2004-02-12 Jerome Guitton <guitton@act-europe.fr> * Makefile.in: Clean ups and remove obsolete targets. 2004-02-12 Ed Schonberg <schonberg@gnat.com> * exp_ch5.adb: Remove Possible_Unligned_Slice, in favor of the similar predicate declared in exp_util. * exp_util.adb: Add comments. * sem_ch10.adb (Analyze_Subunit): Remove ultimate parent unit from visibility before compiling context of the subunit. * sem_res.adb (Check_Parameterless_Call): If the context expects a value but the name is a procedure, do not attempt to analyze as a call, in order to obtain more telling diagnostics. * sem_util.adb (Wrong_Type): Further enhancement to diagnose missing 'Access on parameterless function calls. (Normalize_Actuals): For a parameterless function call with missing actuals, defer diagnostic until resolution of enclosing call. * sem_util.adb (Wrong_Type): If the context type is an access to subprogram and the expression is a procedure name, suggest a missing 'attribute. From-SVN: r77704
Diffstat (limited to 'gcc/ada/init.c')
-rw-r--r--gcc/ada/init.c56
1 files changed, 53 insertions, 3 deletions
diff --git a/gcc/ada/init.c b/gcc/ada/init.c
index 4e4400f..7db7f1f 100644
--- a/gcc/ada/init.c
+++ b/gcc/ada/init.c
@@ -39,6 +39,10 @@
installed by this file are used to handle resulting signals that come
from these probes failing (i.e. touching protected pages) */
+/* This file should be kept synchronized with 2sinit.ads, 2sinit.adb, and
+ 5zinit.adb. All these files implement the required functionality for
+ different targets. */
+
/* The following include is here to meet the published VxWorks requirement
that the __vxworks header appear before any other include. */
#ifdef __vxworks
@@ -154,6 +158,9 @@ __gnat_get_interrupt_state (int intrup)
binder file is not in the shared library. Global references across library
boundaries like this are not handled correctly in all systems. */
+/* For detailed description of the parameters to this routine, see the
+ section titled Run-Time Globals in package Bindgen (bindgen.adb) */
+
void
__gnat_set_globals (int main_priority,
int time_slice_val,
@@ -363,6 +370,7 @@ __gnat_initialize (void)
exclude this case in the above test. */
#include <signal.h>
+#include <setjmp.h>
#include <sys/siginfo.h>
static void __gnat_error_handler (int, siginfo_t *, struct sigcontext *);
@@ -440,7 +448,48 @@ __gnat_error_handler (int sig, siginfo_t *sip, struct sigcontext *context)
if (mstate != 0)
*mstate = *context;
- Raise_From_Signal_Handler (exception, (char *) msg);
+ /* We are now going to raise the exception corresponding to the signal we
+ caught, which may eventually end up resuming the application code if the
+ exception is handled.
+
+ When the exception is handled, merely arranging for the *exception*
+ handler's context (stack pointer, program counter, other registers, ...)
+ to be installed is *not* enough to let the kernel think we've left the
+ *signal* handler. This has annoying implications if an alternate stack
+ has been setup for this *signal* handler, because the kernel thinks we
+ are still running on that alternate stack even after the jump, which
+ causes trouble at least as soon as another signal is raised.
+
+ We deal with this by forcing a "local" longjmp within the signal handler
+ below, forcing the "on alternate stack" indication to be reset (kernel
+ wise) on the way. If no alternate stack has been setup, this should be a
+ neutral operation. Otherwise, we will be in a delicate situation for a
+ short while because we are going to run the exception propagation code
+ within the alternate stack area (that is, with the stack pointer inside
+ the alternate stack bounds), but with the corresponding flag off from the
+ kernel's standpoint. We expect this to be ok as long as the propagation
+ code does not trigger a signal itself, which is expected.
+
+ ??? A better approach would be to at least delay this operation until the
+ last second, that is, until just before we jump to the exception handler,
+ if any. */
+ {
+ jmp_buf handler_jmpbuf;
+
+ if (setjmp (handler_jmpbuf) != 0)
+ Raise_From_Signal_Handler (exception, (char *) msg);
+ else
+ {
+ /* Arrange for the "on alternate stack" flag to be reset. See the
+ comments around "jmp_buf offsets" in /usr/include/setjmp.h. */
+ struct sigcontext * handler_context
+ = (struct sigcontext *) & handler_jmpbuf;
+
+ handler_context->sc_onstack = 0;
+
+ longjmp (handler_jmpbuf, 1);
+ }
+ }
}
void
@@ -461,11 +510,12 @@ __gnat_install_handler (void)
we want this to happen for tasks also. */
static char sig_stack [8*1024];
- /* 8K allocated here because 4K is not enough for the GCC/ZCX scheme. */
+ /* 8K is a mininum to be able to propagate an exception using the GCC/ZCX
+ scheme. */
struct sigaltstack ss;
- ss.ss_sp = (void *) & sig_stack;
+ ss.ss_sp = (void *) sig_stack;
ss.ss_size = sizeof (sig_stack);
ss.ss_flags = 0;