forked from AdaCore/gnatcoverage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
annotations.ads
204 lines (166 loc) · 7.99 KB
/
annotations.ads
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
------------------------------------------------------------------------------
-- --
-- GNATcoverage --
-- --
-- Copyright (C) 2009-2021, AdaCore --
-- --
-- GNATcoverage is free software; you can redistribute it and/or modify it --
-- under terms of the GNU General Public License as published by the Free --
-- Software Foundation; either version 3, or (at your option) any later --
-- version. This software is distributed in the hope that it will be useful --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
-- TABILITY 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 this software; see file --
-- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy --
-- of the license. --
------------------------------------------------------------------------------
with Ada.Text_IO;
with GNAT.Strings; use GNAT.Strings;
with Binary_Files; use Binary_Files;
with Coverage;
with Diagnostics; use Diagnostics;
with Disa_Symbolize; use Disa_Symbolize;
with Elf_Disassemblers; use Elf_Disassemblers;
with Files_Table; use Files_Table;
with SC_Obligations; use SC_Obligations;
with Slocs; use Slocs;
with Traces; use Traces;
with Traces_Elf; use Traces_Elf;
with Traces_Files_Registry; use Traces_Files_Registry;
with Traces_Lines; use Traces_Lines;
with Traces_Stats; use Traces_Stats;
with Types; use Types;
package Annotations is
type Annotation_Format is
(Annotate_Asm,
Annotate_Xcov,
Annotate_Html,
Annotate_Xcov_Plus,
Annotate_Html_Plus,
Annotate_Dynamic_Html,
Annotate_Xml,
Annotate_Report,
Annotate_Unknown);
function To_Annotation_Format (Option : String) return Annotation_Format;
-- Convert annotation format option to Annotation_Format value
Annotation : Annotation_Format := Annotate_Unknown;
-- The kind of output being generated
private
function Get_Unique_Filename
(File : Source_File_Index;
Extension : String) return String;
-- Return an unique filename to hold coverage annotations for File
function SCO_Text (SCO : SCO_Id; Length : Natural := 8) return String;
-- Extract the text of SCO from source file, truncating it to the
-- first source line and the first Length characters. If it has been
-- truncated, the returned value will end with "...".
function Message_Annotation (M : Message) return String;
-- Return a representation of M to be associated with an annotated line
Global_Stats : Stat_Array := (others => 0);
-- Stats associated with the whole set of source files that this package
-- considers (i.e. total numbers of lines, of partially covered /
-- not covered / fully covered lines...)
type Pretty_Printer is abstract tagged limited record
Need_Sources : Boolean;
Show_Details : Boolean;
Context : Coverage.Context_Access;
end record;
procedure Pretty_Print_Start
(Pp : in out Pretty_Printer) is null;
-- Called once at the beginning of the process
procedure Pretty_Print_End
(Pp : in out Pretty_Printer) is null;
-- Called once at the end of the process
procedure Pretty_Print_Start_File
(Pp : in out Pretty_Printer;
File : Source_File_Index;
Skip : out Boolean) is abstract;
-- Called at the beginning of a source file display
procedure Pretty_Print_End_File (Pp : in out Pretty_Printer) is abstract;
-- Called at the end of a source file display
procedure Pretty_Print_Start_Line
(Pp : in out Pretty_Printer;
Line_Num : Natural;
Info : Line_Info_Access;
Line : String) is abstract;
-- Let Pp start the pretty printing of line at Line_Num in current file
procedure Pretty_Print_End_Line (Pp : in out Pretty_Printer) is null;
-- Let Pp end the pretty printing of the current line
procedure Pretty_Print_Start_Instruction_Set
(Pp : in out Pretty_Printer;
State : Any_Line_State) is null;
-- Let Pp start the pretty printing of a set of instructions, State
-- being the merged state of all its instructions.
procedure Pretty_Print_End_Instruction_Set
(Pp : in out Pretty_Printer) is null;
-- Let Pp end the pretty printing of a set of instructions
procedure Pretty_Print_Start_Symbol
(Pp : in out Pretty_Printer;
Name : String;
Offset : Pc_Type;
State : Line_State) is null;
procedure Pretty_Print_End_Symbol (Pp : in out Pretty_Printer) is null;
procedure Pretty_Print_Insn
(Pp : in out Pretty_Printer;
Pc : Pc_Type;
State : Insn_State;
Insn : Binary_Content;
Insn_Set : Insn_Set_Type;
Sym : Symbolizer'Class) is null;
-- Let Pp print the instruction at Pc using Sym as a symbolizer. State
-- should be the coverage state of this instruction and Insn its binary
-- content.
procedure Pretty_Print_Message
(Pp : in out Pretty_Printer;
M : Message) is null;
-- Let Pp print the message M, attached to the current file:line
procedure Pretty_Print_Statement
(Pp : in out Pretty_Printer;
SCO : SCO_Id;
State : Line_State) is null;
-- Let Pp print the statement whose id is SCO
procedure Pretty_Print_Start_Decision
(Pp : in out Pretty_Printer;
SCO : SCO_Id;
State : Line_State) is null;
-- Let Pp start the display of the decision whose id is SCO
procedure Pretty_Print_End_Decision (Pp : in out Pretty_Printer) is null;
-- Let Pp close the display of the current decision
procedure Pretty_Print_Condition
(Pp : in out Pretty_Printer;
SCO : SCO_Id;
State : Line_State) is null;
-- Let Pp print the condition whose id is SCO
procedure Generate_Report
(Pp : in out Pretty_Printer'Class;
Show_Details : Boolean);
-- Let Pp generate the annotated sources. If Show_Details is False, only
-- a line state will be displayed. If Show_Details is True, a justification
-- is associated to this line state.
function Aggregated_State (Info : Line_Info) return Any_Line_State;
-- Return synthetic indication of coverage state for all computed criteria
function Original_Processing_Context
(TF : Trace_File_Element) return String;
-- If TF was processed in a previous Gnatcov execution whose coverage
-- information was then reloadad through a checkpoint, provide information
-- about the original processing context. Empty string for traces processed
-- in the current Gnatcov execution.
function Get_Exemption (Sloc : Source_Location) return Source_Location;
-- If the given sloc is covered by an exemption, return the source location
-- of the corresponding exemption annotation, else return No_Location.
function Get_Exemption_Message
(Sloc : Source_Location) return String_Access;
-- For a sloc denoting an Exempt_On annotation, return the descriptive
-- message justifying the exemption.
function Get_Exemption_Count
(Sloc : Source_Location) return Natural;
-- Return the exempted line/message counter for exemption at sloc
procedure Inc_Exemption_Count (Sloc : Source_Location);
-- Increment the exempted line/message counter for exemption at sloc
procedure Output_Multiline_Msg
(Output : Ada.Text_IO.File_Type;
Text : String);
-- Output the given Text on Output, replacing all
-- Ada.Characters.Latin_1.LF by a call to Ada.Text_IO.Newline.
end Annotations;