-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
--- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
--- MA 02111-1307, USA. --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
--- As a special exception, if other files instantiate generics from this --
--- unit, or you link this unit with other files to produce an executable, --
--- this unit does not by itself cause the resulting executable to be --
--- covered by the GNU General Public License. This exception does not --
--- however invalidate any other reasons why the executable file might be --
--- covered by the GNU Public License. --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
function Basic_Exception_Traceback
(X : Exception_Occurrence) return String;
-- Returns an image of the complete call chain associated with an
- -- exception occurence in its most basic form, that is as a raw sequence
+ -- exception occurrence in its most basic form, that is as a raw sequence
-- of hexadecimal binary addresses.
function Tailored_Exception_Traceback
Ptr : in out Natural)
is
Name : String (1 .. Exception_Name_Length (X));
- -- Bufer in which to fetch the exception name, in order to check
+ -- Buffer in which to fetch the exception name, in order to check
-- whether this is an internal _ABORT_SIGNAL or a regular occurrence.
Name_Ptr : Natural := Name'First - 1;
Ptr : in out Natural)
is
begin
- if X.Num_Tracebacks <= 0 then
+ if X.Num_Tracebacks = 0 then
return;
end if;
-----------------------------------------
function Basic_Exception_Tback_Maxlength
- (X : Exception_Occurrence) return Natural is
+ (X : Exception_Occurrence) return Natural
+ is
+ Space_Per_Traceback : constant := 2 + 16 + 1;
+ -- Space for "0x" + HHHHHHHHHHHHHHHH + " "
begin
- return BETB_Header'Length + 1 + X.Num_Tracebacks * 19 + 1;
- -- 19 = 2 + 16 + 1 for each address ("0x" + HHHH + " ")
+ return BETB_Header'Length + 1 +
+ X.Num_Tracebacks * Space_Per_Traceback + 1;
end Basic_Exception_Tback_Maxlength;
---------------------------------------
declare
Len : constant Natural := Exception_Name_Length (Id);
- Name : constant String (1 .. Len) := Id.Full_Name (1 .. Len);
+ Name : constant String (1 .. Len) := To_Ptr (Id.Full_Name) (1 .. Len);
begin
Append_Info_String (Name, Info, Ptr);
end;
procedure Set_Exception_C_Msg
(Id : Exception_Id;
- Msg1 : Big_String_Ptr;
+ Msg1 : System.Address;
Line : Integer := 0;
- Msg2 : Big_String_Ptr := null)
+ Msg2 : System.Address := System.Null_Address)
is
Excep : constant EOA := Get_Current_Excep.all;
Val : Integer := Line;
Excep.Msg_Length := 0;
Excep.Cleanup_Flag := False;
- while Msg1 (Excep.Msg_Length + 1) /= ASCII.NUL
+ while To_Ptr (Msg1) (Excep.Msg_Length + 1) /= ASCII.NUL
and then Excep.Msg_Length < Exception_Msg_Max_Length
loop
Excep.Msg_Length := Excep.Msg_Length + 1;
- Excep.Msg (Excep.Msg_Length) := Msg1 (Excep.Msg_Length);
+ Excep.Msg (Excep.Msg_Length) := To_Ptr (Msg1) (Excep.Msg_Length);
end loop;
-- Append line number if present
-- Append second message if present
- if Msg2 /= null
+ if Msg2 /= System.Null_Address
and then Excep.Msg_Length + 1 < Exception_Msg_Max_Length
then
Excep.Msg_Length := Excep.Msg_Length + 1;
Excep.Msg (Excep.Msg_Length) := ' ';
Ptr := 1;
- while Msg2 (Ptr) /= ASCII.NUL
+ while To_Ptr (Msg2) (Ptr) /= ASCII.NUL
and then Excep.Msg_Length < Exception_Msg_Max_Length
loop
Excep.Msg_Length := Excep.Msg_Length + 1;
- Excep.Msg (Excep.Msg_Length) := Msg2 (Ptr);
+ Excep.Msg (Excep.Msg_Length) := To_Ptr (Msg2) (Ptr);
Ptr := Ptr + 1;
end loop;
end if;