164 #ifndef GCC_GCOV_IO_H
165 #define GCC_GCOV_IO_H
170 #if BITS_PER_UNIT == 8
173 #if LONG_LONG_TYPE_SIZE > 32
181 #if BITS_PER_UNIT == 16
184 #if LONG_LONG_TYPE_SIZE > 32
194 #if LONG_LONG_TYPE_SIZE > 32
205 #if defined (TARGET_POSIX_IO)
206 #define GCOV_LOCKED 1
208 #define GCOV_LOCKED 0
218 #define GCOV_LINKAGE static
222 #include <sys/types.h>
225 #define GCOV_TYPE_SIZE (LONG_LONG_TYPE_SIZE > 32 ? 64 : 32)
228 #if defined (HOST_HAS_F_SETLKW)
229 #define GCOV_LOCKED 1
231 #define GCOV_LOCKED 0
245 #define gcov_var __gcov_var
246 #define gcov_open __gcov_open
247 #define gcov_close __gcov_close
248 #define gcov_write_tag_length __gcov_write_tag_length
249 #define gcov_position __gcov_position
250 #define gcov_seek __gcov_seek
251 #define gcov_rewrite __gcov_rewrite
252 #define gcov_is_error __gcov_is_error
253 #define gcov_write_unsigned __gcov_write_unsigned
254 #define gcov_write_counter __gcov_write_counter
255 #define gcov_write_summary __gcov_write_summary
256 #define gcov_read_unsigned __gcov_read_unsigned
257 #define gcov_read_counter __gcov_read_counter
258 #define gcov_read_summary __gcov_read_summary
261 #pragma GCC poison gcov_write_string gcov_write_tag gcov_write_length
262 #pragma GCC poison gcov_read_string gcov_sync gcov_time gcov_magic
264 #ifdef HAVE_GAS_HIDDEN
265 #define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden")))
267 #define ATTRIBUTE_HIDDEN
272 #define ATTRIBUTE_HIDDEN
277 #define GCOV_LINKAGE extern
281 #define GCOV_DATA_SUFFIX ".gcda"
282 #define GCOV_NOTE_SUFFIX ".gcno"
285 #define GCOV_DATA_MAGIC ((gcov_unsigned_t)0x67636461)
286 #define GCOV_NOTE_MAGIC ((gcov_unsigned_t)0x67636e6f)
292 #include "gcov-iov.h"
295 #define GCOV_UNSIGNED2STRING(ARRAY,VALUE) \
296 ((ARRAY)[0] = (char)((VALUE) >> 24), \
297 (ARRAY)[1] = (char)((VALUE) >> 16), \
298 (ARRAY)[2] = (char)((VALUE) >> 8), \
299 (ARRAY)[3] = (char)((VALUE) >> 0))
306 #define GCOV_TAG_FUNCTION ((gcov_unsigned_t)0x01000000)
307 #define GCOV_TAG_FUNCTION_LENGTH (3)
308 #define GCOV_TAG_BLOCKS ((gcov_unsigned_t)0x01410000)
309 #define GCOV_TAG_BLOCKS_LENGTH(NUM) (NUM)
310 #define GCOV_TAG_BLOCKS_NUM(LENGTH) (LENGTH)
311 #define GCOV_TAG_ARCS ((gcov_unsigned_t)0x01430000)
312 #define GCOV_TAG_ARCS_LENGTH(NUM) (1 + (NUM) * 2)
313 #define GCOV_TAG_ARCS_NUM(LENGTH) (((LENGTH) - 1) / 2)
314 #define GCOV_TAG_LINES ((gcov_unsigned_t)0x01450000)
315 #define GCOV_TAG_COUNTER_BASE ((gcov_unsigned_t)0x01a10000)
316 #define GCOV_TAG_COUNTER_LENGTH(NUM) ((NUM) * 2)
317 #define GCOV_TAG_COUNTER_NUM(LENGTH) ((LENGTH) / 2)
318 #define GCOV_TAG_OBJECT_SUMMARY ((gcov_unsigned_t)0xa1000000)
319 #define GCOV_TAG_PROGRAM_SUMMARY ((gcov_unsigned_t)0xa3000000)
320 #define GCOV_TAG_SUMMARY_LENGTH(NUM) \
321 (1 + GCOV_COUNTERS_SUMMABLE * (10 + 3 * 2) + (NUM) * 5)
325 #define GCOV_COUNTER_ARCS 0
326 #define GCOV_COUNTERS_SUMMABLE 1
328 #define GCOV_FIRST_VALUE_COUNTER 1
333 #define GCOV_COUNTER_V_INTERVAL 1
334 #define GCOV_COUNTER_V_POW2 2
336 #define GCOV_COUNTER_V_SINGLE 3
337 #define GCOV_COUNTER_V_DELTA 4
340 #define GCOV_COUNTER_V_INDIR 5
341 #define GCOV_COUNTER_AVERAGE 6
343 #define GCOV_COUNTER_IOR 7
345 #define GCOV_LAST_VALUE_COUNTER 7
347 #define GCOV_COUNTERS 8
350 #define GCOV_N_VALUE_COUNTERS \
351 (GCOV_LAST_VALUE_COUNTER - GCOV_FIRST_VALUE_COUNTER + 1)
354 #define GCOV_COUNTER_NAMES {"arcs", "interval", "pow2", "single", \
355 "delta", "indirect_call", "average", "ior"}
358 #define GCOV_MERGE_FUNCTIONS {"__gcov_merge_add", \
359 "__gcov_merge_add", \
360 "__gcov_merge_add", \
361 "__gcov_merge_single", \
362 "__gcov_merge_delta", \
363 "__gcov_merge_single", \
364 "__gcov_merge_add", \
368 #define GCOV_TAG_FOR_COUNTER(COUNT) \
369 (GCOV_TAG_COUNTER_BASE + ((gcov_unsigned_t)(COUNT) << 17))
371 #define GCOV_COUNTER_FOR_TAG(TAG) \
372 ((unsigned)(((TAG) - GCOV_TAG_COUNTER_BASE) >> 17))
374 #define GCOV_TAG_IS_COUNTER(TAG) \
375 (!((TAG) & 0xFFFF) && GCOV_COUNTER_FOR_TAG (TAG) < GCOV_COUNTERS)
380 #define GCOV_TAG_MASK(TAG) (((TAG) - 1) ^ (TAG))
383 #define GCOV_TAG_IS_SUBTAG(TAG,SUB) \
384 (GCOV_TAG_MASK (TAG) >> 8 == GCOV_TAG_MASK (SUB) \
385 && !(((SUB) ^ (TAG)) & ~GCOV_TAG_MASK (TAG)))
388 #define GCOV_TAG_IS_SUBLEVEL(TAG,SUB) \
389 (GCOV_TAG_MASK (TAG) > GCOV_TAG_MASK (SUB))
392 #define GCOV_BLOCK_UNEXPECTED (1 << 1)
395 #define GCOV_ARC_ON_TREE (1 << 0)
396 #define GCOV_ARC_FAKE (1 << 1)
397 #define GCOV_ARC_FALLTHROUGH (1 << 2)
405 gcov_unsigned_t num_counters;
417 #define GCOV_HISTOGRAM_SIZE 252
422 #define GCOV_HISTOGRAM_BITVECTOR_SIZE (GCOV_HISTOGRAM_SIZE + 31) / 32
478 gcov_unsigned_t
stamp;
525 extern
int __gcov_execl (const
char *,
char *, ...) ATTRIBUTE_HIDDEN;
526 extern
int __gcov_execlp (const
char *,
char *, ...) ATTRIBUTE_HIDDEN;
527 extern
int __gcov_execle (const
char *,
char *, ...) ATTRIBUTE_HIDDEN;
528 extern
int __gcov_execv (const
char *,
char *const []) ATTRIBUTE_HIDDEN;
529 extern
int __gcov_execvp (const
char *,
char *const []) ATTRIBUTE_HIDDEN;
530 extern
int __gcov_execve (const
char *,
char *const [],
char *const [])
539 #define GCOV_BLOCK_SIZE (1 << 10)
544 gcov_position_t
start;
555 gcov_unsigned_t
buffer[GCOV_BLOCK_SIZE + 1];
575 GCOV_LINKAGE
int gcov_open (
const char *) ATTRIBUTE_HIDDEN;
577 GCOV_LINKAGE
int gcov_open (
const char *,
int );
578 GCOV_LINKAGE
int gcov_magic (gcov_unsigned_t, gcov_unsigned_t);
580 GCOV_LINKAGE
int gcov_close (
void) ATTRIBUTE_HIDDEN;
599 GCOV_LINKAGE
void gcov_seek (gcov_position_t ) ATTRIBUTE_HIDDEN;
603 GCOV_LINKAGE
void gcov_sync (gcov_position_t ,
612 #if !IN_GCOV && !IN_LIBGCOV
620 #if IN_GCOV <= 0 && !IN_LIBGCOV
626 #define NUM_GCOV_WORKING_SETS 128
649 static inline gcov_position_t