Lines Matching +full:gcov +full:- +full:4
1 /*===- GCDAProfiling.c - Support library for GCDA file emission -----------===*\
8 |*===----------------------------------------------------------------------===*|
10 |* This file implements the call back routines for the gcov profiling
12 |* the -insert-gcov-profiling LLVM pass.
14 |* We emit files in a corrupt version of GCOV's "gcda" file format. These files
18 |* TODO: gcov is multi-process safe by having each exit open the existing file
19 |* and append to it. We'd like to achieve that and be thread-safe too.
21 \*===----------------------------------------------------------------------===*/
54 * FreeBSD 10, r232261) when compiled in 32-bit mode.
64 * --- GCOV file format I/O primitives ---
86 static int fd = -1;
118 size = (size - 1) / WRITE_BUFFER_SIZE + 1; in resize_write_buffer()
131 write_bytes((char*)&i, 4); in write_32bit_value()
139 return (strlen(s) / 4) + 1; in length_of_string()
146 write_bytes("\0\0\0\0", 4 - (strlen(s) % 4)); in write_string()
153 return (uint32_t)-1; in read_32bit_value()
156 cur_pos += 4; in read_32bit_value()
164 return (uint64_t)-1; in read_64bit_value()
208 if (prefix[prefix_len - 1] != '/') in mangle_filename()
222 return -1; in map_file()
226 if (write_buffer == (void *)-1) { in map_file()
230 return -1; in map_file()
236 if (msync(write_buffer, file_size, MS_SYNC) == -1) { in unmap_file()
251 * --- LLVM line counter API ---
258 void llvm_gcda_start_file(const char *orig_filename, const char version[4], in llvm_gcda_start_file() argument
267 if (fd == -1) { in llvm_gcda_start_file()
272 if (fd == -1) { in llvm_gcda_start_file()
276 if (fd == -1) { in llvm_gcda_start_file()
302 if (map_file() == -1) { in llvm_gcda_start_file()
313 write_bytes("adcg", 4); in llvm_gcda_start_file()
314 write_bytes(version, 4); in llvm_gcda_start_file()
322 /* Given an array of pointers to counters (counters), increment the n-th one,
361 write_bytes("\0\0\0\1", 4); in llvm_gcda_emit_function()
383 if (val != (uint32_t)-1) { in llvm_gcda_emit_arcs()
393 if (val == (uint32_t)-1 || val / 2 != num_counters) { in llvm_gcda_emit_arcs()
408 write_bytes("\0\0\xa1\1", 4); in llvm_gcda_emit_arcs()
425 const uint32_t obj_summary_len = 9; /* Length for gcov compatibility. */ in llvm_gcda_summary_info()
435 if (val != (uint32_t)-1) { in llvm_gcda_summary_info()
460 write_bytes("\0\0\0\xa1", 4); in llvm_gcda_summary_info()
469 write_bytes("\0\0\0\xa3", 4); /* tag indicates 1 program */ in llvm_gcda_summary_info()
497 fprintf(stderr, "llvmgcda: -----\n"); in llvm_gcda_end_file()
503 new_node->fn = fn; in llvm_register_writeout_function()
504 new_node->next = NULL; in llvm_register_writeout_function()
509 writeout_fn_tail->next = new_node; in llvm_register_writeout_function()
518 curr->fn(); in llvm_writeout_files()
519 curr = curr->next; in llvm_writeout_files()
526 writeout_fn_head = writeout_fn_head->next; in llvm_delete_writeout_function_list()
535 new_node->fn = fn; in llvm_register_flush_function()
536 new_node->next = NULL; in llvm_register_flush_function()
541 flush_fn_tail->next = new_node; in llvm_register_flush_function()
550 curr->fn(); in __gcov_flush()
551 curr = curr->next; in __gcov_flush()
558 flush_fn_head = flush_fn_head->next; in llvm_delete_flush_function_list()