diff options
author | bosch <bosch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-03-08 22:49:35 +0000 |
---|---|---|
committer | bosch <bosch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-03-08 22:49:35 +0000 |
commit | b9e214e0e1ffeece8a4baf59a1c3b0cbfbff14f8 (patch) | |
tree | e1966bb24cb5ddb58313cbf62e39a664a3776d73 /gcc/ada/sinput-d.adb | |
parent | 6a81282b53802d45c05cf25c1fdb6e57f24e8835 (diff) | |
download | gcc-b9e214e0e1ffeece8a4baf59a1c3b0cbfbff14f8.tar.gz |
* adadecode.c, adadecode.h, aux-io.c, s-traces.adb, s-traces.ads,
s-tratas.adb, s-tratas.ads, sinput-d.adb, sinput-d.ads,
switch-b.adb, switch-b.ads, switch-c.adb, switch-c.ads,
switch-m.adb, switch-m.ads : New files.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@50466 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sinput-d.adb')
-rw-r--r-- | gcc/ada/sinput-d.adb | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/gcc/ada/sinput-d.adb b/gcc/ada/sinput-d.adb new file mode 100644 index 00000000000..6666a0ffa75 --- /dev/null +++ b/gcc/ada/sinput-d.adb @@ -0,0 +1,113 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT COMPILER COMPONENTS -- +-- -- +-- S I N P U T . D -- +-- -- +-- B o d y -- +-- -- +-- $Revision$ +-- -- +-- Copyright (C) 2001, 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- -- +-- 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. -- +-- -- +-- GNAT was originally developed by the GNAT team at New York University. -- +-- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). -- +-- -- +------------------------------------------------------------------------------ + +with Osint; use Osint; +with Osint.C; use Osint.C; + +package body Sinput.D is + + Dfile : Source_File_Index; + -- Index of currently active debug source file + + ------------------------ + -- Close_Debug_Source -- + ------------------------ + + procedure Close_Debug_Source is + S : Source_File_Record renames Source_File.Table (Dfile); + Src : Source_Buffer_Ptr; + + begin + Trim_Lines_Table (Dfile); + Close_Debug_File; + + -- Now we need to read the file that we wrote and store it + -- in memory for subsequent access. + + Read_Source_File + (S.Debug_Source_Name, S.Source_First, S.Source_Last, Src); + S.Source_Text := Src; + end Close_Debug_Source; + + ------------------------- + -- Create_Debug_Source -- + ------------------------- + + procedure Create_Debug_Source + (Source : Source_File_Index; + Loc : out Source_Ptr) + is + begin + Loc := Source_File.Table (Source_File.Last).Source_Last + 1; + Source_File.Increment_Last; + Dfile := Source_File.Last; + + declare + S : Source_File_Record renames Source_File.Table (Dfile); + + begin + S := Source_File.Table (Source); + S.Debug_Source_Name := Create_Debug_File (S.File_Name); + S.Source_First := Loc; + S.Source_Last := Loc; + S.Lines_Table := null; + S.Last_Source_Line := 1; + + -- Allocate lines table, guess that it needs to be three times + -- bigger than the original source (in number of lines). + + Alloc_Line_Tables + (S, Int (Source_File.Table (Source).Last_Source_Line * 3)); + S.Lines_Table (1) := Loc; + end; + end Create_Debug_Source; + + ---------------------- + -- Write_Debug_Line -- + ---------------------- + + procedure Write_Debug_Line (Str : String; Loc : in out Source_Ptr) is + S : Source_File_Record renames Source_File.Table (Dfile); + + begin + -- Ignore write request if null line at start of file + + if Str'Length = 0 and then Loc = S.Source_First then + return; + + -- Here we write the line, and update the source record entry + + else + Write_Debug_Info (Str (Str'First .. Str'Last - 1)); + Add_Line_Tables_Entry (S, Loc); + Loc := Loc - 1 + Source_Ptr (Str'Length + Debug_File_Eol_Length); + S.Source_Last := Loc; + end if; + end Write_Debug_Line; + +end Sinput.D; |