From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Last chance handler on a PC Date: Thu, 30 Jan 2020 21:02:17 +0100 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 30 Jan 2020 20:02:19 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="a1280ec4801e9e97fc4be09c23c03623"; logging-data="13743"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+afvCGaHCYQ3PFQ7hwRJK1dN0rFWZHtC0=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 Cancel-Lock: sha1:Egpsn+Nxapj5zJwaNepRFN+FbJQ= In-Reply-To: Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:57991 Date: 2020-01-30T21:02:17+01:00 List-Id: On 1/30/20 8:35 PM, ahlan@marriott.org wrote: > > To catch unhandled exceptions you only need to write a simple procedure and export it as __gnat_last_chance_handler. > This is linked into the program in preference to the default last chance handler provided by GNAT. > This procedure is called if nothing catches a raised exception. > Including those raised during package elaboration. Doing Ada.Task_Termination.Set_Specific_Handler (T => Ada.Task_Identification.Environment_Task, Handler => Last_Chance'access); should do the same thing more portably. It will be called when the environment task terminates for any reason; you would only want it to actually do something when Cause = Unhandled_Exception. -- Jeff Carter "My mind is a raging torrent, flooded with rivulets of thought, cascading into a waterfall of creative alternatives." Blazing Saddles 89