comp.lang.ada
 help / color / mirror / Atom feed
* GNAT bending signal handlers
@ 2003-05-12  9:29 Oliver Kellogg
  2003-05-12 17:32 ` Mark Johnson
  0 siblings, 1 reply; 7+ messages in thread
From: Oliver Kellogg @ 2003-05-12  9:29 UTC (permalink / raw)


What is the reason that GNAT changes the SIGSEGV handler?

We would really like to get a core file.

(Similar for other signals: We'd like to get the Unix default
behavior where applicable.)

Thanks,

Oliver Kellogg



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GNAT bending signal handlers
  2003-05-12  9:29 GNAT bending signal handlers Oliver Kellogg
@ 2003-05-12 17:32 ` Mark Johnson
  2003-05-13 11:05   ` Oliver Kellogg
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Johnson @ 2003-05-12 17:32 UTC (permalink / raw)


Oliver Kellogg wrote:
> 
> What is the reason that GNAT changes the SIGSEGV handler?
> 
I suggest a look at the "super secret" GNAT Reference Manual for this
answer. Look for Pragma Interrupt_State (or simply search for "signal")
to see why various signals are required to implement Ada exceptions.

> We would really like to get a core file.
> 
Same place - this pragma can be used to provide "guaranteed standard
system default action if this interrupt is raised".

I believe this was added in GNAT 3.15 (or so) - if you don't have it,
you may need an update.

  --Mark



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GNAT bending signal handlers
  2003-05-12 17:32 ` Mark Johnson
@ 2003-05-13 11:05   ` Oliver Kellogg
  2003-05-13 13:33     ` Mark Johnson
  2003-05-13 13:34     ` Robert A Duff
  0 siblings, 2 replies; 7+ messages in thread
From: Oliver Kellogg @ 2003-05-13 11:05 UTC (permalink / raw)


Mark Johnson <mark_h_johnson@raytheon.com> wrote in message news:<3EBFDAB9.441F858D@raytheon.com>...
> 
> I suggest a look at the "super secret" GNAT Reference Manual for this
> answer. Look for Pragma Interrupt_State (or simply search for "signal")
> to see why various signals are required to implement Ada exceptions.

Hm, I can't find anything on a pragma Interrupt_State
(looked in gnat-3.15p-unx-docs as well as
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ada/gnat_rm.texi?rev=1.12&content-type=text/x-cvsweb-markup
, also searched for "signal".)

Anyway, I tried adding the following at the start of the main program:

 System.Interrupt_Management.Operations.Install_Default_Action
   (System.Interrupt_Management.Interrupt_ID
(System.OS_Interface.SIGSEGV));

but it doesn't change the behavior, apparently because

 System.Interrupt_Management.Reserve (System.OS_Interface.SIGSEGV) =
True

(BTW, this is with RedHat 8.0 and its standard gcc suite, i.e.
gnat-3.2.)

--Oliver



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GNAT bending signal handlers
  2003-05-13 11:05   ` Oliver Kellogg
@ 2003-05-13 13:33     ` Mark Johnson
  2003-05-13 13:34     ` Robert A Duff
  1 sibling, 0 replies; 7+ messages in thread
From: Mark Johnson @ 2003-05-13 13:33 UTC (permalink / raw)


Oliver Kellogg wrote:
> 
> Mark Johnson <mark_h_johnson@raytheon.com> wrote in message news:<3EBFDAB9.441F858D@raytheon.com>...
> >
> > I suggest a look at the "super secret" GNAT Reference Manual for this
> > answer. Look for Pragma Interrupt_State (or simply search for "signal")
> > to see why various signals are required to implement Ada exceptions.
> 
> Hm, I can't find anything on a pragma Interrupt_State
> (looked in gnat-3.15p-unx-docs as well as
> http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ada/gnat_rm.texi?rev=1.12&content-type=text/x-cvsweb-markup
> , also searched for "signal".)
> 
Alas, I was mistaken. I checked the documentation more fully and that
pragma (Interrupt_State) was introduced in GNAT 3.16 (and also in 5.00).
The same comment I made before about upgrading applies. However, since
there is not yet a "public" version of 3.16 - your choices are:
 - work w/ a bleeding edge version of gcc that supports Ada
 - get a support contract w/ ACT (to get 3.16a or 5.00a)
 - wait for 3.16 to come out
 - OR use the following instead...

The solution for 3.15 and before is to use
  pragma Unreserve_All_Interrupts;
which is a sledgehammer to make "all such interrupts unreserved". The
reference manual also points you to a-intnam.ads for the list of
interrupts handled in the specific version you are using.

I highly recommend a *complete* read of the user's guide and reference
manual before using GNAT in any serious way. There is a *lot* of this
kind of information in it. The alternative of course is to check the run
time source in the adainclude directory. In some cases - the best
documentation is buried in comments in the source code.

  --Mark



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GNAT bending signal handlers
  2003-05-13 11:05   ` Oliver Kellogg
  2003-05-13 13:33     ` Mark Johnson
@ 2003-05-13 13:34     ` Robert A Duff
  2003-05-14 12:39       ` Oliver Kellogg
  1 sibling, 1 reply; 7+ messages in thread
From: Robert A Duff @ 2003-05-13 13:34 UTC (permalink / raw)


okellogg@freenet.de (Oliver Kellogg) writes:

> Mark Johnson <mark_h_johnson@raytheon.com> wrote in message news:<3EBFDAB9.441F858D@raytheon.com>...
> > 
> > I suggest a look at the "super secret" GNAT Reference Manual for this
> > answer. Look for Pragma Interrupt_State (or simply search for "signal")
> > to see why various signals are required to implement Ada exceptions.
> 
> Hm, I can't find anything on a pragma Interrupt_State
> (looked in gnat-3.15p-unx-docs as well as
> http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ada/gnat_rm.texi?rev=1.12&content-type=text/x-cvsweb-markup
> , also searched for "signal".)
> 
> Anyway, I tried adding the following at the start of the main program:
> 
>  System.Interrupt_Management.Operations.Install_Default_Action
>    (System.Interrupt_Management.Interrupt_ID
> (System.OS_Interface.SIGSEGV));
> 
> but it doesn't change the behavior, apparently because
> 
>  System.Interrupt_Management.Reserve (System.OS_Interface.SIGSEGV) =
> True

GNAT supports a pragma Unreserve_All_Interrupts, which I found to be
necessary when I wanted to handle SIGINT.  I don't know if that's
related to your problem...

- Bob



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GNAT bending signal handlers
  2003-05-13 13:34     ` Robert A Duff
@ 2003-05-14 12:39       ` Oliver Kellogg
  2003-05-28 22:19         ` Robert A Duff
  0 siblings, 1 reply; 7+ messages in thread
From: Oliver Kellogg @ 2003-05-14 12:39 UTC (permalink / raw)


Robert A Duff <bobduff@shell01.TheWorld.com> wrote in message news:<wccy91bm0lj.fsf@shell01.TheWorld.com>...
> 
> GNAT supports a pragma Unreserve_All_Interrupts, which I found to be
> necessary when I wanted to handle SIGINT.  I don't know if that's
> related to your problem...

Great! That did the trick.

Many thanks.

--Oliver



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GNAT bending signal handlers
  2003-05-14 12:39       ` Oliver Kellogg
@ 2003-05-28 22:19         ` Robert A Duff
  0 siblings, 0 replies; 7+ messages in thread
From: Robert A Duff @ 2003-05-28 22:19 UTC (permalink / raw)


okellogg@freenet.de (Oliver Kellogg) writes:

> Robert A Duff <bobduff@shell01.TheWorld.com> wrote in message news:<wccy91bm0lj.fsf@shell01.TheWorld.com>...
> > 
> > GNAT supports a pragma Unreserve_All_Interrupts, which I found to be
> > necessary when I wanted to handle SIGINT.  I don't know if that's
> > related to your problem...
> 
> Great! That did the trick.
> 
> Many thanks.

You're welcome.

I've wondered whether the whole idea of "reserved interrupts" makes
sense.  I mean, why should the RM *require* the implementation to raise
exceptions when the user hooks a reserved interrupt?  Interrupts are
inherently implementation dependent anyway.  It seems to me, if the user
wants to hook the timer interrupt, the user should be allowed to do so.
Maybe that means that delay statements don't work, but so what?  Maybe
the user doesn't have any delay statements.  If you're handling
interrupts, you have to know what you're doing.  You have to know what
they mean on your implementation, and you have to know about any
interactions with your compiler's run-time system.

- Bob



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-05-28 22:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-12  9:29 GNAT bending signal handlers Oliver Kellogg
2003-05-12 17:32 ` Mark Johnson
2003-05-13 11:05   ` Oliver Kellogg
2003-05-13 13:33     ` Mark Johnson
2003-05-13 13:34     ` Robert A Duff
2003-05-14 12:39       ` Oliver Kellogg
2003-05-28 22:19         ` Robert A Duff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox