Anonymous user
Ada Bare Bones: Difference between revisions
→Last chance handler
[unchecked revision] | [unchecked revision] |
m (→Discard_Names) |
|||
Line 213:
===Last chance handler===
The Ada runtime requires the presence of a <tt>Last_Chance_Handler</tt> subprogram. This subprogram is used as a handler for any exceptions that are not explicitly handled within their subprogram. These calls to the <tt>Last_Chance_Handler</tt> procedure in the case of unhandled exceptions will be automatically generated by the compiler.
In order to facilitate this the last chance handler procedure must be defined somewhere within the program. Typically this is defined within the runtime. The last chance handler procedure may have any name, however the compiler will search for a procedure with external linkage with the name <tt>__gnat_last_chance_handler</tt>.
Create the following files in the <tt>rts/boards/${arch}/adainclude</tt>:
====last_chance_handler.ads====
Line 232 ⟶ 236:
pragma Unreferenced (Source_Location, Line);
begin
-- TODO: Add in board-specific code to dump
loop
null;
Line 240 ⟶ 243:
</source>
The contents of the <tt>Last_Chance_Handler</tt> procedure will need to be tailored to the specific platform of the kernel. Typically this procedure will dump information regarding the exception to output media such as a [[Serial_Ports|serial port]].
===Compiling the runtime===
|