From: Simon Wright <simon@pushface.org>
Subject: Re: Arm - ravenscar - exceptions - last chance handler
Date: Sat, 30 May 2015 16:43:37 +0100
Date: 2015-05-30T16:43:37+01:00 [thread overview]
Message-ID: <lypp5i840m.fsf@pushface.org> (raw)
In-Reply-To: 41913ae0-7513-4be5-bb94-b834836f8525@googlegroups.com
jan.de.kruyf@gmail.com writes:
> 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) {}
}
next prev parent reply other threads:[~2015-05-30 15:43 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 [this message]
2015-05-30 16:14 ` jan.de.kruyf
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox