annotate libgcc/libgcov.h @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Header file for libgcov-*.c.
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2 Copyright (C) 1996-2020 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 This file is part of GCC.
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 GCC is free software; you can redistribute it and/or modify it under
kono
parents:
diff changeset
7 the terms of the GNU General Public License as published by the Free
kono
parents:
diff changeset
8 Software Foundation; either version 3, or (at your option) any later
kono
parents:
diff changeset
9 version.
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
kono
parents:
diff changeset
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
kono
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
kono
parents:
diff changeset
14 for more details.
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 Under Section 7 of GPL version 3, you are granted additional
kono
parents:
diff changeset
17 permissions described in the GCC Runtime Library Exception, version
kono
parents:
diff changeset
18 3.1, as published by the Free Software Foundation.
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 You should have received a copy of the GNU General Public License and
kono
parents:
diff changeset
21 a copy of the GCC Runtime Library Exception along with this program;
kono
parents:
diff changeset
22 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
kono
parents:
diff changeset
23 <http://www.gnu.org/licenses/>. */
kono
parents:
diff changeset
24
kono
parents:
diff changeset
25 #ifndef GCC_LIBGCOV_H
kono
parents:
diff changeset
26 #define GCC_LIBGCOV_H
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 /* work around the poisoned malloc/calloc in system.h. */
kono
parents:
diff changeset
29 #ifndef xmalloc
kono
parents:
diff changeset
30 #define xmalloc malloc
kono
parents:
diff changeset
31 #endif
kono
parents:
diff changeset
32 #ifndef xcalloc
kono
parents:
diff changeset
33 #define xcalloc calloc
kono
parents:
diff changeset
34 #endif
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 #ifndef IN_GCOV_TOOL
kono
parents:
diff changeset
37 /* About the target. */
kono
parents:
diff changeset
38 /* This path will be used by libgcov runtime. */
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40 #include "tconfig.h"
kono
parents:
diff changeset
41 #include "auto-target.h"
kono
parents:
diff changeset
42 #include "tsystem.h"
kono
parents:
diff changeset
43 #include "coretypes.h"
kono
parents:
diff changeset
44 #include "tm.h"
kono
parents:
diff changeset
45 #include "libgcc_tm.h"
kono
parents:
diff changeset
46 #include "gcov.h"
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 #if __CHAR_BIT__ == 8
kono
parents:
diff changeset
49 typedef unsigned gcov_unsigned_t __attribute__ ((mode (SI)));
kono
parents:
diff changeset
50 typedef unsigned gcov_position_t __attribute__ ((mode (SI)));
kono
parents:
diff changeset
51 #if LONG_LONG_TYPE_SIZE > 32
kono
parents:
diff changeset
52 typedef signed gcov_type __attribute__ ((mode (DI)));
kono
parents:
diff changeset
53 typedef unsigned gcov_type_unsigned __attribute__ ((mode (DI)));
kono
parents:
diff changeset
54 #else
kono
parents:
diff changeset
55 typedef signed gcov_type __attribute__ ((mode (SI)));
kono
parents:
diff changeset
56 typedef unsigned gcov_type_unsigned __attribute__ ((mode (SI)));
kono
parents:
diff changeset
57 #endif
kono
parents:
diff changeset
58 #else
kono
parents:
diff changeset
59 #if __CHAR_BIT__ == 16
kono
parents:
diff changeset
60 typedef unsigned gcov_unsigned_t __attribute__ ((mode (HI)));
kono
parents:
diff changeset
61 typedef unsigned gcov_position_t __attribute__ ((mode (HI)));
kono
parents:
diff changeset
62 #if LONG_LONG_TYPE_SIZE > 32
kono
parents:
diff changeset
63 typedef signed gcov_type __attribute__ ((mode (SI)));
kono
parents:
diff changeset
64 typedef unsigned gcov_type_unsigned __attribute__ ((mode (SI)));
kono
parents:
diff changeset
65 #else
kono
parents:
diff changeset
66 typedef signed gcov_type __attribute__ ((mode (HI)));
kono
parents:
diff changeset
67 typedef unsigned gcov_type_unsigned __attribute__ ((mode (HI)));
kono
parents:
diff changeset
68 #endif
kono
parents:
diff changeset
69 #else
kono
parents:
diff changeset
70 typedef unsigned gcov_unsigned_t __attribute__ ((mode (QI)));
kono
parents:
diff changeset
71 typedef unsigned gcov_position_t __attribute__ ((mode (QI)));
kono
parents:
diff changeset
72 #if LONG_LONG_TYPE_SIZE > 32
kono
parents:
diff changeset
73 typedef signed gcov_type __attribute__ ((mode (HI)));
kono
parents:
diff changeset
74 typedef unsigned gcov_type_unsigned __attribute__ ((mode (HI)));
kono
parents:
diff changeset
75 #else
kono
parents:
diff changeset
76 typedef signed gcov_type __attribute__ ((mode (QI)));
kono
parents:
diff changeset
77 typedef unsigned gcov_type_unsigned __attribute__ ((mode (QI)));
kono
parents:
diff changeset
78 #endif
kono
parents:
diff changeset
79 #endif
kono
parents:
diff changeset
80 #endif
kono
parents:
diff changeset
81
kono
parents:
diff changeset
82 #if defined (TARGET_POSIX_IO)
kono
parents:
diff changeset
83 #define GCOV_LOCKED 1
kono
parents:
diff changeset
84 #else
kono
parents:
diff changeset
85 #define GCOV_LOCKED 0
kono
parents:
diff changeset
86 #endif
kono
parents:
diff changeset
87
kono
parents:
diff changeset
88 /* In libgcov we need these functions to be extern, so prefix them with
kono
parents:
diff changeset
89 __gcov. In libgcov they must also be hidden so that the instance in
kono
parents:
diff changeset
90 the executable is not also used in a DSO. */
kono
parents:
diff changeset
91 #define gcov_var __gcov_var
kono
parents:
diff changeset
92 #define gcov_open __gcov_open
kono
parents:
diff changeset
93 #define gcov_close __gcov_close
kono
parents:
diff changeset
94 #define gcov_write_tag_length __gcov_write_tag_length
kono
parents:
diff changeset
95 #define gcov_position __gcov_position
kono
parents:
diff changeset
96 #define gcov_seek __gcov_seek
kono
parents:
diff changeset
97 #define gcov_rewrite __gcov_rewrite
kono
parents:
diff changeset
98 #define gcov_is_error __gcov_is_error
kono
parents:
diff changeset
99 #define gcov_write_unsigned __gcov_write_unsigned
kono
parents:
diff changeset
100 #define gcov_write_counter __gcov_write_counter
kono
parents:
diff changeset
101 #define gcov_write_summary __gcov_write_summary
kono
parents:
diff changeset
102 #define gcov_read_unsigned __gcov_read_unsigned
kono
parents:
diff changeset
103 #define gcov_read_counter __gcov_read_counter
kono
parents:
diff changeset
104 #define gcov_read_summary __gcov_read_summary
kono
parents:
diff changeset
105
kono
parents:
diff changeset
106 #else /* IN_GCOV_TOOL */
kono
parents:
diff changeset
107 /* About the host. */
kono
parents:
diff changeset
108 /* This path will be compiled for the host and linked into
kono
parents:
diff changeset
109 gcov-tool binary. */
kono
parents:
diff changeset
110
kono
parents:
diff changeset
111 #include "config.h"
kono
parents:
diff changeset
112 #include "system.h"
kono
parents:
diff changeset
113 #include "coretypes.h"
kono
parents:
diff changeset
114 #include "tm.h"
kono
parents:
diff changeset
115
kono
parents:
diff changeset
116 typedef unsigned gcov_unsigned_t;
kono
parents:
diff changeset
117 typedef unsigned gcov_position_t;
kono
parents:
diff changeset
118 /* gcov_type is typedef'd elsewhere for the compiler */
kono
parents:
diff changeset
119 #if defined (HOST_HAS_F_SETLKW)
kono
parents:
diff changeset
120 #define GCOV_LOCKED 1
kono
parents:
diff changeset
121 #else
kono
parents:
diff changeset
122 #define GCOV_LOCKED 0
kono
parents:
diff changeset
123 #endif
kono
parents:
diff changeset
124
kono
parents:
diff changeset
125 /* Some Macros specific to gcov-tool. */
kono
parents:
diff changeset
126
kono
parents:
diff changeset
127 #define L_gcov 1
kono
parents:
diff changeset
128 #define L_gcov_merge_add 1
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
129 #define L_gcov_merge_topn 1
111
kono
parents:
diff changeset
130 #define L_gcov_merge_ior 1
kono
parents:
diff changeset
131 #define L_gcov_merge_time_profile 1
kono
parents:
diff changeset
132
kono
parents:
diff changeset
133 extern gcov_type gcov_read_counter_mem ();
kono
parents:
diff changeset
134 extern unsigned gcov_get_merge_weight ();
kono
parents:
diff changeset
135 extern struct gcov_info *gcov_list;
kono
parents:
diff changeset
136
kono
parents:
diff changeset
137 #endif /* !IN_GCOV_TOOL */
kono
parents:
diff changeset
138
kono
parents:
diff changeset
139 #if defined(inhibit_libc)
kono
parents:
diff changeset
140 #define IN_LIBGCOV (-1)
kono
parents:
diff changeset
141 #else
kono
parents:
diff changeset
142 #define IN_LIBGCOV 1
kono
parents:
diff changeset
143 #if defined(L_gcov)
kono
parents:
diff changeset
144 #define GCOV_LINKAGE /* nothing */
kono
parents:
diff changeset
145 #endif
kono
parents:
diff changeset
146 #endif
kono
parents:
diff changeset
147
kono
parents:
diff changeset
148 /* Poison these, so they don't accidentally slip in. */
kono
parents:
diff changeset
149 #pragma GCC poison gcov_write_string gcov_write_tag gcov_write_length
kono
parents:
diff changeset
150 #pragma GCC poison gcov_time gcov_magic
kono
parents:
diff changeset
151
kono
parents:
diff changeset
152 #ifdef HAVE_GAS_HIDDEN
kono
parents:
diff changeset
153 #define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden")))
kono
parents:
diff changeset
154 #else
kono
parents:
diff changeset
155 #define ATTRIBUTE_HIDDEN
kono
parents:
diff changeset
156 #endif
kono
parents:
diff changeset
157
kono
parents:
diff changeset
158 #include "gcov-io.h"
kono
parents:
diff changeset
159
kono
parents:
diff changeset
160 /* Structures embedded in coveraged program. The structures generated
kono
parents:
diff changeset
161 by write_profile must match these. */
kono
parents:
diff changeset
162
kono
parents:
diff changeset
163 /* Information about counters for a single function. */
kono
parents:
diff changeset
164 struct gcov_ctr_info
kono
parents:
diff changeset
165 {
kono
parents:
diff changeset
166 gcov_unsigned_t num; /* number of counters. */
kono
parents:
diff changeset
167 gcov_type *values; /* their values. */
kono
parents:
diff changeset
168 };
kono
parents:
diff changeset
169
kono
parents:
diff changeset
170 /* Information about a single function. This uses the trailing array
kono
parents:
diff changeset
171 idiom. The number of counters is determined from the merge pointer
kono
parents:
diff changeset
172 array in gcov_info. The key is used to detect which of a set of
kono
parents:
diff changeset
173 comdat functions was selected -- it points to the gcov_info object
kono
parents:
diff changeset
174 of the object file containing the selected comdat function. */
kono
parents:
diff changeset
175
kono
parents:
diff changeset
176 struct gcov_fn_info
kono
parents:
diff changeset
177 {
kono
parents:
diff changeset
178 const struct gcov_info *key; /* comdat key */
kono
parents:
diff changeset
179 gcov_unsigned_t ident; /* unique ident of function */
kono
parents:
diff changeset
180 gcov_unsigned_t lineno_checksum; /* function lineo_checksum */
kono
parents:
diff changeset
181 gcov_unsigned_t cfg_checksum; /* function cfg checksum */
kono
parents:
diff changeset
182 struct gcov_ctr_info ctrs[1]; /* instrumented counters */
kono
parents:
diff changeset
183 };
kono
parents:
diff changeset
184
kono
parents:
diff changeset
185 /* Type of function used to merge counters. */
kono
parents:
diff changeset
186 typedef void (*gcov_merge_fn) (gcov_type *, gcov_unsigned_t);
kono
parents:
diff changeset
187
kono
parents:
diff changeset
188 /* Information about a single object file. */
kono
parents:
diff changeset
189 struct gcov_info
kono
parents:
diff changeset
190 {
kono
parents:
diff changeset
191 gcov_unsigned_t version; /* expected version number */
kono
parents:
diff changeset
192 struct gcov_info *next; /* link to next, used by libgcov */
kono
parents:
diff changeset
193
kono
parents:
diff changeset
194 gcov_unsigned_t stamp; /* uniquifying time stamp */
kono
parents:
diff changeset
195 const char *filename; /* output file name */
kono
parents:
diff changeset
196
kono
parents:
diff changeset
197 gcov_merge_fn merge[GCOV_COUNTERS]; /* merge functions (null for
kono
parents:
diff changeset
198 unused) */
kono
parents:
diff changeset
199
kono
parents:
diff changeset
200 unsigned n_functions; /* number of functions */
kono
parents:
diff changeset
201
kono
parents:
diff changeset
202 #ifndef IN_GCOV_TOOL
kono
parents:
diff changeset
203 const struct gcov_fn_info *const *functions; /* pointer to pointers
kono
parents:
diff changeset
204 to function information */
kono
parents:
diff changeset
205 #else
kono
parents:
diff changeset
206 const struct gcov_fn_info **functions;
kono
parents:
diff changeset
207 #endif /* !IN_GCOV_TOOL */
kono
parents:
diff changeset
208 };
kono
parents:
diff changeset
209
kono
parents:
diff changeset
210 /* Root of a program/shared-object state */
kono
parents:
diff changeset
211 struct gcov_root
kono
parents:
diff changeset
212 {
kono
parents:
diff changeset
213 struct gcov_info *list;
kono
parents:
diff changeset
214 unsigned dumped : 1; /* counts have been dumped. */
kono
parents:
diff changeset
215 unsigned run_counted : 1; /* run has been accounted for. */
kono
parents:
diff changeset
216 struct gcov_root *next;
kono
parents:
diff changeset
217 struct gcov_root *prev;
kono
parents:
diff changeset
218 };
kono
parents:
diff changeset
219
kono
parents:
diff changeset
220 extern struct gcov_root __gcov_root ATTRIBUTE_HIDDEN;
kono
parents:
diff changeset
221
kono
parents:
diff changeset
222 struct gcov_master
kono
parents:
diff changeset
223 {
kono
parents:
diff changeset
224 gcov_unsigned_t version;
kono
parents:
diff changeset
225 struct gcov_root *root;
kono
parents:
diff changeset
226 };
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
227
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
228 struct indirect_call_tuple
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
229 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
230 /* Callee function. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
231 void *callee;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
232
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
233 /* Pointer to counters. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
234 gcov_type *counters;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
235 };
111
kono
parents:
diff changeset
236
kono
parents:
diff changeset
237 /* Exactly one of these will be active in the process. */
kono
parents:
diff changeset
238 extern struct gcov_master __gcov_master;
kono
parents:
diff changeset
239
kono
parents:
diff changeset
240 /* Dump a set of gcov objects. */
kono
parents:
diff changeset
241 extern void __gcov_dump_one (struct gcov_root *) ATTRIBUTE_HIDDEN;
kono
parents:
diff changeset
242
kono
parents:
diff changeset
243 /* Register a new object file module. */
kono
parents:
diff changeset
244 extern void __gcov_init (struct gcov_info *) ATTRIBUTE_HIDDEN;
kono
parents:
diff changeset
245
kono
parents:
diff changeset
246 /* GCOV exit function registered via a static destructor. */
kono
parents:
diff changeset
247 extern void __gcov_exit (void) ATTRIBUTE_HIDDEN;
kono
parents:
diff changeset
248
kono
parents:
diff changeset
249 /* Function to reset all counters to 0. Both externally visible (and
kono
parents:
diff changeset
250 overridable) and internal version. */
kono
parents:
diff changeset
251 extern void __gcov_reset_int (void) ATTRIBUTE_HIDDEN;
kono
parents:
diff changeset
252
kono
parents:
diff changeset
253 /* User function to enable early write of profile information so far. */
kono
parents:
diff changeset
254 extern void __gcov_dump_int (void) ATTRIBUTE_HIDDEN;
kono
parents:
diff changeset
255
kono
parents:
diff changeset
256 /* The merge function that just sums the counters. */
kono
parents:
diff changeset
257 extern void __gcov_merge_add (gcov_type *, unsigned) ATTRIBUTE_HIDDEN;
kono
parents:
diff changeset
258
kono
parents:
diff changeset
259 /* The merge function to select the minimum valid counter value. */
kono
parents:
diff changeset
260 extern void __gcov_merge_time_profile (gcov_type *, unsigned) ATTRIBUTE_HIDDEN;
kono
parents:
diff changeset
261
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
262 /* The merge function to choose the most common N values. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
263 extern void __gcov_merge_topn (gcov_type *, unsigned) ATTRIBUTE_HIDDEN;
111
kono
parents:
diff changeset
264
kono
parents:
diff changeset
265 /* The merge function that just ors the counters together. */
kono
parents:
diff changeset
266 extern void __gcov_merge_ior (gcov_type *, unsigned) ATTRIBUTE_HIDDEN;
kono
parents:
diff changeset
267
kono
parents:
diff changeset
268 /* The profiler functions. */
kono
parents:
diff changeset
269 extern void __gcov_interval_profiler (gcov_type *, gcov_type, int, unsigned);
kono
parents:
diff changeset
270 extern void __gcov_interval_profiler_atomic (gcov_type *, gcov_type, int,
kono
parents:
diff changeset
271 unsigned);
kono
parents:
diff changeset
272 extern void __gcov_pow2_profiler (gcov_type *, gcov_type);
kono
parents:
diff changeset
273 extern void __gcov_pow2_profiler_atomic (gcov_type *, gcov_type);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
274 extern void __gcov_topn_values_profiler (gcov_type *, gcov_type);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
275 extern void __gcov_topn_values_profiler_atomic (gcov_type *, gcov_type);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
276 extern void __gcov_indirect_call_profiler_v4 (gcov_type, void *);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
277 extern void __gcov_indirect_call_profiler_v4_atomic (gcov_type, void *);
111
kono
parents:
diff changeset
278 extern void __gcov_time_profiler (gcov_type *);
kono
parents:
diff changeset
279 extern void __gcov_time_profiler_atomic (gcov_type *);
kono
parents:
diff changeset
280 extern void __gcov_average_profiler (gcov_type *, gcov_type);
kono
parents:
diff changeset
281 extern void __gcov_average_profiler_atomic (gcov_type *, gcov_type);
kono
parents:
diff changeset
282 extern void __gcov_ior_profiler (gcov_type *, gcov_type);
kono
parents:
diff changeset
283 extern void __gcov_ior_profiler_atomic (gcov_type *, gcov_type);
kono
parents:
diff changeset
284
kono
parents:
diff changeset
285 #ifndef inhibit_libc
kono
parents:
diff changeset
286 /* The wrappers around some library functions.. */
kono
parents:
diff changeset
287 extern pid_t __gcov_fork (void) ATTRIBUTE_HIDDEN;
kono
parents:
diff changeset
288 extern int __gcov_execl (const char *, char *, ...) ATTRIBUTE_HIDDEN;
kono
parents:
diff changeset
289 extern int __gcov_execlp (const char *, char *, ...) ATTRIBUTE_HIDDEN;
kono
parents:
diff changeset
290 extern int __gcov_execle (const char *, char *, ...) ATTRIBUTE_HIDDEN;
kono
parents:
diff changeset
291 extern int __gcov_execv (const char *, char *const []) ATTRIBUTE_HIDDEN;
kono
parents:
diff changeset
292 extern int __gcov_execvp (const char *, char *const []) ATTRIBUTE_HIDDEN;
kono
parents:
diff changeset
293 extern int __gcov_execve (const char *, char *const [], char *const [])
kono
parents:
diff changeset
294 ATTRIBUTE_HIDDEN;
kono
parents:
diff changeset
295
kono
parents:
diff changeset
296 /* Functions that only available in libgcov. */
kono
parents:
diff changeset
297 GCOV_LINKAGE int gcov_open (const char */*name*/) ATTRIBUTE_HIDDEN;
kono
parents:
diff changeset
298 GCOV_LINKAGE void gcov_write_counter (gcov_type) ATTRIBUTE_HIDDEN;
kono
parents:
diff changeset
299 GCOV_LINKAGE void gcov_write_tag_length (gcov_unsigned_t, gcov_unsigned_t)
kono
parents:
diff changeset
300 ATTRIBUTE_HIDDEN;
kono
parents:
diff changeset
301 GCOV_LINKAGE void gcov_write_summary (gcov_unsigned_t /*tag*/,
kono
parents:
diff changeset
302 const struct gcov_summary *)
kono
parents:
diff changeset
303 ATTRIBUTE_HIDDEN;
kono
parents:
diff changeset
304 GCOV_LINKAGE void gcov_seek (gcov_position_t /*position*/) ATTRIBUTE_HIDDEN;
kono
parents:
diff changeset
305 GCOV_LINKAGE void gcov_rewrite (void) ATTRIBUTE_HIDDEN;
kono
parents:
diff changeset
306
kono
parents:
diff changeset
307 /* "Counts" stored in gcda files can be a real counter value, or
kono
parents:
diff changeset
308 an target address. When differentiate these two types because
kono
parents:
diff changeset
309 when manipulating counts, we should only change real counter values,
kono
parents:
diff changeset
310 rather target addresses. */
kono
parents:
diff changeset
311
kono
parents:
diff changeset
312 static inline gcov_type
kono
parents:
diff changeset
313 gcov_get_counter (void)
kono
parents:
diff changeset
314 {
kono
parents:
diff changeset
315 #ifndef IN_GCOV_TOOL
kono
parents:
diff changeset
316 /* This version is for reading count values in libgcov runtime:
kono
parents:
diff changeset
317 we read from gcda files. */
kono
parents:
diff changeset
318
kono
parents:
diff changeset
319 return gcov_read_counter ();
kono
parents:
diff changeset
320 #else
kono
parents:
diff changeset
321 /* This version is for gcov-tool. We read the value from memory and
kono
parents:
diff changeset
322 multiply it by the merge weight. */
kono
parents:
diff changeset
323
kono
parents:
diff changeset
324 return gcov_read_counter_mem () * gcov_get_merge_weight ();
kono
parents:
diff changeset
325 #endif
kono
parents:
diff changeset
326 }
kono
parents:
diff changeset
327
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
328 /* Similar function as gcov_get_counter(), but do not scale
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
329 when read value is equal to IGNORE_SCALING. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
330
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
331 static inline gcov_type
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
332 gcov_get_counter_ignore_scaling (gcov_type ignore_scaling ATTRIBUTE_UNUSED)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
333 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
334 #ifndef IN_GCOV_TOOL
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
335 /* This version is for reading count values in libgcov runtime:
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
336 we read from gcda files. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
337
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
338 return gcov_read_counter ();
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
339 #else
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
340 /* This version is for gcov-tool. We read the value from memory and
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
341 multiply it by the merge weight. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
342
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
343 gcov_type v = gcov_read_counter_mem ();
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
344 if (v != ignore_scaling)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
345 v *= gcov_get_merge_weight ();
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
346
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
347 return v;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
348 #endif
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
349 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
350
111
kono
parents:
diff changeset
351 /* Similar function as gcov_get_counter(), but handles target address
kono
parents:
diff changeset
352 counters. */
kono
parents:
diff changeset
353
kono
parents:
diff changeset
354 static inline gcov_type
kono
parents:
diff changeset
355 gcov_get_counter_target (void)
kono
parents:
diff changeset
356 {
kono
parents:
diff changeset
357 #ifndef IN_GCOV_TOOL
kono
parents:
diff changeset
358 /* This version is for reading count target values in libgcov runtime:
kono
parents:
diff changeset
359 we read from gcda files. */
kono
parents:
diff changeset
360
kono
parents:
diff changeset
361 return gcov_read_counter ();
kono
parents:
diff changeset
362 #else
kono
parents:
diff changeset
363 /* This version is for gcov-tool. We read the value from memory and we do NOT
kono
parents:
diff changeset
364 multiply it by the merge weight. */
kono
parents:
diff changeset
365
kono
parents:
diff changeset
366 return gcov_read_counter_mem ();
kono
parents:
diff changeset
367 #endif
kono
parents:
diff changeset
368 }
kono
parents:
diff changeset
369
kono
parents:
diff changeset
370 #endif /* !inhibit_libc */
kono
parents:
diff changeset
371
kono
parents:
diff changeset
372 #endif /* GCC_LIBGCOV_H */