From: jan.de.kruyf@gmail.com
Subject: Re: Arm - ravenscar - exceptions - last chance handler
Date: Sat, 30 May 2015 09:14:13 -0700 (PDT)
Date: 2015-05-30T09:14:13-07:00 [thread overview]
Message-ID: <e9d52501-dddd-4e0e-ab3d-ea198ffbd107@googlegroups.com> (raw)
In-Reply-To: <lypp5i840m.fsf@pushface.org>
On Saturday, May 30, 2015 at 5:43:38 PM UTC+2, Simon Wright wrote:
>
> > Could someone interprete this code for me (from the runtime) and advise
> >
> > procedure Raise_Exception (E : Exception_Id; Message : String := "") is
> > pragma Unreferenced (E);
> >
> > procedure Last_Chance_Handler (Msg : System.Address; Line : Integer);
> > pragma Import (C, Last_Chance_Handler, "__gnat_last_chance_handler");
> > pragma No_Return (Last_Chance_Handler);
> >
> > begin
> > Last_Chance_Handler (Message'Address, 0);
> > end Raise_Exception;
> >
> > end Ada.Exceptions;
> > --------------------------------
> >
> > How is last chance handler going to know the --length-- of the message?
> >
> > because I like to issue a printk before I die when in the linux kernel.
> >
> > I have used last chance handler in gdb by looking at the memory, but
> > kernel modules are not debugged that way.
>
> FWIW [arm-eabi-]gdb doesn't handle "Msg : System.Address" at all well;
> it works much better if you actually write __gnat_last_chance_handler in
> C rather than in Ada with an Export:
>
> #include <FreeRTOS.h>
> #include <task.h>
>
> __attribute__((weak))
> void __gnat_last_chance_handler(const char *message, int line) {
> taskDISABLE_INTERRUPTS();
> vTaskSuspendAll();
> // Loop indefinitely: use the debugger to examine the backtrace.
> while (1) {}
> }
Thanks, Simon.
See my answer to Bob Duff for the full story. I like your C solution, but in my case I will have to kick the bucket and unload myself. At least I believe thats what expected in linux kernel land.
cheers,
j.
prev parent reply other threads:[~2015-05-30 16:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-30 14:26 Arm - ravenscar - exceptions - last chance handler jan.de.kruyf
2015-05-30 14:53 ` Jacob Sparre Andersen
2015-05-30 18:48 ` jan.de.kruyf
2015-05-30 19:18 ` Simon Wright
2015-05-30 20:57 ` jan.de.kruyf
2015-05-30 15:31 ` Bob Duff
2015-05-30 16:10 ` jan.de.kruyf
2015-05-30 16:50 ` Simon Wright
2015-05-30 20:59 ` jan.de.kruyf
2015-05-30 15:43 ` Simon Wright
2015-05-30 16:14 ` jan.de.kruyf [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox