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]

[Ada] init.c clean ups.


Tested on i686-linux, committed on mainline.

Major rewrite of the VMS version of __gnat_error_handler to better handle
errors signaled by VMS condition codes. Messages from chained
codes are now appended together (with line separators) and stored in
the exception message field, instead of just the intial message.  Codes
are now properly matched w/o regard to extraneous fields. Most symbolic names
of codes are now imported from system libraries instead of being hardcoded.

The idea behing __gnat_initialize() is to provide a hook that is called
at program start up, and that can be replaced by the user. This capability
disappeared when more functions have been added to init.c
This change moves gnat_initialize to a separate file to restore this
capability.
--
Provide proper __gnat_initialize for ia64-hpux as part of the port to
this target.
--
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 in the FSF tree. We are using
__gnat_adjust_context_for_raise, which has been introduced recently for that
very purpose.
The required adjustment was previously done by the MD_FALLBACK_FRAME_STATE
circuitry for this target; however, recent versions of the Native POSIX
Thread Library (NPTL) are compiled with DWARF 2 unwind information, so that
the MD_FALLBACK_FRAME_STATE_FOR macro is never executed for signal frames,
and hence the PC adjustment was skipped. That is the reason why this required
adjustment has been moved to the signal handler itself.
Four different test cases have been created for ensuring that exception
propagation through signal handlers is working appropriately, by means of
forcing SIGSEGV and SIGFPE in both tasking and non-tasking programs. The
exception handler should execute in the four tests, and the expected output
when executing the four tests is:
SEGV Handler
Tasking: SEGV Handler
FPE Handler
Tasking: FPE Handler

We also take the opportunity to implement this capability for x86_64 targets

2005-06-10  Doug Rupp  <rupp@adacore.com>
	    Arnaud Charlet  <charlet@adacore.com>
	    Olivier Hainque  <hainque@adacore.com>
	    Jose Ruiz  <ruiz@adacore.com>

	* Make-lang.in: Add initialize.o when needed.
	Remove obsolete references to RT_FLAGS.
	Add missing dependencies for sdefault.o

	* initialize.c: New file.

	* init.c [VMS] Declare ADA$ externs weak to fix build problem in IVMS.
	[VMS] cond_signal_table: Fix problem in declaration.
	[VMS] __gnat_error_handler: rewrite.
	Move all __gnat_initialize() routines to initialize.c
	Specialize the former "hpux" section to "hppa hpux", as this is what the
	section really is here for and we now have other hpux ports that need
	different contents.
	(__gnat_adjust_context_for_raise) i386-linux: First version of this
	function for this target. Adjust PC by one in the machine context. This
	adjustment was previously done in the MD_FALLBACK_FRAME_STATE_FOR, but
	it is more reliable to do that in the signal handler itself.
	(__gnat_install_handler) i386-linux: 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) i386-linux: Adjust the signature to match what a
	SA_SIGINFO sigaction should look like. Call
	__gnat_adjust_context_for_raise before actually raising. Cleanup unused
	Machine_State_Operations stuff.
	Add conditional code so that the x86_64 is also supported.

Attachment: difs.36
Description: Text document


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