PR sanitizer/80403
[official-gcc.git] / gcc / ada / g-memdum.ads
blob0d56e2189e93bf01e4dff211e9271a417d6a1838
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- G N A T . M E M O R Y _ D U M P --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2003-2014, 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. --
17 -- --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
21 -- --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
26 -- --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
29 -- --
30 ------------------------------------------------------------------------------
32 -- A routine for dumping memory to either standard output or standard error.
33 -- Uses GNAT.IO for actual output (use the controls in GNAT.IO to specify
34 -- the destination of the output, which by default is Standard_Output).
36 with System;
38 package GNAT.Memory_Dump is
39 pragma Preelaborate;
41 type Prefix_Type is (Absolute_Address, Offset, None);
43 procedure Dump
44 (Addr : System.Address;
45 Count : Natural);
46 -- Dumps indicated number (Count) of bytes, starting at the address given
47 -- by Addr. The coding of this routine in its current form assumes the case
48 -- of a byte addressable machine (and is therefore inapplicable to machines
49 -- like the AAMP, where the storage unit is not 8 bits). The output is one
50 -- or more lines in the following format, which is for the case of 32-bit
51 -- addresses (64-bit addresses are handled appropriately):
53 -- 0234_3368: 66 67 68 . . . 73 74 75 "fghijklmnopqstuv"
55 -- All but the last line have 16 bytes. A question mark is used in the
56 -- string data to indicate a non-printable character.
58 procedure Dump
59 (Addr : System.Address;
60 Count : Natural;
61 Prefix : Prefix_Type);
62 -- Same as above, but allows the selection of different line formats.
63 -- If Prefix is set to Absolute_Address, the output is identical to the
64 -- above version, each line starting with the absolute address of the
65 -- first dumped storage element.
67 -- If Prefix is set to Offset, then instead each line starts with the
68 -- indication of the offset relative to Addr:
70 -- 00: 66 67 68 . . . 73 74 75 "fghijklmnopqstuv"
72 -- Finally if Prefix is set to None, the prefix is suppressed altogether,
73 -- and only the memory contents are displayed:
75 -- 66 67 68 . . . 73 74 75 "fghijklmnopqstuv"
77 end GNAT.Memory_Dump;