| 1 |
/* GCOV interface routines. |
| 2 |
Copyright (C) 2017-2025 Free Software Foundation, Inc. |
| 3 |
|
| 4 |
This file is part of GCC. |
| 5 |
|
| 6 |
GCC is free software; you can redistribute it and/or modify it under |
| 7 |
the terms of the GNU General Public License as published by the Free |
| 8 |
Software Foundation; either version 3, or (at your option) any later |
| 9 |
version. |
| 10 |
|
| 11 |
GCC is distributed in the hope that it will be useful, but WITHOUT ANY |
| 12 |
WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 |
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 14 |
for more details. |
| 15 |
|
| 16 |
Under Section 7 of GPL version 3, you are granted additional |
| 17 |
permissions described in the GCC Runtime Library Exception, version |
| 18 |
3.1, as published by the Free Software Foundation. |
| 19 |
|
| 20 |
You should have received a copy of the GNU General Public License and |
| 21 |
a copy of the GCC Runtime Library Exception along with this program; |
| 22 |
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
| 23 |
<http://www.gnu.org/licenses/>. */ |
| 24 |
|
| 25 |
#ifndef GCC_GCOV_H |
| 26 |
#define GCC_GCOV_H |
| 27 |
|
| 28 |
struct gcov_info; |
| 29 |
|
| 30 |
/* Set all counters to zero. */ |
| 31 |
|
| 32 |
extern void __gcov_reset (void); |
| 33 |
|
| 34 |
/* Write profile information to a file. */ |
| 35 |
|
| 36 |
extern void __gcov_dump (void); |
| 37 |
|
| 38 |
/* Convert the gcov information referenced by INFO to a gcda data stream. |
| 39 |
The FILENAME_FN callback is called exactly once with the filename associated |
| 40 |
with the gcov information. The filename may be NULL. Afterwards, the |
| 41 |
DUMP_FN callback is subsequently called with chunks (the begin and length of |
| 42 |
the chunk are passed as the first two callback parameters) of the gcda data |
| 43 |
stream. The ALLOCATE_FN callback shall allocate memory with a size in |
| 44 |
characters specified by the first callback parameter. The ARG parameter is |
| 45 |
a user-provided argument passed as the last argument to the callback |
| 46 |
functions. It is recommended to use the __gcov_filename_to_gcfn() |
| 47 |
in the filename callback function. */ |
| 48 |
|
| 49 |
extern void |
| 50 |
__gcov_info_to_gcda (const struct gcov_info *__info, |
| 51 |
void (*__filename_fn) (const char *, void *), |
| 52 |
void (*__dump_fn) (const void *, unsigned, void *), |
| 53 |
void *(*__allocate_fn) (unsigned, void *), |
| 54 |
void *__arg); |
| 55 |
|
| 56 |
/* Convert the FILENAME to a gcfn data stream. The DUMP_FN callback is |
| 57 |
subsequently called with chunks (the begin and length of the chunk are |
| 58 |
passed as the first two callback parameters) of the gcfn data stream. |
| 59 |
The ARG parameter is a user-provided argument passed as the last |
| 60 |
argument to the DUMP_FN callback function. This function is intended |
| 61 |
to be used by the filename callback of __gcov_info_to_gcda(). The gcfn |
| 62 |
data stream is used by the merge-stream subcommand of the gcov-tool to |
| 63 |
get the filename associated with a gcda data stream. */ |
| 64 |
|
| 65 |
extern void |
| 66 |
__gcov_filename_to_gcfn (const char *__filename, |
| 67 |
void (*__dump_fn) (const void *, unsigned, void *), |
| 68 |
void *__arg); |
| 69 |
|
| 70 |
#endif /* GCC_GCOV_H */ |