aboutsummaryrefslogtreecommitdiff
path: root/libgcc/libgcov-interface.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2014-09-17 20:13:17 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2014-09-17 20:13:17 +0000
commitcadb2b96890ca65acba6837c24e67f074826f7fa (patch)
treed63e4fa5645e26ab19e311988498d7daa883d937 /libgcc/libgcov-interface.c
parentc83ee180191ab19daabee8edefa3e8cf4d00b67f (diff)
downloadgcc-cadb2b96890ca65acba6837c24e67f074826f7fa.zip
gcc-cadb2b96890ca65acba6837c24e67f074826f7fa.tar.gz
gcc-cadb2b96890ca65acba6837c24e67f074826f7fa.tar.bz2
Makefile.in (LIBGCOV_INTERFACE): Add _gcov_dump from ...
* Makefile.in (LIBGCOV_INTERFACE): Add _gcov_dump from ... (LIBGCOV_DRIVER): ... here. * libgcov-driver.c (gcov_master): New. (gcov_exit): Remove from master chain. (__gcov_init): Add to master chain if version compatible. Don't clear the version. * libgcov_interface (__gcov_flust): Call gcov_dump_int. (gcov_reset_int): Clear master chain, if compatible. (gcov_dump_int): New internal interface. Dump master chain, if compatible. (gcov_dump): Alias for gcov_dump_int. * libgcov.h (struct gcov_root): Add next and prev fields. (struct gcov_master): New struct. (__gcov_master): New. (gcov_dump_int): Declare. From-SVN: r215337
Diffstat (limited to 'libgcc/libgcov-interface.c')
-rw-r--r--libgcc/libgcov-interface.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/libgcc/libgcov-interface.c b/libgcc/libgcov-interface.c
index e402689..3e6ec20 100644
--- a/libgcc/libgcov-interface.c
+++ b/libgcc/libgcov-interface.c
@@ -85,7 +85,7 @@ __gcov_flush (void)
init_mx_once ();
__gthread_mutex_lock (&__gcov_flush_mx);
- __gcov_dump_one (&__gcov_root);
+ __gcov_dump_int ();
__gcov_reset_int ();
__gthread_mutex_unlock (&__gcov_flush_mx);
@@ -132,8 +132,16 @@ gcov_clear (const struct gcov_info *list)
void
__gcov_reset_int (void)
{
- gcov_clear (__gcov_root.list);
- __gcov_root.dumped = 0;
+ struct gcov_root *root;
+
+ /* If we're compatible with the master, iterate over everything,
+ otherise just do us. */
+ for (root = __gcov_master.version == GCOV_VERSION
+ ? __gcov_master.root : &__gcov_root; root; root = root->next)
+ {
+ gcov_clear (root->list);
+ root->dumped = 0;
+ }
}
ALIAS_void_fn (__gcov_reset_int, __gcov_reset);
@@ -145,11 +153,19 @@ ALIAS_void_fn (__gcov_reset_int, __gcov_reset);
so far, in order to collect profile in region of interest. */
void
-__gcov_dump (void)
+__gcov_dump_int (void)
{
- __gcov_dump_one (&__gcov_root);
+ struct gcov_root *root;
+
+ /* If we're compatible with the master, iterate over everything,
+ otherise just do us. */
+ for (root = __gcov_master.version == GCOV_VERSION
+ ? __gcov_master.root : &__gcov_root; root; root = root->next)
+ __gcov_dump_one (root);
}
+ALIAS_void_fn (__gcov_dump_int, __gcov_dump);
+
#endif /* L_gcov_dump */
#ifdef L_gcov_fork
@@ -169,8 +185,8 @@ __gcov_fork (void)
#endif
#ifdef L_gcov_execl
-/* A wrapper for the execl function. Flushes the accumulated profiling data, so
- that they are not lost. */
+/* A wrapper for the execl function. Flushes the accumulated
+ profiling data, so that they are not lost. */
int
__gcov_execl (const char *path, char *arg, ...)