OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [ada/] [memroot.ads] - Blame information for rev 513

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 281 jeremybenn
------------------------------------------------------------------------------
2
--                                                                          --
3
--                         GNAT COMPILER COMPONENTS                         --
4
--                                                                          --
5
--                              M E M R O O T                               --
6
--                                                                          --
7
--                                 S p e c                                  --
8
--                                                                          --
9
--                     Copyright (C) 1997-2008, AdaCore                     --
10
--                                                                          --
11
-- GNAT is free software;  you can  redistribute it  and/or modify it under --
12
-- terms of the  GNU General Public License as published  by the Free Soft- --
13
-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
14
-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
15
-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
16
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
17
-- for  more details.  You should have  received  a copy of the GNU General --
18
-- Public License  distributed with GNAT; see file COPYING3.  If not, go to --
19
-- http://www.gnu.org/licenses for a complete copy of the license.          --
20
--                                                                          --
21
-- GNAT was originally developed  by the GNAT team at  New York University. --
22
-- Extensive contributions were provided by Ada Core Technologies Inc.      --
23
--                                                                          --
24
------------------------------------------------------------------------------
25
 
26
--  This package offers basic types that deal with gdb backtraces related
27
--  to memory allocation. A memory root (root_id) is a backtrace
28
--  referencing the actual point of allocation along with counters
29
--  recording various information concerning allocation at this root.
30
 
31
--  A back trace is composed of Frames (Frame_Id) which themselves are
32
--  nothing else than a subprogram call at a source location which can be
33
--  represented by three strings: subprogram name, file name and line
34
--  number. All the needed strings are entered in a table and referenced
35
--  through a Name_Id in order to avoid duplication.
36
 
37
with System.Storage_Elements; use System.Storage_Elements;
38
 
39
package Memroot is
40
 
41
   --  Simple abstract type for names. A name is a sequence of letters
42
 
43
   type Name_Id is new Natural;
44
   No_Name_Id : constant Name_Id := 0;
45
 
46
   function Enter_Name (S : String) return Name_Id;
47
   function Image      (N : Name_Id) return String;
48
 
49
   --  Simple abstract type for a backtrace frame. A frame is composed by
50
   --  a subprogram name, a file name and a line reference.
51
 
52
   type Frame_Id is new Natural;
53
   No_Frame_Id : constant Frame_Id := 0;
54
 
55
   function Enter_Frame
56
     (Addr : System.Address;
57
      Name : Name_Id;
58
      File : Name_Id;
59
      Line : Name_Id)
60
      return Frame_Id;
61
 
62
   type Frame_Array is array (Natural range <>) of Frame_Id;
63
 
64
   --  Simple abstract type for an allocation root. It is composed by a set
65
   --  of frames, the number of allocation, the total size of allocated
66
   --  memory, and the high water mark.  An iterator is also provided to
67
   --  iterate over all the entered allocation roots.
68
 
69
   type Root_Id is new Natural;
70
   No_Root_Id : constant Root_Id := 0;
71
 
72
   function Read_BT (BT_Depth : Integer) return Root_Id;
73
   --  Reads a backtrace whose maximum frame number is given by
74
   --  BT_Depth and returns the corresponding Allocation root.
75
 
76
   function Enter_Root  (Fr : Frame_Array) return Root_Id;
77
   --  Create an allocation root from the frames that compose it
78
 
79
   function Frames_Of   (B  : Root_Id) return Frame_Array;
80
   --  Retrieves the Frames of the root's backtrace
81
 
82
   procedure Print_BT (B  : Root_Id; Short : Boolean := False);
83
   --  Prints on standard out the backtrace associated with the root B
84
   --  When Short is set to True, only the filename & line info is printed.
85
   --  When it is set to false, the subprogram name is also printed.
86
 
87
   function Get_First return Root_Id;
88
   function Get_Next  return Root_Id;
89
   --  Iterator to iterate over roots
90
 
91
   procedure Set_Nb_Alloc (B : Root_Id; V : Integer);
92
   function      Nb_Alloc (B : Root_Id) return Integer;
93
   --  Access and modify the number of allocation counter associated with
94
   --  this allocation root. If the value is negative, it means that this is
95
   --  not an allocation root but a deallocation root (this can only happen
96
   --  in erroneous situations where there are more frees than allocations).
97
 
98
   procedure Set_Alloc_Size (B : Root_Id; V : Storage_Count);
99
   function      Alloc_Size (B : Root_Id) return Storage_Count;
100
   --  Access and modify the total allocated memory counter associated with
101
   --  this allocation root.
102
 
103
   procedure Set_High_Water_Mark (B : Root_Id; V : Storage_Count);
104
   function  High_Water_Mark     (B : Root_Id) return Storage_Count;
105
   --  Access and modify the high water mark associated with this
106
   --  allocation root. The high water mark is the maximum value, over
107
   --  time, of the Alloc_Size.
108
 
109
end Memroot;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.